How chandrakantamandal/sensei works
1. Overall shape
- SensAI is a single Next.js 16 App Router application, not a split frontend/backend repo.
- The app is organized around route groups for unauthenticated marketing/auth flows and authenticated product flows.
2. Route boundaries
- app/(auth) contains sign-in and sign-up pages handled through Clerk.
- app/(main) contains the protected product experience: dashboard, onboarding, resume builder, interview practice, and AI cover letters.
- app/layout.js and app/(main)/layout.jsx define the top-level and protected-shell layouts; proxy.js and lib/checkUser.js likely enforce auth/redirect behavior.
3. Primary product subsystems
- Dashboard: industry insights, trends, salary ranges, and recommendation content.
- Resume: resume composition with live preview and editing.
- Interview: quiz generation, practice flow, results, and performance tracking.
- AI Cover Letter: generate, preview, list, and open individual cover letters.
- Onboarding: collects user profile data used to personalize the rest of the app.
4. Server-side business logic
- The actions/ folder is the main domain logic layer.
- Each file maps to a feature area: dashboard.js, interview.js, cover-letter.js, resume.js, and user.js.
- These actions are the main bridge between UI events and backend services such as Prisma, Gemini, and user/session state.
5. Data persistence
- Prisma is the persistence boundary: prisma/schema.prisma plus migrations define the application database model.
- The database is PostgreSQL, and user/profile/generated-content records are likely stored there.
- lib/prisma.js centralizes the Prisma client so feature actions and route handlers can share database access.
6. AI and external services
- Google Gemini is the AI generation backend for dashboard insights, interview questions, cover letters, and resume assistance.
- Clerk is the identity provider and session system.
- The app’s core value flow is: authenticated user input → server action → AI generation and/or DB persistence → rendered personalized content.
7. Background jobs / async processing
- The lib/inggest/ folder, app/api/inggest/route.js, and inggest naming indicate an Inngest-based job pipeline.
- This likely handles asynchronous workflows that should not block the UI, such as generation, enrichment, or post-processing.
- Architecturally, this is a separate event/job boundary from the normal request-response route handlers.
8. Feature-local UI structure
- Each major page keeps its own component set under _components/ or _component/, which keeps feature logic close to the route.
- Examples: resume builder, interview quiz/results, dashboard view, and cover-letter generator/preview/list.
- This suggests a vertical-slice structure: route + local components + server actions per feature.
9. Shared UI and design system
- components/ui/ contains the reusable shadcn/ui primitives used across the app.
- components/ also includes top-level pieces like header, footer, hero, theme provider.
- This layer is presentation-focused and separate from domain logic, so it can be diagrammed as a shared UI foundation.
10. Static content and content models
- data/ contains prebuilt domain content such as industries, features, FAQs, stats, testimonials, and “how it works.”
- These datasets likely feed the landing page, onboarding choices, and dashboard recommendations.
- They form a non-database content source that complements generated and user-specific data.
11. Validation and form flow
- The app uses React Hook Form + Zod, with shared validation definitions in app/lib/schema.js.
- app/lib/helper.js and lib/utils.js provide shared helpers for formatting and common logic.
- Form data usually follows: user input → schema validation → server action → persistence/AI generation.
12. Main end-to-end flows
- Signup/signin → onboarding → personalized main app
- Onboarding/profile data → dashboard/interview/resume/cover-letter personalization
- User input → server action → Gemini/Prisma → saved/generated output → UI preview or history
- These are the key paths to show in an architecture diagram, with Clerk, Prisma/Postgres, Gemini, and Inngest as the external/service boundaries.
Main entry points: layout.jsx Main shell · prisma.js Prisma client · page.jsx Dashboard · dashboard.js Dashboard logic
Components 29
Routes
App Router shells and page entry points
- App layout · Top-level Next.js app shell
app/layout.js - Main shell · Authenticated product layout
app/(main)/layout.jsx - Auth shell · Sign-in and sign-up layout
app/(auth)/layout.jsx - Sign in · Clerk sign-in route
app/(auth)/sign-in/[[...sign-in]]/page.jsx - Sign up · Clerk sign-up route
app/(auth)/sign-up/[[...sign-up]]/page.jsx
Features
Main product slices inside the protected app
- Onboarding · Collects user profile and preferences
app/(main)/onboarding/page.jsx - Dashboard · Personalized career insights and recommendations
app/(main)/dashboard/page.jsx - Resume · Resume composition and preview experience
app/(main)/resume/page.jsx - Interview · Quiz generation, practice, and results
app/(main)/interview/page.jsx - Cover letters · AI cover letter creation and history
app/(main)/ai-cover-letter/page.jsx
Server Logic
Actions, guards, and shared runtime helpers
- Proxy guard · Request-time redirect and protection boundary
proxy.js - User check · Central user/session guard logic
lib/checkUser.js - Dashboard logic · Dashboard data and recommendation generation
actions/dashboard.js - Resume logic · Resume editing and generation actions
actions/resume.js - Interview logic · Quiz, practice, and scoring actions
actions/interview.js - Cover logic · Cover letter generation and retrieval actions
actions/cover-letter.js - User logic · Profile and onboarding persistence actions
actions/user.js
Persistence
Database schema and Prisma access
- Prisma client · Shared database access layer
lib/prisma.js - Schema · Database model definition and migrations
prisma/schema.prisma
Integrations
External identity, AI, and async job services
- Gemini · Generative AI backend for personalized content
- Clerk · Authentication and session provider
- Inngest client · Event/job pipeline client
lib/inggest/client.js - Inngest API · Webhook/trigger endpoint for async jobs
app/api/inggest/route.js - Job funcs · Background workflow handlers
lib/inggest/functions.js
Shared UI
Reusable presentation, content, and validation layer
- UI kit · Reusable shadcn component primitives
components/ui/button.jsx - Site components · Header, footer, hero, and theme wrapper
components/hero.jsx - Content data · FAQs, features, stats, industries, testimonials
data/features.js - Validation · Shared form schemas and helper logic
app/lib/schema.js - Helpers · Shared formatting and utility functions
app/lib/helper.js
Connections 39
- App layout → Auth shell: wraps · Public auth routes render within the app shell
- App layout → Main shell: wraps · Protected product routes render within the app shell
- Proxy guard → User check: uses · Request guard delegates user/session checks
- Auth shell → Sign in: hosts · Clerk sign-in pages live under the auth shell
- Auth shell → Sign up: hosts · Clerk sign-up pages live under the auth shell
- Main shell → Onboarding: routes to · Protected shell contains onboarding flow
- Main shell → Dashboard: routes to · Protected shell contains dashboard
- Main shell → Resume: routes to · Protected shell contains resume builder
- Main shell → Interview: routes to · Protected shell contains interview practice
- Main shell → Cover letters: routes to · Protected shell contains cover-letter tools
- Onboarding → User logic: submits to · Profile form persists user data through actions
- Dashboard → Dashboard logic: loads via · Dashboard UI requests personalized data
- Resume → Resume logic: uses · Resume UI drives server actions
- Interview → Interview logic: uses · Practice flow drives quiz and scoring actions
- Cover letters → Cover logic: uses · Generator and history use cover-letter actions
- Dashboard logic → Prisma client: reads/writes · Dashboard logic persists and reads user content
- Resume logic → Prisma client: reads/writes · Resume logic persists generated and edited data
- Interview logic → Prisma client: reads/writes · Interview progress and results are stored in the database
- Cover logic → Prisma client: reads/writes · Cover-letter records are stored and retrieved
- User logic → Prisma client: writes · Onboarding/profile data is persisted through Prisma
- Prisma client → Schema: implements · Client targets the Prisma data model
- Dashboard logic → Gemini: generates · AI powers insights and recommendations
- Resume logic → Gemini: generates · AI assists resume composition
- Interview logic → Gemini: generates · AI creates questions and feedback
- Cover logic → Gemini: generates · AI drafts cover letters
- Main shell → Clerk: authenticates · Protected app uses Clerk session state
- Proxy guard → Clerk: authenticates · Edge/proxy guard depends on Clerk session info
- Inngest API → Inngest client: accepts events · API route is the job entrypoint
- Inngest client → Job funcs: dispatches · Client triggers background handlers
- Dashboard logic → Inngest client: queues · Some work may be deferred to async jobs
- Cover logic → Inngest client: queues · Generation or post-processing can run asynchronously
- Onboarding → Validation: validates · Form input is validated before submission
- Resume → Validation: validates · Resume form data follows shared schemas
- Interview → Validation: validates · Quiz and practice input use shared schemas
- Cover letters → Validation: validates · Cover-letter forms use shared schemas
- Dashboard → Content data: uses · Static domain content feeds dashboard and landing surfaces
- Site components → UI kit: composes · Site-level components are built from reusable primitives
- App layout → Site components: renders · Global shell depends on shared presentation components
- Dashboard → Helpers: formats · Feature UI uses shared helper functions