# vindyang/mono architecture

> Architecture diagram of the GitHub repository vindyang/mono, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vindyang/mono
- Repository: https://github.com/vindyang/mono

## Overview

#### Purpose and Runtime
Mono is a multi-workspace project-management platform for projects, tasks, collaboration, scheduling, and reporting. It is a TypeScript Next.js 16 App Router application using React 19; Bun is the primary development/package runtime. The top-level application shell and root entry route are `app/layout.tsx` and `app/page.tsx`.

#### Route Segmentation and Application Shell
The App Router separates anonymous and authenticated experiences. Public login/signup routes live under `app/(public)/login/page.tsx` and `app/(public)/signup/page.tsx`; authenticated pages share `app/(authenticated)/layout.tsx`, which is the principal protected UI boundary. The authenticated area exposes dashboard, projects, tasks, team, calendar, analytics, and settings, with navigation centralized in `components/app-sidebar.tsx`.

#### Identity, Sessions, and Access Boundaries
Better Auth is integrated through server and client auth modules: `lib/auth.ts`, `lib/auth/auth-client.ts`, and the catch-all handler `app/api/auth/[...all]/route.ts`. Login-related checks and verification/update behavior are exposed separately by `app/api/auth/login-with-check/route.ts` and `app/api/auth/verify-and-update/route.ts`. Authorization must protect workspace-scoped operations and role-based membership; workspace/member relationships are persisted in the Prisma schema at `prisma/schema.prisma`.

#### Workspace, Project, and Team Collaboration
Projects belong to workspaces and have project-specific membership workflows. Project list/detail entry points are `app/(authenticated)/projects/page.tsx` and `app/(authenticated)/projects/[id]/page.tsx`; mutations are grouped in adjacent server-action modules such as `app/(authenticated)/projects/componentsaction/actions.ts` and `app/(authenticated)/projects/[id]/componentsaction/actions.ts`. Team management, invitation visibility, and roles are routed through `app/(authenticated)/team/page.tsx`, `app/(authenticated)/team/invitations/page.tsx`, and `app/(authenticated)/team/roles/page.tsx`.

Invitation acceptance is a public-to-authenticated boundary: invite links resolve at `app/invite/[id]/page.tsx`, while acceptance is handled by `app/api/invite/accept/route.ts`. Invitation creation/domain logic is shared through `lib/invitations.ts`, with outbound email integration in `lib/email/send.ts`.

#### Task Lifecycle, Attachments, and Scheduling
Task management is centered on `app/(authenticated)/tasks/page.tsx` and per-task detail at `app/(authenticated)/tasks/[id]/page.tsx`. Task mutations are concentrated in `app/(authenticated)/tasks/componentsaction/actions.ts`; interactive client-side workflow includes the drag-and-drop board at `app/(authenticated)/tasks/components/kanban-board.tsx` and details UI at `app/(authenticated)/tasks/[id]/task-details-client.tsx`. This stage governs status, priority, assignment, comments/activity implied by the domain schema, and attached files.

Uploads cross an API/storage boundary: general and avatar upload handlers are `app/api/upload/route.ts` and `app/api/upload/avatar/route.ts`; file retrieval is served from `app/api/serve/[id]/route.ts`. Storage integration modules are `lib/upload.ts`, `lib/supabase/client.ts`, and `lib/supabase/server.ts`.

#### Reporting and Calendar Projections
Analytics and calendar are read-oriented projections over workspace/project/task data. Page entry points are `app/(authenticated)/analytics/page.tsx` and `app/(authenticated)/calendar/page.tsx`; their data actions are in their respective `componentsaction/actions.ts` modules. Analytics visualization is implemented through chart components such as `components/analytics/charts/burndown-chart.tsx` and `components/analytics/charts/activity-trend-chart.tsx`, while task scheduling is rendered by `app/(authenticated)/calendar/components/calendar-view.tsx`.

