NextFlow is a Galaxy.ai-inspired visual workflow builder that allows authenticated users to create, configure, save, and execute AI workflows using a node-based canvas.
The application supports workflow creation, React Flow-based node editing, background execution with Trigger.dev, Gemini-powered AI nodes, crop-image workflow nodes, execution history, dark/light mode, and JSON import/export.
- Clerk authentication
- Protected dashboard
- Multiple workflows per user
- Visual workflow builder using React Flow
- Bottom floating toolbar for adding nodes
- Editable node configuration panel
- Save and load workflows from PostgreSQL
- Workflow rename and delete
- Workflow execution using Trigger.dev
- Gemini AI node execution
- Crop image node with delayed execution
- Workflow run history
- Node-level execution status
- Final response rendering with Markdown support
- JSON import/export
- Dark mode and light mode toggle
- Collapsible history panel
- Dashboard navigation from workflow editor
- Next.js App Router
- TypeScript
- Tailwind CSS
- Clerk
- Prisma ORM
- PostgreSQL / Neon
- React Flow
- Trigger.dev
- Gemini API
- Zustand
- Lucide React
- React Markdown
nextflow/
βββ prisma/
β βββ schema.prisma
β
βββ src/
β βββ app/
β β βββ api/
β β β βββ workflows/
β β βββ dashboard/
β β βββ sign-in/
β β βββ sign-up/
β β βββ workflow/
β β βββ globals.css
β β βββ layout.tsx
β β βββ page.tsx
β β
β βββ components/
β β βββ common/
β β βββ dashboard/
β β βββ layout/
β β βββ providers/
β β βββ workflow/
β β
β βββ lib/
β β βββ dag.ts
β β βββ format-run-result.ts
β β βββ gemini.ts
β β βββ interpolate.ts
β β βββ node-executor.ts
β β βββ prisma.ts
β β βββ sample-workflow.ts
β β βββ sleep.ts
β β βββ workflow-executor.ts
β β βββ workflow-node-factory.ts
β β βββ workflow-validation.ts
β β
β βββ store/
β βββ trigger/
β β βββ run-workflow.ts
β βββ types/
β
βββ trigger.config.ts
βββ package.json
βββ README.mdgit clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
cd YOUR_REPO_NAMEnpm installCreate a .env file in the root directory:
DATABASE_URL="your_neon_postgresql_url"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="your_clerk_publishable_key"
CLERK_SECRET_KEY="your_clerk_secret_key"
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_OUT_URL=/sign-in
GEMINI_API_KEY="your_gemini_api_key"
TRIGGER_SECRET_KEY="your_trigger_secret_key"Generate Prisma client:
npx prisma generateRun migrations:
npx prisma migrate devOptional: open Prisma Studio
npx prisma studionpm run devThe app will run at:
http://localhost:3000In a separate terminal, run:
npx trigger.dev@latest devThis is required for workflow execution during local development.
Create a workflow with this structure:
Request Inputs β Gemini β ResponseConfigure the Gemini node with:
Model:
gemini-2.5-flash
System Prompt:
You are a helpful assistant. Keep the response short and clear.
Prompt:
Write a short motivational quote for a student preparing for interviews.Click:
Save changes β RunExpected result:
- History shows
RUNNING - Then changes to
SUCCESS - Final Response displays the generated Gemini output
Create this workflow:
Request Inputs β Crop Image β ResponseExpected result:
- Crop node waits around 30 seconds
- History updates from
RUNNINGtoSUCCESS - Final response shows crop output details
NextFlow executes workflows as a directed acyclic graph.
Execution behavior:
- Nodes run only after their dependencies are completed
- Independent sibling nodes run in parallel
- Workflow status is stored in PostgreSQL
- Each node execution is stored as a
NodeRun - Overall workflow execution is stored as a
WorkflowRun - Final output is captured by the Response node
Example:
Request Inputs
βββ Crop Image #1
βββ Crop Image #2
βββ Gemini #1 β Gemini #2
Crop Image #1 β
Crop Image #2 βββ Final Gemini β Response
Gemini #2 βThe main Prisma models are:
Workflow
WorkflowRun
NodeRunStores workflow metadata, nodes, and edges.
Stores each workflow execution.
Stores individual node execution results, status, duration, input, output, and errors.
npm run devStarts the local development server.
npm run buildGenerates Prisma client, deploys migrations, and builds the Next.js app.
npm run startStarts the production server.
npm run lintRuns ESLint.
The recommended deployment setup is:
Frontend / Next.js App: Vercel
Database: Neon PostgreSQL
Workflow Execution: Trigger.dev
Authentication: Clerkgit add .
git commit -m "Prepare project for deployment"
git pushGo to Vercel and import the GitHub repository.
Use:
Framework Preset: Next.js
Build Command: npm run build
Install Command: npm install
Output Directory: .nextDATABASE_URL="your_neon_postgresql_url"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="your_clerk_publishable_key"
CLERK_SECRET_KEY="your_clerk_secret_key"
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_OUT_URL=/sign-in
GEMINI_API_KEY="your_gemini_api_key"
TRIGGER_SECRET_KEY="your_trigger_secret_key"Deploy Trigger.dev tasks using:
npx trigger.dev@latest deployMake sure your task file exists at:
src/trigger/run-workflow.tsAnd your trigger.config.ts points to:
dirs: ["./src/trigger"]In Trigger.dev dashboard, add these environment variables:
DATABASE_URL="your_neon_postgresql_url"
GEMINI_API_KEY="your_gemini_api_key"
CLERK_SECRET_KEY="your_clerk_secret_key"Without these, workflow runs may remain stuck in RUNNING.
In Clerk dashboard, add your production domain:
https://your-project.vercel.appAdd redirect URLs:
https://your-project.vercel.app/sign-in
https://your-project.vercel.app/sign-up
https://your-project.vercel.app/dashboardAlso keep local URLs for development:
http://localhost:3000/sign-in
http://localhost:3000/sign-up
http://localhost:3000/dashboardUsed to provide workflow input text and image URL.
Simulates an image crop operation and waits at least 30 seconds before completing.
Uses Gemini API to generate AI output from prompts.
Captures and displays the final workflow response.
NextFlow includes dark mode and light mode support using next-themes.
Users can toggle the theme from the header.
Users can export a workflow as JSON and import it later.
This allows workflows to be shared, backed up, or restored.
Sumit Verma