How shadowxbyte/taskflow works
What this project is (type + purpose)
TASKFLOW is a full-stack Next.js application (App Router) that ships both:
• a server-rendered React UI (calendar/task workspace)
• a set of API route handlers (auth, register, CRUD tasks)
It’s account-based: users authenticate (NextAuth Credentials provider) and all task operations are scoped to the authenticated user. Persistence is via Prisma ORM to Neon Postgres.
• Browser/UI routes
• Server route handlers (API)
• Auth/session layer
• Database access layer (Prisma)
• Postgres (Neon)
UI / App Router pages
• app/layout.tsx – root layout shell (global structure)
• app/page.tsx – likely landing/login entry
• app/workspace/page.tsx – main authenticated task/calendar workspace
• app/providers.tsx – React/Next providers (often SessionProvider / theme, etc.)
• app/globals.css + Tailwind pipeline (implied by configs)
API routes (server endpoints inside Next.js)
• app/api/auth/[...nextauth]/route.ts – NextAuth endpoint (session, callbacks)
• app/api/register/route.ts – user registration endpoint
• app/api/tasks/route.ts – tasks collection (GET list, POST create)
• app/api/tasks/[id]/route.ts – task item (PATCH/DELETE/GET by id depending on implementation)
Shared server libraries
• lib/auth.ts – auth utilities, NextAuth config helpers, session retrieval, etc.
• lib/prisma.ts – Prisma client singleton / DB connector
Data layer
• prisma/schema.prisma – data model (User, Task, etc. inferred)
• DB: Neon Postgres (external managed service)
Types / augmentation
• types/next-auth.d.ts – NextAuth session/user typing augmentations
Build/config
• next.config.ts, tsconfig.json, eslint.config.mjs, postcss.config.mjs, package.json
What the README adds (key runtime relationships)
From README:
• Auth: NextAuth Credentials provider (email/password)
• DB: Neon PostgreSQL
• ORM: Prisma
• UI: Tailwind + responsive calendar view
• Data isolation: “Each authenticated account can only access its own tasks”
• “Unauthenticated” flows (register, sign in)
• “Authenticated” flows (tasks CRUD)
• Authorization check occurs server-side (session -> userId -> DB query filter)
Client/UI (React components rendered via App Router)
• Routes: /, /workspace
• Uses fetch() to call /api/...
• Displays calendar + tasks
Next.js Server Runtime
• Hosts Route Handlers:
• /api/auth/[...nextauth] (NextAuth)
• /api/register
• /api/tasks
• /api/tasks/:id
• Hosts RSC/SSR rendering for pages (if applicable)
• Enforces auth on protected routes (commonly via session checks in handlers/pages)
Auth subsystem (NextAuth Credentials)
• Credential verification (email/password)
• Session issuance (cookie/JWT depending on config)
• Session retrieval used by task routes
Data Access Layer
• lib/prisma.ts Prisma Client
• schema.prisma models
Database
• Neon Postgres
• UI → /api/register (create user)
• UI → /api/auth/... (login, session)
• UI → /api/tasks* (CRUD)
• Task route handlers → Auth session retrieval → userId
• Task route handlers → Prisma → Postgres
• NextAuth route → Prisma → Postgres (to validate user credentials / load user)
Key detail to annotate: *All task queries are filtered by authenticated userId* (data isolation).
Important architectural patterns/principles to highlight
• “Next.js integrated full-stack”: UI + API in one deployment artifact.
• “Route Handlers as API layer”: /app/api/**/route.ts.
• “Central auth/session boundary”: NextAuth endpoint issues session; all task endpoints require it.
• “Data isolation by design”: all task reads/writes scoped by userId (authorization at the server).
• “ORM gateway”: Prisma is the only path from server code to Postgres.
• “External managed DB”: Neon is outside the app’s trust boundary (network connection via env vars).
What to label
UI
• app/page.tsx → “Landing / Auth entry”
• app/workspace/page.tsx → “Workspace (calendar + tasks)”
• app/providers.tsx → “Session/React Providers”
API
• app/api/auth/[...nextauth]/route.ts → “NextAuth (Credentials)”
• app/api/register/route.ts → “Register User”
• app/api/tasks/route.ts → “Tasks collection”
• app/api/tasks/[id]/route.ts → “Task item”
Lib
• lib/auth.ts → “Auth config + session helpers”
• lib/prisma.ts → “Prisma Client”
DB
• prisma/schema.prisma → “User/Task schema”
• “Neon Postgres”
• “POST /api/register (email,password)”
• “POST /api/auth/callback/credentials”
• “GET /api/tasks (cookie session)”
• “PATCH /api/tasks/:id (status=complete)”
• “Prisma query: Task.findMany(where userId=…)”
Trust boundaries / security notes
• “Browser (untrusted)”
• “Next.js Server (trusted code)”
• “External DB (managed service)”
Annotate:
• “Auth required” on /api/tasks* and /workspace (if enforced)
• “User-scoped authorization” at task handlers
For “best and most accurate”, produce:
Container (L2): UI vs API vs Auth vs Prisma vs DB
3. Backend component (L3): per-route handler flows + auth/session check + prisma access patterns