How satwik-dubey/nextgig works
Project type and purpose
• NextGig is a full-stack Next.js application (app directory uses Next.js App Router).
• It offers end-to-end career services: user profile management, AI-driven resume & cover letters, quizzes, industry insights.
• It combines synchronous UI routes, serverless API routes, background jobs, a relational database, and third-party integrations.
File structure for architectural hints
• app/ – contains Next.js frontend pages (auth, main) and API routes (app/api).
• lib/ & app/lib/ – helper modules, Prisma client, Inngest orchestration code.
• prisma/ – database schema and migrations (NeonDB via Prisma).
• actions/ – encapsulated business actions (resume, cover letter, interviews) invoked by routes or Inngest.
• public/, components/, hooks/ – static assets, UI components, custom hooks.
• middleware.js – global request layer (e.g., Clerk authentication).
• next.config.mjs, postcss.config.mjs, Tailwind CSS integration.
Extract runtime architecture from README
• Frontend: Next.js + Tailwind CSS, deployed on Vercel.
• Backend: Node.js serverless routes + Inngest functions, uses Express-style handlers (via Inngest).
• Auth: Clerk (middleware + React components).
• Database: NeonDB (PostgreSQL) accessed via Prisma ORM.
• AI: Google Gemini API for text generation.
• External data sources: periodic industry updates, ingested by scheduled Inngest jobs.
Main components
1. Client (Web Browser)
2. Next.js Frontend (SSR + React in app/ pages)
3. Next.js Server/API Layer
– API routes (app/api/inngest/route.js)
– Business logic modules (actions/, app/lib/helper.js, app/lib/schema.js)
4. Inngest Orchestration
– Scheduled jobs (industry insights every 10 days)
– Background functions (app/lib/inngest/functions.js)
5. Authentication Service: Clerk
6. Database: NeonDB (Prisma ORM)
7. AI Service: Google Gemini API
8. External Data Sources: industry trend feeds
9. Deployment environment: Vercel
Relationships & data flows
• Client ↔ Next.js Frontend: HTTP(S) for SSR/SSG pages, client-side navigation with React.
• Frontend → API Layer: fetch() calls to /api/* endpoints (interview.js, resume.js, user.js).
• API Layer → Business Actions: invokes functions in actions/ and app/lib.
• Business Actions → Prisma Client → NeonDB: CRUD for user profiles, resumes, quizzes.
• API Layer → Google Gemini: generate cover letters, resume content.
• Inngest Scheduler ↔ API Layer: triggers periodic background jobs (industry insights ingest).
• Inngest Functions → External Data Sources: fetch and summarize with AI, store to DB.
• All inbound requests pass through middleware.js for Clerk auth.
Architectural patterns & design principles
• Separation of concerns: UI (components/ + app/) vs. business logic (actions/ + app/lib) vs. data layer (prisma/).
• Serverless functions pattern: Next.js API routes & Inngest jobs, no dedicated monolith server.
• Orchestration/Event-driven: Inngest manages background tasks, scheduling, and retries.
• ORM abstraction: Prisma schema defines models (prisma/schema.prisma), migrations guarantee versioning.
• Externalized config: next.config.mjs, environment variables for DB, Clerk, Google Gemini.