#### Persistence and External Infrastructure
PostgreSQL is the system of record, accessed through Prisma via `lib/prisma.ts`; entity definitions and relational constraints are in `prisma/schema.prisma`, with evolvable schema history in `prisma/migrations/`. Brevo supplies invitation email delivery through `lib/email/send.ts`. Optional GitHub and Google OAuth providers are supported by the Better Auth configuration described by the repository. Supabase is materially present for upload/storage access, distinct from Prisma/PostgreSQL persistence.

Main entry points: [`components/app-sidebar.tsx`](https://github.com/vindyang/mono/blob/main/components/app-sidebar.tsx) (Workspace navigation), [`lib/prisma.ts`](https://github.com/vindyang/mono/blob/main/lib/prisma.ts) (Prisma data access), [`app/(authenticated)/tasks/componentsaction/actions.ts`](https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/componentsaction/actions.ts) (Task mutations), [`prisma/schema.prisma`](https://github.com/vindyang/mono/blob/main/prisma/schema.prisma) (Workspace membership)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App Router UI"]
  node_root["Application shell<br/>Next.js root<br/>[layout.tsx]"]
  node_public_auth["Login and signup<br/>public routes<br/>[page.tsx]"]
  node_protected_shell["Authenticated shell<br/>protected layout<br/>[layout.tsx]"]
  node_sidebar["Workspace navigation<br/>sidebar<br/>[app-sidebar.tsx]"]
  node_calendar["Calendar projection<br/>read projection<br/>[page.tsx]"]
  node_analytics["Analytics projection<br/>read projection<br/>[page.tsx]"]
end

subgraph group_domain["Collaboration workflows"]
  node_workspace_access[("Workspace membership<br/>authorization model<br/>[schema.prisma]")]
  node_projects["Projects<br/>project pages<br/>[page.tsx]"]
  node_project_actions["Project mutations<br/>server actions<br/>[actions.ts]"]
  node_team["Team and roles<br/>team pages<br/>[page.tsx]"]
  node_invitations["Invitation workflow<br/>invite service<br/>[invitations.ts]"]
  node_invite_accept{{"Accept invitation<br/>invite API<br/>[route.ts]"}}
  node_tasks["Tasks<br/>task pages<br/>[page.tsx]"]
  node_task_actions["Task mutations<br/>server actions<br/>[actions.ts]"]
  node_kanban["Kanban workflow<br/>client board<br/>[kanban-board.tsx]"]
end

subgraph group_platform["Platform services"]
  node_auth_handler{{"Better Auth handler<br/>auth API<br/>[route.ts]"}}
  node_auth_modules["Auth clients and config<br/>auth modules<br/>[auth.ts]"]
  node_uploads{{"Upload API<br/>storage API<br/>[route.ts]"}}
  node_storage[("Supabase Storage<br/>object storage<br/>[server.ts]")]
  node_prisma["Prisma data access<br/>ORM<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL<br/>system of record<br/>[schema.prisma]")]
  node_email{{"Brevo email delivery<br/>email integration<br/>[send.ts]"}}
end

node_root -->|"renders anonymous routes"| node_public_auth
node_root -->|"renders signed-in routes"| node_protected_shell
node_protected_shell -->|"includes"| node_sidebar
node_public_auth -->|"authenticates through"| node_auth_handler
node_protected_shell -->|"checks session"| node_auth_modules
node_auth_modules -->|"configures"| node_auth_handler
node_auth_handler -->|"establishes identity for"| node_workspace_access
node_sidebar -->|"navigates to"| node_projects
node_sidebar -->|"navigates to"| node_tasks
node_sidebar -->|"navigates to"| node_calendar
node_sidebar -->|"navigates to"| node_analytics
node_projects -->|"mutates via"| node_project_actions
node_project_actions -->|"authorizes against"| node_workspace_access
node_team -->|"creates and manages"| node_invitations
node_invitations -->|"acceptance endpoint"| node_invite_accept
node_invitations -->|"sends via"| node_email
node_tasks -->|"mutates via"| node_task_actions
node_tasks -->|"renders board"| node_kanban
node_task_actions -->|"authorizes against"| node_workspace_access
node_task_actions -->|"attaches files through"| node_uploads
node_uploads -->|"stores files"| node_storage
node_calendar -->|"reads scheduled tasks"| node_prisma
node_analytics -->|"reads reporting data"| node_prisma
node_project_actions -->|"persists through"| node_prisma
node_task_actions -->|"persists through"| node_prisma
node_prisma -->|"queries"| node_postgres
node_workspace_access -.->|"defines relations for"| node_postgres

