# codelitdev/courselit architecture

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

- Interactive diagram: https://gitdiagram.com/codelitdev/courselit
- Repository: https://github.com/codelitdev/courselit

## Overview

CourseLit is a multi-tenant learning-commerce platform: creators build and manage course products and sales pages, while learners discover, purchase, and consume them. The repository also includes a background service for mail and notifications, plus a separate documentation app. The README establishes the main product capabilities; sampled route and worker code supports only some internal connections, so other relationships are shown as unverified rather than assumed.

Main entry points: [`apps/web/app/(with-contexts)/(with-layout)/products/page.tsx`](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/products/page.tsx) (Product Browse), [`apps/queue/src/job/routes.ts`](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/job/routes.ts) (Job Routes), [`apps/web/app/(with-contexts)/(with-layout)/checkout/page.tsx`](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/checkout/page.tsx) (Checkout), [`apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/new-mail-page-client.tsx`](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/new-mail-page-client.tsx) (Mail Authoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Learner Experience"]
  node_course_learning["Course Learning<br/>[page.tsx]"]
  node_community["Communities<br/>[page.tsx]"]
  node_product_browse["Product Browse<br/>[page.tsx]"]
  node_checkout["Checkout<br/>[page.tsx]"]
end

subgraph group_creator["Creator Tools"]
  node_page_builder["Page Builder<br/>[index.tsx]"]
  node_course_authoring["Course Authoring<br/>[page.tsx]"]
  node_student_management["Student Management<br/>[page.tsx]"]
  node_mail_authoring["Mail Authoring"]
  node_email_preview["Email Preview"]
end

subgraph group_platform["Commerce Platform"]
  node_product_api["Product API<br/>[route.ts]"]
  node_payment_api["Payment Initiation<br/>[route.ts]"]
  node_user_api["User API<br/>[route.ts]"]
  node_domain_resolution["Domain Resolution<br/>[route.ts]"]
end

subgraph group_messaging["Messaging Service"]
  node_job_routes["Job Routes<br/>[routes.ts]"]
  node_mail_queue["Mail Queue<br/>[handler.ts]"]
  node_mail_worker["Mail Worker<br/>[worker.ts]"]
  node_mail_delivery["Mail Delivery<br/>[mail.ts]"]
  node_notification_enqueue["Notification Enqueue<br/>[enqueue.ts]"]
  node_notification_channel["App Notifications<br/>[app.ts]"]
  node_notification_events["Notification Events<br/>[emitter.ts]"]
  node_notification_stream["Notification Stream<br/>[routes.ts]"]
end

subgraph group_docs["Documentation"]
  node_docs_site["Docs Site<br/>[page.tsx]"]
end

node_learner(("Learner"))
node_creator_user(("Creator"))

node_learner -.->|"browses"| node_product_browse
node_product_browse -.->|"loads products"| node_product_api
node_product_api -.->|"returns products"| node_product_browse
node_learner -.->|"purchases"| node_checkout
node_checkout -.->|"initiates payment"| node_payment_api
node_learner -.->|"takes courses"| node_course_learning
node_learner -.->|"joins communities"| node_community
node_creator_user -.->|"builds pages"| node_page_builder
node_creator_user -.->|"authors courses"| node_course_authoring
node_creator_user -.->|"manages students"| node_student_management
node_creator_user -.->|"creates mail"| node_mail_authoring
node_mail_authoring -->|"renders preview"| node_email_preview
node_user_api -->|"validates key"| node_user_api
node_domain_resolution -->|"resolves host"| node_domain_resolution
node_job_routes -->|"enqueues mail"| node_mail_queue
node_mail_worker -->|"sends mail"| node_mail_delivery
node_job_routes -->|"enqueues notifications"| node_notification_enqueue
node_notification_channel -->|"enqueues notification"| node_notification_enqueue
node_notification_stream -->|"listens for events"| node_notification_events

click node_course_learning "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/course/%5Bslug%5D/%5Bid%5D/page.tsx"
click node_community "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/communities/page.tsx"
click node_product_browse "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/products/page.tsx"
click node_checkout "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/checkout/page.tsx"
click node_product_api "https://github.com/codelitdev/courselit/blob/main/apps/web/app/api/products/route.ts"
click node_payment_api "https://github.com/codelitdev/courselit/blob/main/apps/web/app/api/payment/initiate/route.ts"
click node_user_api "https://github.com/codelitdev/courselit/blob/main/apps/web/app/api/user/route.ts"
click node_domain_resolution "https://github.com/codelitdev/courselit/blob/main/apps/web/app/verify-domain/route.ts"
click node_page_builder "https://github.com/codelitdev/courselit/blob/main/apps/web/components/admin/page-editor/index.tsx"
click node_course_authoring "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/product/%5Bid%5D/content/page.tsx"
click node_student_management "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/users/page.tsx"
click node_mail_authoring "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/new-mail-page-client.tsx"
click node_job_routes "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/job/routes.ts"
click node_mail_queue "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/domain/handler.ts"
click node_mail_worker "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/domain/worker.ts"
click node_mail_delivery "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/mail.ts"
click node_notification_enqueue "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/notifications/services/enqueue.ts"
click node_notification_channel "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/notifications/services/channels/app.ts"
click node_notification_events "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/notifications/utils/emitter.ts"
click node_notification_stream "https://github.com/codelitdev/courselit/blob/main/apps/queue/src/sse/routes.ts"
click node_docs_site "https://github.com/codelitdev/courselit/blob/main/apps/docs-new/app/(home)/%5B%5B...slug%5D%5D/page.tsx"
click node_email_preview "https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/template-email-preview.tsx"

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_course_learning,node_community,node_product_browse,node_checkout toneBlue
class node_page_builder,node_course_authoring,node_student_management,node_mail_authoring,node_email_preview toneAmber
class node_product_api,node_payment_api,node_user_api,node_domain_resolution toneMint
class node_job_routes,node_mail_queue,node_mail_worker,node_mail_delivery,node_notification_enqueue,node_notification_channel,node_notification_events,node_notification_stream toneRose
class node_docs_site,node_learner,node_creator_user toneIndigo
```

## Components

### Learner Experience

- [Course Learning](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/course/%5Bslug%5D/%5Bid%5D/page.tsx): `apps/web/app/(with-contexts)/course/[slug]/[id]/page.tsx`
- [Communities](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/communities/page.tsx): `apps/web/app/(with-contexts)/(with-layout)/communities/page.tsx`
- [Product Browse](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/products/page.tsx): `apps/web/app/(with-contexts)/(with-layout)/products/page.tsx`
- [Checkout](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/(with-layout)/checkout/page.tsx): `apps/web/app/(with-contexts)/(with-layout)/checkout/page.tsx`

### Creator Tools

- [Page Builder](https://github.com/codelitdev/courselit/blob/main/apps/web/components/admin/page-editor/index.tsx): `apps/web/components/admin/page-editor/index.tsx`
- [Course Authoring](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/product/%5Bid%5D/content/page.tsx): `apps/web/app/(with-contexts)/dashboard/(sidebar)/product/[id]/content/page.tsx`
- [Student Management](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/users/page.tsx): `apps/web/app/(with-contexts)/dashboard/(sidebar)/users/page.tsx`
- [Mail Authoring](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/new-mail-page-client.tsx): `apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/new-mail-page-client.tsx`
- [Email Preview](https://github.com/codelitdev/courselit/blob/main/apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/template-email-preview.tsx): `apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/template-email-preview.tsx`

### Commerce Platform

- [Product API](https://github.com/codelitdev/courselit/blob/main/apps/web/app/api/products/route.ts): `apps/web/app/api/products/route.ts`
- [Payment Initiation](https://github.com/codelitdev/courselit/blob/main/apps/web/app/api/payment/initiate/route.ts): `apps/web/app/api/payment/initiate/route.ts`
- [User API](https://github.com/codelitdev/courselit/blob/main/apps/web/app/api/user/route.ts): `apps/web/app/api/user/route.ts`
- [Domain Resolution](https://github.com/codelitdev/courselit/blob/main/apps/web/app/verify-domain/route.ts): `apps/web/app/verify-domain/route.ts`

### Messaging Service

- [Job Routes](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/job/routes.ts): `apps/queue/src/job/routes.ts`
- [Mail Queue](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/domain/handler.ts): `apps/queue/src/domain/handler.ts`
- [Mail Worker](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/domain/worker.ts): `apps/queue/src/domain/worker.ts`
- [Mail Delivery](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/mail.ts): `apps/queue/src/mail.ts`
- [Notification Enqueue](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/notifications/services/enqueue.ts): `apps/queue/src/notifications/services/enqueue.ts`
- [App Notifications](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/notifications/services/channels/app.ts): `apps/queue/src/notifications/services/channels/app.ts`
- [Notification Events](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/notifications/utils/emitter.ts): `apps/queue/src/notifications/utils/emitter.ts`
- [Notification Stream](https://github.com/codelitdev/courselit/blob/main/apps/queue/src/sse/routes.ts): `apps/queue/src/sse/routes.ts`

### Documentation

- [Docs Site](https://github.com/codelitdev/courselit/blob/main/apps/docs-new/app/(home)/%5B%5B...slug%5D%5D/page.tsx): `apps/docs-new/app/(home)/[[...slug]]/page.tsx`

### Other components

- **Learner**
- **Creator**

## Connections

- Learner → Product Browse: browses
- Product Browse → Product API: loads products
- Product API → Product Browse: returns products
- Learner → Checkout: purchases
- Checkout → Payment Initiation: initiates payment
- Learner → Course Learning: takes courses
- Learner → Communities: joins communities
- Creator → Page Builder: builds pages
- Creator → Course Authoring: authors courses
- Creator → Student Management: manages students
- Creator → Mail Authoring: creates mail
- Mail Authoring → Email Preview: renders preview (evidence: `apps/web/app/(with-contexts)/dashboard/(sidebar)/mails/new/new-mail-page-client.tsx`)
- User API → User API: validates key (evidence: `apps/web/app/api/user/route.ts`)
- Domain Resolution → Domain Resolution: resolves host (evidence: `apps/web/app/verify-domain/route.ts`)
- Job Routes → Mail Queue: enqueues mail (evidence: `apps/queue/src/job/routes.ts`)
- Mail Worker → Mail Delivery: sends mail (evidence: `apps/queue/src/domain/worker.ts`)
- Job Routes → Notification Enqueue: enqueues notifications (evidence: `apps/queue/src/job/routes.ts`)
- App Notifications → Notification Enqueue: enqueues notification (evidence: `apps/queue/src/notifications/services/channels/app.ts`)
- Notification Stream → Notification Events: listens for events (evidence: `apps/queue/src/sse/routes.ts`)
