How nilooy/flowgpt works
Project type and purpose
• This is a full-stack Next.js web application (“FlowGPT”) that lets users generate AI-driven flowcharts in the browser.
• Key features:
• React/Next.js front-end with Tailwind CSS and DaisyUI
• Serverless API routes (Next.js)
Main components
a. Browser / User Interface
– Pages (src/pages/index.tsx)
– React components (src/components/nav.tsx, select-template.tsx)
– Tailwind/DaisyUI styling layer
b. Next.js Server / API Layer
– API route (src/pages/api/ask.ts) serving POST requests
– _app.tsx / _document.tsx for SSR/boilerplate
c. Business Logic / Back-end Modules
– Prompt builder (src/lib/prompt-by-template.ts)
– Generation engine (src/lib/generate.ts)
– Helpers (src/lib/helpers.ts)
– Syntax templates (src/lib/syntax/*.md)
d. External Service
– OpenAI REST API (via Langchain)
Relationships and data flow
1. User selects a template & clicks “Generate” in the browser.
2. Browser issues a fetch POST to /api/ask.
3. API handler loads the correct .md syntax template.
4. Prompt-builder composes the user query + template.
5. Generation engine calls OpenAI (via Langchain).
7. API responds with JSON containing the DSL.
Architectural patterns & design principles
• Separation of concerns: UI, API routes, business logic, syntax data all in separate folders.
• Modular design: each lib function has a single responsibility (prompt building, AI call, helper utilities).
• Serverless functions (thin API layer).
• Static assets (public/brand, favicon).
Technologies & frameworks to annotate
• Next.js (pages folder, API routes, SSR/SSG)
• React + TypeScript (tsx files)
• Tailwind CSS + DaisyUI (tailwind.config.js, globals.css)
• Langchain & OpenAI API
• Vercel (deployment target, implied by Next.js)