# abdulwaheed16/thedigitalcoaching-v1225 architecture

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

- Interactive diagram: https://gitdiagram.com/abdulwaheed16/thedigitalcoaching-v1225
- Repository: https://github.com/abdulwaheed16/thedigitalcoaching-v1225

## Overview

1. This is a Next.js App Router application for “The Digital Coaching,” split into three major surfaces: a public marketing site, an authenticated auth flow, and an admin/dashboard area.

2. The public site lives under `app/(public)` and covers landing/home, about, blogs, courses, curriculum, fee structure, registration, contact, and tutors. These routes are mostly composition of reusable section components from `components/pages/*` and shared layout pieces in `components/layouts/*`.

3. Blog content is a first-class domain. Public blog listing and blog detail pages have route-level loading/error/not-found handling, while the dashboard provides create/edit/preview management for blog posts. This suggests a content workflow with separate public consumption and internal authoring paths.

4. The dashboard under `app/dashboard` is the operational backend for admins. It includes modules for blogs, bookings, enrollments, messages, media, tutors, and settings, with per-entity detail routes and list views. Most of the interactive UI is organized in `components/dashboard/*`, especially table, filters, detail panes, status controls, and bulk/action components.

5. Authentication is separated from both public and dashboard app routes. The `app/auth` area contains sign-in, forgot-password, and reset-password pages, while `app/(server)/api/auth/[...nextauth]` and `auth.ts` indicate NextAuth-based session handling. `middleware.ts` and `components/auth/protected-route.tsx` enforce access boundaries for protected areas.

6. The backend domain logic is concentrated in `lib/actions/*`. These actions cover blogs, bookings, enrollments, messages, newsletters, notifications, tutor applications, uploads, users, and auth. In this repo, many UI screens likely call these actions directly rather than going through a separate REST layer.

7. Data persistence appears to be Prisma-backed. `prisma/schema.prisma`, seed scripts, and `config/prisma.ts` indicate a relational database as the main system of record for application data such as users, posts, bookings, enrollments, and messages.

8. File and media handling is a separate subsystem. `app/(server)/api/uploads/*`, `lib/supabase/*`, `lib/supabase-upload.ts`, and the dashboard media library components show that uploaded images/files are stored and managed outside the core database, with Supabase used as the storage integration.

9. The app uses a mixed server/client architecture. Server-rendered route segments and route handlers handle data fetching, while client components power forms, tables, dialogs, upload progress, search, and dashboard interaction. React Query support in `components/providers/query-provider.tsx` and `lib/react-query.ts` suggests some data is also fetched and cached client-side.

10. Shared business rules are centralized in `lib/validations/*`, `lib/rbac/*`, and helper modules under `lib/helpers/*`. This creates a clear boundary between UI and domain rules such as input validation, permissions, date formatting, and status/color mapping.

11. Cross-cutting UI concerns are handled through providers and global shells: `components/providers/*` for theme/query/dashboard state, `app/layout.tsx` and route-specific layouts for app shells, and global styling via `app/globals.css`, `styles/globals.css`, and Tailwind config. The dashboard likely has its own header/sidebar layout distinct from the public header/footer.

12. There are also a few external integrations that affect architecture: email templates and transporter code under `lib/emails/*`, WhatsApp helpers/widgets in `lib/whatsapp.ts` and `components/whatsapp-*`, and pixel/analytics support in `components/providers/facebook-pixel-provider.tsx` and `lib/fpixel.ts`. These are side-effect systems around lead capture, notifications, and engagement.

13. Static/domain reference data is stored in `data/*` and `public/images/*`, including curriculum, programs, testimonials, and lead/message examples. This supports marketing and curriculum pages without requiring a full backend round-trip for every section.

14. Overall, the architecture is a monorepo-style Next.js web app with a strong separation between public content, authenticated admin operations, and server-side domain/data services. The most important diagram boundaries are: public vs dashboard routes, client UI vs server actions/route handlers, database vs file storage, and authentication/authorization as the gatekeeper for dashboard access.