click node_root "https://github.com/vindyang/mono/blob/main/app/layout.tsx"
click node_public_auth "https://github.com/vindyang/mono/blob/main/app/(public)/login/page.tsx"
click node_protected_shell "https://github.com/vindyang/mono/blob/main/app/(authenticated)/layout.tsx"
click node_sidebar "https://github.com/vindyang/mono/blob/main/components/app-sidebar.tsx"
click node_auth_handler "https://github.com/vindyang/mono/blob/main/app/api/auth/%5B...all%5D/route.ts"
click node_auth_modules "https://github.com/vindyang/mono/blob/main/lib/auth.ts"
click node_workspace_access "https://github.com/vindyang/mono/blob/main/prisma/schema.prisma"
click node_projects "https://github.com/vindyang/mono/blob/main/app/(authenticated)/projects/page.tsx"
click node_project_actions "https://github.com/vindyang/mono/blob/main/app/(authenticated)/projects/componentsaction/actions.ts"
click node_team "https://github.com/vindyang/mono/blob/main/app/(authenticated)/team/page.tsx"
click node_invitations "https://github.com/vindyang/mono/blob/main/lib/invitations.ts"
click node_invite_accept "https://github.com/vindyang/mono/blob/main/app/api/invite/accept/route.ts"
click node_tasks "https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/page.tsx"
click node_task_actions "https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/componentsaction/actions.ts"
click node_kanban "https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/components/kanban-board.tsx"
click node_calendar "https://github.com/vindyang/mono/blob/main/app/(authenticated)/calendar/page.tsx"
click node_analytics "https://github.com/vindyang/mono/blob/main/app/(authenticated)/analytics/page.tsx"
click node_uploads "https://github.com/vindyang/mono/blob/main/app/api/upload/route.ts"
click node_storage "https://github.com/vindyang/mono/blob/main/lib/supabase/server.ts"
click node_prisma "https://github.com/vindyang/mono/blob/main/lib/prisma.ts"
click node_postgres "https://github.com/vindyang/mono/blob/main/prisma/schema.prisma"
click node_email "https://github.com/vindyang/mono/blob/main/lib/email/send.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root,node_public_auth,node_protected_shell,node_sidebar,node_calendar,node_analytics toneBlue
class node_workspace_access,node_projects,node_project_actions,node_team,node_invitations,node_invite_accept,node_tasks,node_task_actions,node_kanban toneAmber
class node_auth_handler,node_auth_modules,node_uploads,node_storage,node_prisma,node_postgres,node_email toneMint
```

## Components

### App Router UI

Public and protected user experiences.

- [Application shell](https://github.com/vindyang/mono/blob/main/app/layout.tsx): Next.js root · `app/layout.tsx`
- [Login and signup](https://github.com/vindyang/mono/blob/main/app/(public)/login/page.tsx): public routes · `app/(public)/login/page.tsx`
- [Authenticated shell](https://github.com/vindyang/mono/blob/main/app/(authenticated)/layout.tsx): protected layout · Principal boundary for signed-in pages. · `app/(authenticated)/layout.tsx`
- [Workspace navigation](https://github.com/vindyang/mono/blob/main/components/app-sidebar.tsx): sidebar · `components/app-sidebar.tsx`
- [Calendar projection](https://github.com/vindyang/mono/blob/main/app/(authenticated)/calendar/page.tsx): read projection · `app/(authenticated)/calendar/page.tsx`
- [Analytics projection](https://github.com/vindyang/mono/blob/main/app/(authenticated)/analytics/page.tsx): read projection · `app/(authenticated)/analytics/page.tsx`

### Collaboration workflows

Workspace-scoped project and task operations.

- [Workspace membership](https://github.com/vindyang/mono/blob/main/prisma/schema.prisma): authorization model · Roles and membership scope protected operations. · `prisma/schema.prisma`
- [Projects](https://github.com/vindyang/mono/blob/main/app/(authenticated)/projects/page.tsx): project pages · `app/(authenticated)/projects/page.tsx`
- [Project mutations](https://github.com/vindyang/mono/blob/main/app/(authenticated)/projects/componentsaction/actions.ts): server actions · `app/(authenticated)/projects/componentsaction/actions.ts`
- [Team and roles](https://github.com/vindyang/mono/blob/main/app/(authenticated)/team/page.tsx): team pages · Manages members, invitations, and roles. · `app/(authenticated)/team/page.tsx`
- [Invitation workflow](https://github.com/vindyang/mono/blob/main/lib/invitations.ts): invite service · Public invite resolution and authenticated acceptance. · `lib/invitations.ts`
- [Accept invitation](https://github.com/vindyang/mono/blob/main/app/api/invite/accept/route.ts): invite API · `app/api/invite/accept/route.ts`
- [Tasks](https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/page.tsx): task pages · `app/(authenticated)/tasks/page.tsx`
- [Task mutations](https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/componentsaction/actions.ts): server actions · `app/(authenticated)/tasks/componentsaction/actions.ts`
- [Kanban workflow](https://github.com/vindyang/mono/blob/main/app/(authenticated)/tasks/components/kanban-board.tsx): client board · Drag-and-drop task status workflow. · `app/(authenticated)/tasks/components/kanban-board.tsx`

### Platform services

Identity, persistence, storage, and delivery integrations.

- [Better Auth handler](https://github.com/vindyang/mono/blob/main/app/api/auth/%5B...all%5D/route.ts): auth API · `app/api/auth/[...all]/route.ts`
- [Auth clients and config](https://github.com/vindyang/mono/blob/main/lib/auth.ts): auth modules · `lib/auth.ts`
- [Upload API](https://github.com/vindyang/mono/blob/main/app/api/upload/route.ts): storage API · Handles general and avatar uploads. · `app/api/upload/route.ts`
- [Supabase Storage](https://github.com/vindyang/mono/blob/main/lib/supabase/server.ts): object storage · Attachment and avatar storage access. · `lib/supabase/server.ts`
- [Prisma data access](https://github.com/vindyang/mono/blob/main/lib/prisma.ts): ORM · `lib/prisma.ts`
- [PostgreSQL](https://github.com/vindyang/mono/blob/main/prisma/schema.prisma): system of record · `prisma/schema.prisma`
- [Brevo email delivery](https://github.com/vindyang/mono/blob/main/lib/email/send.ts): email integration · Delivers workspace invitations. · `lib/email/send.ts`

## Connections

- Application shell → Login and signup: renders anonymous routes
- Application shell → Authenticated shell: renders signed-in routes
- Authenticated shell → Workspace navigation: includes
- Login and signup → Better Auth handler: authenticates through
- Authenticated shell → Auth clients and config: checks session
- Auth clients and config → Better Auth handler: configures
- Better Auth handler → Workspace membership: establishes identity for
- Workspace navigation → Projects: navigates to
- Workspace navigation → Tasks: navigates to
- Workspace navigation → Calendar projection: navigates to
- Workspace navigation → Analytics projection: navigates to
- Projects → Project mutations: mutates via
- Project mutations → Workspace membership: authorizes against
- Team and roles → Invitation workflow: creates and manages
- Invitation workflow → Accept invitation: acceptance endpoint
- Invitation workflow → Brevo email delivery: sends via
- Tasks → Task mutations: mutates via
- Tasks → Kanban workflow: renders board
- Task mutations → Workspace membership: authorizes against
- Task mutations → Upload API: attaches files through
- Upload API → Supabase Storage: stores files
- Calendar projection → Prisma data access: reads scheduled tasks
- Analytics projection → Prisma data access: reads reporting data
- Project mutations → Prisma data access: persists through
- Task mutations → Prisma data access: persists through
- Prisma data access → PostgreSQL: queries
- Workspace membership → PostgreSQL: defines relations for
