# mywhitecow/codeforge architecture

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

- Interactive diagram: https://gitdiagram.com/mywhitecow/codeforge
- Repository: https://github.com/mywhitecow/codeforge

## Overview

1. **Repository shape**
   - This is a two-app monorepo: a **Laravel backend** in `backend/api-lumina` and an **Angular frontend** in `frontend/web-lumina`.
   - The backend and frontend are separated by a clear HTTP boundary; the frontend consumes the backend as an API.

2. **Overall product architecture**
   - The README describes **CodeForge Academy / Lumina** as an e-learning subscription platform.
   - In the current codebase, the implemented foundation is primarily **authentication and application scaffolding**, not the full course/subscription domain yet.

3. **Backend role**
   - The Laravel app acts as the **REST API server**.
   - It exposes application behavior through `routes/api.php` and `routes/web.php`, with `AuthController.php` currently the only visible custom controller.
   - Laravel’s standard bootstrap, config, and artisan structure are present, so this is a conventional request/response backend.

4. **Backend domain model**
   - The main domain entities visible in the backend are `User` and `Role`.
   - Migrations include users, roles, cache, jobs, and personal access tokens, which suggests the backend is prepared for:
     - authenticated users,
     - role-based access control,
     - token-based API authentication,
     - queued/background work,
     - caching.

5. **Authentication boundary**
   - The backend uses **Laravel Sanctum** (`config/sanctum.php` and personal access token migration), indicating API authentication is token-oriented rather than session-only.
   - `AuthController` is the likely entry point for login/register/logout or token issuance flows.
   - The `User` model is the central authenticated principal; `Role` suggests authorization is meant to extend beyond simple user login.

6. **Persistence layer**
   - The system persists data in **PostgreSQL**, as documented in the README and reflected in the Laravel database configuration.
   - Database migrations are the source of schema truth; seeders/factories are present for local development and test data.

7. **Frontend role**
   - The Angular app is the user-facing client and likely the primary interaction surface for the platform.
   - `src/app/services/api.ts` is the obvious integration point where the frontend centralizes calls to the Laravel API.
   - `environment.ts` / `environment.development.ts` suggest API base URLs and environment-specific settings are externalized.

8. **Frontend rendering model**
   - The Angular project includes `main.server.ts`, `app.config.server.ts`, and `app.routes.server.ts`, which indicates **server-side rendering support** or a hybrid rendering setup, not just a pure client-side SPA.
   - `server.ts` is the Node-side entry used to serve the Angular app in SSR mode.

9. **Frontend application structure**
   - The frontend is organized around a root app component and route configuration (`app.ts`, `app.routes.ts`, `app.config.ts`).
   - This implies a route-driven UI with shared configuration and a dedicated service layer for API access.

10. **Request/data flow**
   - Typical flow is: browser or server-rendered Angular app → `api.ts` service → Laravel API controller(s) → Eloquent models → PostgreSQL.
   - Authentication flow likely adds: Angular client → Laravel/Sanctum token issuance → token stored client-side → subsequent authenticated API calls.

11. **Operational/runtime boundaries**
   - The backend runs as a PHP/Laravel service (`php artisan serve` in local dev).
   - The frontend runs as a Node/Angular application (`ng serve`), with SSR-capable Node entrypoints present.
   - These are independently runnable services, which is important for diagramming deployment boundaries.

12. **Auxiliary infrastructure**
   - Laravel includes queues, cache, sessions, and storage directories, so the backend is prepared for standard platform concerns beyond simple CRUD.
   - `storage/` and `public/` follow Laravel’s conventional split between persisted files and HTTP-facing assets.

13. **Current maturity signal**
   - The repo is at an early platform stage: strong foundation for identity, authorization, and app scaffolding, but no visible course/catalog/payment modules yet.
   - An architecture diagram should therefore emphasize the **platform skeleton** rather than mature business workflows.