Main entry points: [`app/(public)`](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(public)) (Public site), [`app/dashboard`](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard) (Dashboard), [`lib/actions`](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/actions) (Server actions), [`app/layout.tsx`](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/blob/main/app/layout.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routes["App routes"]
  node_root_layout["App shell<br/>Next.js root layout<br/>[layout.tsx]"]
  node_public_site["Public site<br/>marketing routes"]
  node_public_blogs["Blog pages<br/>content routes"]
  node_auth_routes["Auth pages<br/>auth routes"]
  node_dashboard_routes["Dashboard<br/>admin routes"]
  node_dashboard_blogs["Blog admin<br/>content management"]
  node_dashboard_entities["Ops modules<br/>admin modules"]
  node_server_api["API routes<br/>route handlers"]
end

subgraph group_ui["Shared UI"]
  node_public_sections["Page sections<br/>shared components"]
  node_layout_shells["Shell layouts<br/>layout components"]
  node_dashboard_ui["Dashboard UI<br/>admin components"]
  node_auth_ui["Auth forms<br/>auth components"]
  node_providers["Providers"]
end

subgraph group_domain["Domain services"]
  node_server_actions["Server actions<br/>domain operations"]
  node_validation_rules["Validations<br/>schema rules"]
  node_rbac_auth["Auth guard<br/>security boundary"]
  node_integrations["Integrations<br/>external services"]
end

subgraph group_storage["Data & assets"]
  node_database[("Prisma DB<br/>relational schema<br/>[schema.prisma]")]
  node_reference_data["Static data<br/>content assets"]
end

node_root_layout -->|"renders"| node_public_site
node_root_layout -->|"renders"| node_auth_routes
node_root_layout -->|"renders"| node_dashboard_routes
node_public_site -->|"composes"| node_public_sections
node_public_site -->|"uses shell"| node_layout_shells
node_public_blogs -->|"renders"| node_public_sections
node_dashboard_routes -->|"includes"| node_dashboard_blogs
node_dashboard_routes -->|"includes"| node_dashboard_entities
node_dashboard_routes -->|"uses shell"| node_layout_shells
node_dashboard_blogs -->|"composes"| node_dashboard_ui
node_dashboard_entities -->|"composes"| node_dashboard_ui
node_auth_routes -->|"uses"| node_auth_ui
node_auth_routes -->|"protected by"| node_rbac_auth
node_server_api -->|"enforces"| node_rbac_auth
node_dashboard_routes -->|"calls"| node_server_actions
node_public_site -->|"calls"| node_server_actions
node_server_actions -->|"validates with"| node_validation_rules
node_server_actions -->|"persists to"| node_database
node_server_api -->|"uses"| node_integrations
node_server_actions -->|"uses"| node_integrations
node_dashboard_entities -->|"reads"| node_reference_data
node_public_site -->|"reads"| node_reference_data
node_rbac_auth -->|"reads"| node_database
node_providers -->|"wraps"| node_dashboard_routes
node_providers -->|"wraps"| node_public_site

click node_root_layout "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/blob/main/app/layout.tsx"
click node_public_site "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(public)"
click node_public_blogs "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(public)/blogs"
click node_auth_routes "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/auth"
click node_dashboard_routes "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard"
click node_dashboard_blogs "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard/blogs"
click node_dashboard_entities "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard"
click node_server_api "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(server)/api"
click node_public_sections "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/pages"
click node_layout_shells "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/layouts"
click node_dashboard_ui "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/dashboard"
click node_auth_ui "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/auth"
click node_providers "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/providers"
click node_server_actions "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/actions"
click node_validation_rules "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/validations"
click node_rbac_auth "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/auth"
click node_integrations "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib"
click node_database "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/blob/main/prisma/schema.prisma"
click node_reference_data "https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/data"

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_layout,node_public_site,node_public_blogs,node_auth_routes,node_dashboard_routes,node_dashboard_blogs,node_dashboard_entities,node_server_api toneBlue
class node_public_sections,node_layout_shells,node_dashboard_ui,node_auth_ui,node_providers toneAmber
class node_server_actions,node_validation_rules,node_rbac_auth,node_integrations toneMint
class node_database,node_reference_data toneRose
```

## Components

### App routes

Public, auth, dashboard, and server route segments

- [App shell](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/blob/main/app/layout.tsx): Next.js root layout · Global app layout and cross-cutting app shell · `app/layout.tsx`
- [Public site](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(public)): marketing routes · Landing pages, blogs, curriculum, registration, tutors, and contact · `app/(public)`
- [Blog pages](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(public)/blogs): content routes · Public blog listing and detail pages with loading/error/not-found states · `app/(public)/blogs`
- [Auth pages](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/auth): auth routes · Sign-in and password recovery flow · `app/auth`
- [Dashboard](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard): admin routes · Authenticated operational area for content and CRM workflows · `app/dashboard`
- [Blog admin](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard/blogs): content management · Create, edit, preview, and manage posts in the dashboard · `app/dashboard/blogs`
- [Ops modules](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/dashboard): admin modules · Bookings, enrollments, messages, tutors, media, and settings routes · `app/dashboard`
- [API routes](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/app/(server)/api): route handlers · NextAuth and upload handlers on the server edge · `app/(server)/api`

### Shared UI

Reusable page sections, layouts, dashboard widgets, and providers

- [Page sections](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/pages): shared components · Reusable marketing and content sections composing public pages · `components/pages`
- [Shell layouts](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/layouts): layout components · Header, footer, sidebar, and dashboard chrome · `components/layouts`
- [Dashboard UI](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/dashboard): admin components · Tables, filters, dialogs, cards, charts, and detail panes for admin screens · `components/dashboard`
- [Auth forms](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/auth): auth components · Protected-route wrapper and sign-in/reset/forgot forms · `components/auth`
- [Providers](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/components/providers): app providers · Theme, query, dashboard state, analytics, and app context providers · `components/providers`

### Domain services

Server actions, validation, auth, and integration logic

- [Server actions](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/actions): domain operations · Blog, booking, enrollment, message, upload, user, auth, and dashboard actions · `lib/actions`
- [Validations](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/validations): schema rules · Input validation for auth, content, CRM, and notifications · `lib/validations`
- [Auth guard](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib/auth): security boundary · Middleware, protected-route component, and role/permission logic · `lib/auth`
- [Integrations](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/lib): external services · Email, Supabase storage, WhatsApp, pixel tracking, and React Query support · `lib`

### Data & assets

Database schema, seed data, and static media

- [Prisma DB](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/blob/main/prisma/schema.prisma): relational schema · Primary database schema and seeds for users, posts, bookings, enrollments, and messages · `prisma/schema.prisma`
- [Static data](https://github.com/abdulwaheed16/thedigitalcoaching-v1225/tree/main/data): content assets · Curriculum, programs, testimonials, leads, and public images · `data`

## Connections

- App shell → Public site: renders · Root app shell includes the public route segment
- App shell → Auth pages: renders · Root app shell includes the auth route segment
- App shell → Dashboard: renders · Root app shell includes the dashboard route segment
- Public site → Page sections: composes · Public routes are built from reusable section components
- Public site → Shell layouts: uses shell · Public routes use shared header/footer layout pieces
- Blog pages → Page sections: renders · Blog list and detail pages reuse shared blog/content sections
- Dashboard → Blog admin: includes · Dashboard routes expose blog management screens
- Dashboard → Ops modules: includes · Dashboard routes expose operational modules
- Dashboard → Shell layouts: uses shell · Dashboard uses its own header/sidebar chrome
- Blog admin → Dashboard UI: composes · Blog admin pages are assembled from tables, filters, cards, and dialogs
- Ops modules → Dashboard UI: composes · Ops modules rely on the shared dashboard widget set
- Auth pages → Auth forms: uses · Auth pages are driven by shared form components
- Auth pages → Auth guard: protected by · Access to protected flows is gated by middleware and route guards
- API routes → Auth guard: enforces · Server auth endpoints participate in session and access control
- Dashboard → Server actions: calls · Admin screens invoke server actions for mutations and workflows
- Public site → Server actions: calls · Public forms and content pages call server actions for submissions and fetches
- Server actions → Validations: validates with · Server mutations share centralized input schemas and rules
- Server actions → Prisma DB: persists to · Actions read and write the Prisma-backed relational store
- API routes → Integrations: uses · API handlers connect to auth, upload, and storage integrations
- Server actions → Integrations: uses · Domain actions send email, upload files, track analytics, and cache client data
- Ops modules → Static data: reads · Admin and marketing screens draw on static curriculum and content data
- Public site → Static data: reads · Public pages use seeded curricula, testimonials, and media assets
- Auth guard → Prisma DB: reads · Session and permission checks depend on persisted user data
- Providers → Dashboard: wraps · App providers supply theme, query, and dashboard state
- Providers → Public site: wraps · Providers also support the public experience and shared UX systems
