How reduanahmadswe/assignment016 works
1. This is a two-app monorepo: a TypeScript backend under backend/ and a Next.js frontend under frontend/. The frontend is the user-facing presentation layer, while the backend is the API and business-logic layer. They are developed and deployed separately but share the same domain model.
2. The backend is structured as a classic modular HTTP service: routes -> middleware -> controller -> service -> Prisma/database -> transformer/response. Each domain area has its own module folder, which keeps the architecture bounded by business capability rather than by technical layer alone.
3. The main backend domains are auth, users, events, courses, blogs, newsletters, payments, reviews, opportunities, certificates, contact, hosts, and admin. This indicates the product is a content-and-program platform, not a single-purpose app: it supports public content, event registration, course delivery, newsletter campaigns, and administrative operations.
4. Authentication and authorization are central cross-cutting concerns. The backend has dedicated middleware for auth, roles, licenses, course ownership, rate limiting, and request validation. The auth module includes Google sign-in, email-based flows, JWT utilities, OTP/two-factor support, and email helpers, so access control is role-aware and security-sensitive.
5. The backend persistence layer is Prisma-based, with a substantial migration history and seed data for blogs, courses, events, opportunities, newsletters, and subscribers. That suggests a relational data model with fairly rich entity relationships. There is also legacy or auxiliary SQL/migration support in src/database, but Prisma is the primary schema-management path.
6. Several background jobs run on the backend via cron modules: event reminders, event status changes, newsletter distribution, OTP cleanup, payment cleanup, post-event review handling, and license checks. These jobs operate on the same database and email infrastructure as the request/response API, so time-based automation is an important part of the system architecture.
7. External integrations materially shape the backend: Cloudinary for media/assets, Google Drive for token-based file access, Gmail/email utilities for notifications, and PDF generation for certificates. The repo also contains a SingleStore certificate bundle, implying the backend connects to a managed SQL database service with custom TLS requirements.
8. The frontend is a large Next.js App Router application with distinct public, authenticated user, teacher, and admin surfaces. Route groups like /admin, /teacher, /dashboard, /courses, /events, /blog, /newsletter, /certificates, and /auth/google/callback show that the UI is organized around the same business domains as the backend.
9. Frontend data access is centralized through src/lib/api.ts, services/, and feature-specific helpers such as course-detail, lecture-preview, slug utilities, and rich-text utilities. Global client state is minimal but important: Redux is used for auth/session state, while custom hooks handle auth and course-builder autosave.
10. Content editing is a major subsystem on the frontend. The app includes a custom Lexical-based rich text editor with many custom nodes and plugins, used in admin/teacher forms for blogs, events, newsletters, opportunities, and courses. This means content authoring is not a simple form workflow; it is a first-class application capability.
11. The course and event flows are particularly important to the product. Courses include public browsing, checkout, learning pages, builder pages, student management, payments, and coupons. Events include public listing, registration, attendance, email templates, meeting-link handling, and certificates. The README’s demo event payload matches this workflow: an admin creates an event with speakers, hybrid meeting details, pricing, capacity, and certificate settings.
12. Operationally, the repo is prepared for independent deployment pipelines. There is a GitHub Actions deployment workflow, plus PM2/ecosystem configs and Vercel configuration files. That suggests the frontend and backend can be hosted in different runtimes, with the backend also supporting Node process management and scheduled tasks.
Main entry points: modules Domain modules · cron Cron jobs · app Next app · api.ts API layer
Components 20
Backend
TypeScript HTTP API, business logic, persistence, jobs, and integrations.
- Server entry · Bootstraps the API server and wires app, routes, and cron jobs.
backend/src/server.ts - Route map · Central route composition and smaller diagnostic/test route sets.
backend/src/routes.ts - Middleware · Auth, role, course, license, validation, rate limiting, and error handling.
backend/src/middlewares - Domain modules · Capability-based backend modules for auth, users, content, commerce, certificates, and admin flows.
backend/src/modules - Auth · Google sign-in, email flows, JWT, OTP/two-factor, and auth helpers.
backend/src/modules/auth - Courses · Course catalog, builders, student management, coupons, and course lifecycle logic.
backend/src/modules/courses - Events · Event publishing, registration, attendance, email templates, and status workflows.
backend/src/modules/events - Content · Blogs, newsletters, opportunities, reviews, and contact intake.
backend/src/modules/blogs - Admin · Administrative dashboards, stats, exports, and management endpoints.
backend/src/modules/admin - Payments · Payment handling, manual methods, and payment notification flows.
backend/src/modules/payments - Certificates · Certificate issuance, verification, and PDF generation.
backend/src/modules/certificates - Prisma DB · Primary relational schema, migrations, seeds, and database access configuration.
backend/prisma - Cron jobs · Event reminders, status changes, newsletter distribution, cleanup, and license checks.
backend/src/cron - Integrations · Cloudinary, Gmail/email, Google Drive, PDF generation, and managed SQL TLS assets.
backend/src/services
Frontend
Next.js App Router UI with public, authenticated, teacher, and admin surfaces.
- Next app · Next.js App Router application serving public, dashboard, teacher, and admin experiences.
frontend/src/app - Public UI · Marketing pages, blogs, courses, events, opportunities, contact, newsletter, and auth entry points.
frontend/src/app/page.tsx - User areas · Dashboard, my-courses, my-events, certificates, payments, profile, settings, and security.
frontend/src/app/dashboard - Admin/teacher · Administration and teacher workspaces for content and course management.
frontend/src/app/admin - Rich editor · Lexical-based editor with custom nodes and plugins used across content and course forms.
frontend/src/components/ui/LexicalEditor - API layer · Central API client, services, Redux auth state, and custom hooks.
frontend/src/lib/api.ts
Connections 30
- Server entry → Route map: serves · The server boots the route graph.
- Server entry → Cron jobs: starts · Background jobs run alongside the API process.
- Route map → Middleware: applies · Routes are protected and validated by shared middleware.
- Route map → Domain modules: dispatches · Endpoint groups are routed into capability modules.
- Domain modules → Auth: includes · Identity and access flows are a core module.
- Domain modules → Courses: includes · Course management is a primary business area.
- Domain modules → Events: includes · Event lifecycle and registration are central.
- Domain modules → Content: includes · Content and communication modules share the same service layer.
- Domain modules → Admin: includes · Administrative operations live in their own module.
- Domain modules → Payments: includes · Payments coordinate commerce and notifications.
- Domain modules → Certificates: includes · Certificates are issued and verified from a dedicated module.
- Domain modules → Prisma DB: persists to · Domain services read and write the Prisma-backed database.
- Domain modules → Integrations: uses · Modules depend on mail, media, file, and PDF services.
- Cron jobs → Events: updates · Event reminders and status changes are scheduled.
- Cron jobs → Content: distributes · Newsletter and cleanup jobs operate on content data.
- Cron jobs → Auth: maintains · OTP cleanup and license checks support auth flows.
- Cron jobs → Payments: cleans up · Payment cleanup runs on a schedule.
- Cron jobs → Prisma DB: reads/writes · Jobs operate directly on the shared relational store.
- Next app → Public UI: renders · Public pages make up the main browsing surface.
- Next app → User areas: renders · Authenticated user dashboard areas are separate routes.
- Next app → Admin/teacher: renders · Privileged admin and teacher workspaces are route groups.
- Next app → Rich editor: uses · Content creation screens embed the custom editor.
- Next app → API layer: fetches through · UI state and data access are centralized.
- API layer → Route map: calls API · Frontend services consume the backend HTTP surface.
- Rich editor → Admin/teacher: supports · Rich authoring powers admin and teacher forms.
- Public UI → API layer: reads data · Public listings and detail pages load from shared services.
- User areas → API layer: reads data · Dashboard views use the same API layer and auth state.
- Admin/teacher → API layer: reads data · Management screens depend on shared API helpers and session state.
- Auth → Integrations: emails/signs in · Auth uses email delivery, Google sign-in, JWTs, and OTP helpers.
- Certificates → Integrations: generates files · Certificate PDFs and verification flows depend on external services.