How itzsupra13/origyn_ai works
Project type and purpose
• This is a full-stack Next.js application with TypeScript.
• It uses Prisma for database access, tRPC for type-safe RPC calls between client and server, and Inngest for background/event functions.
• UI components are organized under src/components/ui and domain modules under src/modules.
File structure
• Top-level directories:
• src/app: Next.js app-router pages and layout.
• src/components: shared presentational components (UI primitives).
• src/modules: domain-specific UI and server procedures for “projects” and “messages.”
• src/trpc: client & server setup and router definitions.
• src/inngest: background/event function client, utils, definitions.
• src/lib: reusable utilities, database client (db.ts).
• prisma + generated/prisma: schema, migrations, and generated Prisma client.
• public, sandbox-templates: static assets and Docker/TOML templates for sandboxing.
• Config/build files: next.config.ts, tsconfig.json, postcss.config.mjs, eslint.config.mjs, package.json.
README
• Confirms this is a Next.js app bootstrapped via create-next-app.
• Default instructions for local development and Vercel deployment.
Components
a. Frontend (Next.js App)
• src/app: routes, layouts, pages (e.g., /projects/[projectId]).
• src/components + src/modules/*/ui: UI primitives & domain views.
b. API layer (tRPC)
• Client: src/trpc/client.tsx, src/trpc/query-client.ts
• Server: API route at src/app/api/trpc/[trpc]/route.ts
• Routers: src/trpc/routers/_app.ts + domain routers in src/modules/*/server/procedures.ts.
c. Background/Event Functions (Inngest)
• API route at src/app/api/inngest/route.ts
• Function definitions in src/inngest/functions.ts and utilities.
d. Database (Prisma)
• Schema: prisma/schema.prisma + migrations
• Generated client: generated/prisma/client.js used by src/lib/db.ts
e. External services
• Vercel (deployment platform)
• Any other third-party integrations (e.g., external APIs if present)
Relationships & interactions
• Browser → Next.js Frontend
• User navigates pages under src/app.
• UI components render and call tRPC hooks for data.
• Frontend ↔ tRPC API
• tRPC client sends RPCs over the API route to server procedures.
• tRPC Server → Prisma Client
• RPC handlers in src/modules/*/server import db from src/lib/db.ts which uses Prisma.
• Inngest API → Inngest Functions
• Events posted to /api/inngest route → src/inngest/functions.ts workflows → may also call Prisma or external APIs.
• Prisma → Database
• Generated query engine (WASM / Node) executes against the SQL database.
• Deployment
• Vercel hosts Next.js, including API routes and Inngest serverless functions.
Architectural patterns & principles
• Monorepo-style organization: separation of UI, domain modules, API, and infra.
• Clean layering:
• Presentation (Next.js + UI components)
• Application/API (tRPC routers & handlers)
• Domain logic (server procedures in modules)
• Persistence (Prisma + DB)
• Background/event processing (Inngest)
• Type safety end-to-end (TypeScript + tRPC + Prisma types).