Main entry points: [`backend/api-lumina/app/Http/Controllers/AuthController.php`](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Http/Controllers/AuthController.php) (Auth controller), [`frontend/web-lumina/src/app/app.ts`](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.ts) (Angular app), [`backend/api-lumina/routes/api.php`](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/routes/api.php) (API routes), [`backend/api-lumina/database/migrations`](https://github.com/mywhitecow/codeforge/tree/main/backend/api-lumina/database/migrations) (Migrations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_repo["Monorepo"]
end

subgraph group_backend["Laravel API"]
  node_backend_app["Laravel app<br/>api server"]
  node_backend_routes["API routes<br/>http routing<br/>[api.php]"]
  node_backend_auth["Auth controller<br/>auth flow<br/>[AuthController.php]"]
  node_backend_user["User model<br/>identity model<br/>[User.php]"]
  node_backend_role["Role model<br/>authorization model<br/>[Role.php]"]
  node_backend_sanctum["Sanctum<br/>token auth<br/>[sanctum.php]"]
  node_backend_db["Migrations<br/>schema source"]
  node_backend_queue[("Queue/cache<br/>platform infra<br/>[queue.php]")]
  node_backend_boot["Bootstrap<br/>[app.php]"]
end

subgraph group_frontend["Angular Web"]
  node_frontend_app["Angular app<br/>web client<br/>[app.ts]"]
  node_frontend_routes["Routes<br/>ui routing<br/>[app.routes.ts]"]
  node_frontend_config["App config<br/>ui config<br/>[app.config.ts]"]
  node_frontend_api["API service<br/>api client<br/>[api.ts]"]
  node_frontend_env["Environments<br/>runtime settings<br/>[environment.ts]"]
  node_frontend_ssr["SSR entry<br/>server render<br/>[server.ts]"]
end

subgraph group_data["Persistence"]
  node_persistence_pg[("PostgreSQL<br/>database")]
end

node_backend_app -->|"boots with"| node_backend_boot
node_backend_app -->|"serves"| node_backend_routes
node_backend_routes -->|"maps to"| node_backend_auth
node_backend_auth -->|"issues tokens"| node_backend_sanctum
node_backend_auth -->|"reads/writes"| node_backend_user
node_backend_auth -->|"checks roles"| node_backend_role
node_backend_user -->|"persisted by"| node_backend_db
node_backend_role -->|"persisted by"| node_backend_db
node_backend_sanctum -->|"stores tokens"| node_backend_db
node_backend_db -->|"applies to"| node_persistence_pg
node_backend_app -.->|"uses infra"| node_backend_queue
node_frontend_app -->|"navigates by"| node_frontend_routes
node_frontend_app -->|"configured by"| node_frontend_config
node_frontend_app -->|"calls"| node_frontend_api
node_frontend_api -->|"reads settings"| node_frontend_env
node_frontend_ssr -->|"renders"| node_frontend_app
node_frontend_api -->|"HTTP requests"| node_backend_routes
node_frontend_ssr -.->|"server-side requests"| node_backend_routes

click node_backend_app "https://github.com/mywhitecow/codeforge/tree/main/backend/api-lumina"
click node_backend_routes "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/routes/api.php"
click node_backend_auth "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Http/Controllers/AuthController.php"
click node_backend_user "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Models/User.php"
click node_backend_role "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Models/Role.php"
click node_backend_sanctum "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/config/sanctum.php"
click node_backend_db "https://github.com/mywhitecow/codeforge/tree/main/backend/api-lumina/database/migrations"
click node_backend_queue "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/config/queue.php"
click node_backend_boot "https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/bootstrap/app.php"
click node_frontend_app "https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.ts"
click node_frontend_routes "https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.routes.ts"
click node_frontend_config "https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.config.ts"
click node_frontend_api "https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/services/api.ts"
click node_frontend_env "https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/environments/environment.ts"
click node_frontend_ssr "https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/server.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_backend_app,node_backend_routes,node_backend_auth,node_backend_user,node_backend_role,node_backend_sanctum,node_backend_db,node_backend_queue,node_backend_boot toneAmber
class node_frontend_app,node_frontend_routes,node_frontend_config,node_frontend_api,node_frontend_env,node_frontend_ssr toneMint
class node_persistence_pg toneRose
```

## Components

### Laravel API

PHP backend providing authentication and REST endpoints.

- [Laravel app](https://github.com/mywhitecow/codeforge/tree/main/backend/api-lumina): api server · Laravel runtime and application bootstrap for the backend. · `backend/api-lumina`
- [API routes](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/routes/api.php): http routing · Defines backend HTTP entry points and request dispatch. · `backend/api-lumina/routes/api.php`
- [Auth controller](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Http/Controllers/AuthController.php): auth flow · Custom controller for login/register/logout or token issuance. · `backend/api-lumina/app/Http/Controllers/AuthController.php`
- [User model](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Models/User.php): identity model · Primary authenticated principal in the backend. · `backend/api-lumina/app/Models/User.php`
- [Role model](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/app/Models/Role.php): authorization model · Represents role-based access control in the backend. · `backend/api-lumina/app/Models/Role.php`
- [Sanctum](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/config/sanctum.php): token auth · Token-based API authentication configuration and personal access tokens. · `backend/api-lumina/config/sanctum.php`
- [Migrations](https://github.com/mywhitecow/codeforge/tree/main/backend/api-lumina/database/migrations): schema source · Database schema definitions and local data scaffolding. · `backend/api-lumina/database/migrations`
- [Queue/cache](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/config/queue.php): platform infra · Prepared support for background jobs, caching, and sessions. · `backend/api-lumina/config/queue.php`
- [Bootstrap](https://github.com/mywhitecow/codeforge/blob/main/backend/api-lumina/bootstrap/app.php): runtime bootstrap · Laravel bootstrap, service providers, and environment wiring. · `backend/api-lumina/bootstrap/app.php`

### Angular Web

User-facing Angular app with SSR support.

- [Angular app](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.ts): web client · Angular application shell and route-driven UI. · `frontend/web-lumina/src/app/app.ts`
- [Routes](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.routes.ts): ui routing · Client-side route configuration for the Angular app. · `frontend/web-lumina/src/app/app.routes.ts`
- [App config](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/app.config.ts): ui config · Shared application configuration for browser and server runtime. · `frontend/web-lumina/src/app/app.config.ts`
- [API service](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/app/services/api.ts): api client · Centralized frontend service for calling the Laravel API. · `frontend/web-lumina/src/app/services/api.ts`
- [Environments](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/environments/environment.ts): runtime settings · Environment-specific API base URLs and client settings. · `frontend/web-lumina/src/environments/environment.ts`
- [SSR entry](https://github.com/mywhitecow/codeforge/blob/main/frontend/web-lumina/src/server.ts): server render · Node-side entrypoints for server-side rendering or hybrid serving. · `frontend/web-lumina/src/server.ts`

### Persistence

Database and schema-related assets.

- **PostgreSQL**: database · Primary relational datastore for application state.

## Connections

- Laravel app → Bootstrap: boots with · Laravel application starts through framework bootstrap and providers.
- Laravel app → API routes: serves · HTTP requests are dispatched through route definitions.
- API routes → Auth controller: maps to · Authentication endpoints are handled by the custom controller.
- Auth controller → Sanctum: issues tokens · Authentication flow uses Sanctum personal access tokens.
- Auth controller → User model: reads/writes · Auth operations center on the User principal.
- Auth controller → Role model: checks roles · Authorization is expected to incorporate roles.
- User model → Migrations: persisted by · User schema is defined through migrations.
- Role model → Migrations: persisted by · Role schema is defined through migrations.
- Sanctum → Migrations: stores tokens · Personal access tokens are stored in the database.
- Migrations → PostgreSQL: applies to · Migrations materialize schema in PostgreSQL.
- Laravel app → Queue/cache: uses infra · Backend is prepared for cache, sessions, and queued work.
- Angular app → Routes: navigates by · UI is organized around client-side routes.
- Angular app → App config: configured by · Shared app configuration is provided to the Angular runtime.
- Angular app → API service: calls · User actions and data loading flow through the API service.
- API service → Environments: reads settings · API base URL and environment values come from environment files.
- SSR entry → Angular app: renders · SSR entrypoints serve the Angular application on the server side.
- API service → API routes: HTTP requests · Frontend consumes the Laravel API over the network boundary.
- SSR entry → API routes: server-side requests · SSR/hybrid runtime can also fetch backend data server-side.
