Skip to content

Feat/frontend canvas - #8

Merged
vedikaagarwal28 merged 2 commits into
mainfrom
feat/frontend-canvas
May 22, 2026
Merged

Feat/frontend canvas#8
vedikaagarwal28 merged 2 commits into
mainfrom
feat/frontend-canvas

Conversation

@vedikaagarwal28

Copy link
Copy Markdown
Collaborator

Description

Built the visual ML pipeline editor . Added a drag-and-drop canvas using React Flow with custom nodes, a sidebar for available nodes, Zustand store for state management, and connected the frontend to the FastAPI backend for pipeline execution.


Type of Change

  • Feature

Related Issues

N/A


Checklist

  • Code follows project guidelines
  • No secrets committed
  • Documentation updated if required
  • Tested locally

Copilot AI review requested due to automatic review settings May 22, 2026 03:56
@vedikaagarwal28
vedikaagarwal28 merged commit a59544f into main May 22, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new frontend visual pipeline builder (canvas + sidebar + node components) backed by Zustand state, and wires the UI to the existing FastAPI pipeline execution endpoint (plus CORS for local dev).

Changes:

  • Introduces a React Flow-based drag-and-drop canvas with custom node renderers and a node sidebar.
  • Adds a Zustand store to manage graph state (nodes/edges) and an API client to call backend execution endpoints.
  • Updates frontend routing/UI (new home page layout) and enables backend CORS for the local frontend.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/tsconfig.json Updates @/* path alias to point at src/* for cleaner imports.
frontend/src/store/pipelineStore.ts Adds Zustand store for React Flow nodes/edges and change handlers.
frontend/src/lib/api.ts Adds fetch-based client for /run_pipeline and /nodes.
frontend/src/components/Sidebar.tsx Adds draggable sidebar UI for available node types.
frontend/src/components/Canvas.tsx Adds React Flow canvas, node type mapping, and drag/drop node creation.
frontend/src/components/nodes/DatasetNode.tsx Adds custom Dataset node renderer.
frontend/src/components/nodes/PreprocessNode.tsx Adds custom Preprocess node renderer.
frontend/src/components/nodes/ModelNode.tsx Adds custom Model node renderer.
frontend/src/components/nodes/TrainTestSplitNode.tsx Adds custom Train/Test Split node renderer.
frontend/package.json Adds @xyflow/react and bumps zustand; retains reactflow.
frontend/package-lock.json Locks new dependencies (notably @xyflow/react).
frontend/app/page.tsx Replaces starter page with the workflow builder layout and “Run Pipeline” action.
frontend/app/globals.css Adds full-height layout styling and React Flow control/node overrides.
backend/app/main.py Adds CORS middleware allowing the local frontend origin.
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"use client";
import { useCallback } from "react";
import { ReactFlow, Background, Controls, MiniMap, BackgroundVariant } from "@xyflow/react";
import "@xyflow/react/dist/style.css";
Comment on lines +26 to +32
const onDrop = useCallback((e: React.DragEvent) => {
e.preventDefault();
const type = e.dataTransfer.getData("nodeType");
if (!type) return;
const bounds = (e.currentTarget as HTMLElement).getBoundingClientRect();
const position = { x: e.clientX - bounds.left - 80, y: e.clientY - bounds.top - 40 };
addNode({ id: `${type}-${Date.now()}`, type, position, data: { label: type } });
Comment thread frontend/src/lib/api.ts
@@ -0,0 +1,38 @@
const BASE_URL = "http://localhost:8000";
Comment thread frontend/src/lib/api.ts
Comment on lines +3 to +12
interface Node {
id: string;
type: string;
config: Record<string, unknown>;
}

interface Edge {
source: string;
target: string;
}
Comment thread frontend/package.json
"next": "16.2.2",
"react": "19.2.4",
"react-dom": "19.2.4",
"reactflow": "^11.11.4",
Comment thread backend/app/main.py
Comment on lines +7 to +13
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants