# gabrielal-najjar/noesis architecture

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

- Interactive diagram: https://gitdiagram.com/gabrielal-najjar/noesis
- Repository: https://github.com/gabrielal-najjar/noesis

## Overview

#### Purpose and topology
This is a quiz application with an Angular single-page client, a Node.js backend API, file-backed persistence, Docker deployment, and a separate static prototype (“maquette”). Users can select/configure profiles, create quizzes and questions, play quiz attempts, and view statistics.

#### Runtime entry points
- Angular bootstraps from `front-end/src/main.ts`; module and route composition are in `front-end/src/app/app.module.ts` and `front-end/src/app/app-routing.module.ts`.
- The backend starts its HTTP server through `backend/app/index.js`, with server construction separated in `backend/app/build-server.js`.
- Containers are composed for normal and end-to-end execution through `ops/docker-compose.yml` and `ops/docker-compose-e2e.yml`; the frontend is served by Nginx (`front-end/nginx.conf`).

#### Client application shell and navigation
The Angular application is organized around routed page components and a shared root shell. Major user journeys cover homepage/navigation, quiz browsing/creation/play, profile setup/selection, and statistics.
- Root and routes: `front-end/src/app/app.component.ts`, `front-end/src/app/app-routing.module.ts`
- Quiz play page: `front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts`
- User/profile and stats pages: `front-end/src/app/components/user/user-profile-selection-page/user-profile-selection-page.component.ts`, `front-end/src/app/components/user/user-stats-page/user-stats-page.component.ts`

#### Quiz authoring and play flow
Quiz authoring is a nested component workflow: quiz creation/configuration contains question configuration, then question/answer editing. Play renders questions and answers, supports hints/reminders, and finishes on an end page.
- Creation and editing: `front-end/src/app/components/quiz/quizCreation/quizCreationPage.component.ts`, `front-end/src/app/components/quiz/quizConfigurator/quizCreationConfigurator.component.ts`, `front-end/src/app/components/quiz/questionConfigurator/questionConfigurator.component.ts`
- Play and result UI: `front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts`, `front-end/src/app/components/quiz/quiz-page-end/quiz-page-end.component.ts`
- Client-side orchestration is split between API-facing and logic services: `front-end/src/app/services/quiz-service.service.ts`, `front-end/src/app/services/quiz-creation.service.ts`, `front-end/src/app/services/quiz-logic.service.ts`.

#### Backend API boundary
The backend exposes resource-oriented API modules for users, quizzes, nested questions/answers, and quiz attempts. Each resource has route registration plus a manager layer, which isolates HTTP handling from domain/persistence operations.
- API aggregation: `backend/app/api/index.js`
- Quiz resource stack: `backend/app/api/quizzes/index.js`, `backend/app/api/quizzes/manager.js`
- Nested content and attempts: `backend/app/api/quizzes/questions/manager.js`, `backend/app/api/quizzes/questions/answers/manager.js`, `backend/app/api/quizAttempt/manager.js`
- User endpoints: `backend/app/api/users/index.js`, `backend/app/api/users/manager.js`

#### Domain models and persistence
Backend models define the persistent entities: quizzes, questions, answers, residents/users, configuration, and statistics. A shared base model likely centralizes data access semantics and validation/error boundaries. Persistence is JSON data files under `backend/database`, rather than an external database.
- Model assembly and core entities: `backend/app/models/index.js`, `backend/app/models/quiz-model.js`, `backend/app/models/stats-model.js`
- Shared model/error boundary: `backend/app/utils/base-model.js`, `backend/app/utils/errors/validation-error.js`
- Persistent datasets: `backend/database/quiz.data.json`, `backend/database/question.data.json`, `backend/database/stats.data.json`

#### Stats and attempt data flow
During quiz completion, the client’s quiz logic and API service submit/retrieve attempt data through the attempt endpoint. Backend attempt handling updates or reads stats-domain records; the frontend maps those into profile-statistics views, charts, history, and detail components.
- Client stats services: `front-end/src/app/services/user-stats.service.ts`, `front-end/src/app/services/user-stats-service.service.ts`
- Stats presentation: `front-end/src/app/components/user/user-stats-layout-container/user-stats-layout-container.component.ts`, `front-end/src/app/components/user/user-stats-charts/user-stats-charts.component.ts`
- Backend boundary/data: `backend/app/api/quizAttempt/index.js`, `backend/app/models/stats-model.js`

#### Infrastructure and prototype boundary
Dockerfiles exist for standard and Playwright-enabled frontend/backend images. Playwright end-to-end scenarios exercise the composed system. The `maquette` Python/static HTML-CSS tree is a design prototype and appears separate from the production Angular/API runtime.
- Images: `backend/Dockerfile`, `front-end/Dockerfile`, `backend/Dockerfile.playwright`
- System tests: `ops/run-e2e.sh`, `front-end/e2e/scenarios/create-quiz-scenario.spec.ts`
- Prototype: `maquette/matrio.py`, `maquette/src/pages/index.html`

Main entry points: [`front-end/src/app/app-routing.module.ts`](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/app-routing.module.ts) (App shell & routes), [`backend/app/api/quizzes/index.js`](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/quizzes/index.js) (Resource routes), [`front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts`](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts) (Quiz play & result), [`backend/app/models/index.js`](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/models/index.js) (Domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_angular_bootstrap(("Angular bootstrap<br/>client entry<br/>[main.ts]"))
  node_app_shell_routes["App shell &amp; routes<br/>Angular routing"]
  node_quiz_authoring["Quiz authoring<br/>component workflow"]
  node_quiz_play["Quiz play &amp; result<br/>page components"]
  node_profile_stats_ui["Profiles &amp; statistics<br/>page components"]
  node_quiz_client_services["Quiz client services<br/>API and game logic"]
  node_stats_client_services["Stats client services<br/>API mapping"]
end

subgraph group_backend["Node.js API"]
  node_server_entry(("HTTP server entry<br/>Node.js entry<br/>[index.js]"))
  node_server_builder["Server builder<br/>HTTP composition<br/>[build-server.js]"]
  node_api_aggregation["API router<br/>route aggregation<br/>[index.js]"]
  node_resource_routes["Resource routes<br/>HTTP endpoints<br/>[index.js]"]
  node_resource_managers["Domain managers<br/>application layer<br/>[manager.js]"]
  node_domain_models["Domain models<br/>model layer<br/>[index.js]"]
  node_model_base_errors["Model base &amp; validation<br/>data boundary<br/>[base-model.js]"]
  node_json_datasets[("JSON datasets<br/>file persistence<br/>[quiz.data.json]")]
end

subgraph group_delivery["Deployment &amp; testing"]
  node_nginx_frontend["Nginx frontend<br/>static web server<br/>[nginx.conf]"]
  node_docker_compose{{"Docker Compose<br/>runtime composition<br/>[docker-compose.yml]"}}
  node_e2e_scenarios["Playwright E2E<br/>system tests"]
end

subgraph group_prototype["Static prototype"]
  node_maquette["Maquette prototype<br/>Python/static prototype<br/>[matrio.py]"]
end

node_angular_bootstrap -->|"boots"| node_app_shell_routes
node_app_shell_routes -->|"routes to"| node_quiz_authoring
node_app_shell_routes -->|"routes to"| node_quiz_play
node_app_shell_routes -->|"routes to"| node_profile_stats_ui
node_quiz_authoring -->|"creates quizzes"| node_quiz_client_services
node_quiz_play -->|"plays attempts"| node_quiz_client_services
node_quiz_play -->|"submits completion"| node_stats_client_services
node_profile_stats_ui -->|"loads statistics"| node_stats_client_services
node_quiz_client_services -->|"quiz API"| node_resource_routes
node_stats_client_services -->|"attempt/stats API"| node_resource_routes
node_server_entry -->|"starts"| node_server_builder
node_server_builder -->|"mounts"| node_api_aggregation
node_api_aggregation -->|"registers"| node_resource_routes
node_resource_routes -->|"delegates"| node_resource_managers
node_resource_managers -->|"uses"| node_domain_models
node_domain_models -->|"extends boundary"| node_model_base_errors
node_domain_models -->|"reads and writes"| node_json_datasets
node_docker_compose -->|"runs"| node_nginx_frontend
node_docker_compose -->|"runs"| node_server_entry
node_nginx_frontend -->|"serves client"| node_angular_bootstrap
node_e2e_scenarios -.->|"tests composed system"| node_docker_compose

click node_angular_bootstrap "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/main.ts"
click node_app_shell_routes "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/app-routing.module.ts"
click node_quiz_authoring "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/quiz/quizCreation/quizCreationPage.component.ts"
click node_quiz_play "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts"
click node_profile_stats_ui "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/user/user-stats-layout-container/user-stats-layout-container.component.ts"
click node_server_entry "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/index.js"
click node_server_builder "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/build-server.js"
click node_api_aggregation "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/index.js"
click node_resource_routes "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/quizzes/index.js"
click node_resource_managers "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/quizzes/manager.js"
click node_domain_models "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/models/index.js"
click node_model_base_errors "https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/utils/base-model.js"
click node_json_datasets "https://github.com/gabrielal-najjar/noesis/blob/master/backend/database/quiz.data.json"
click node_nginx_frontend "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/nginx.conf"
click node_docker_compose "https://github.com/gabrielal-najjar/noesis/blob/master/ops/docker-compose.yml"
click node_e2e_scenarios "https://github.com/gabrielal-najjar/noesis/blob/master/front-end/e2e/scenarios/create-quiz-scenario.spec.ts"
click node_maquette "https://github.com/gabrielal-najjar/noesis/blob/master/maquette/matrio.py"

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_angular_bootstrap,node_app_shell_routes,node_quiz_authoring,node_quiz_play,node_profile_stats_ui,node_quiz_client_services,node_stats_client_services toneBlue
class node_server_entry,node_server_builder,node_api_aggregation,node_resource_routes,node_resource_managers,node_domain_models,node_model_base_errors,node_json_datasets toneAmber
class node_nginx_frontend,node_docker_compose,node_e2e_scenarios toneMint
class node_maquette toneRose
```

## Components

### Angular client

- [Angular bootstrap](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/main.ts): client entry · `front-end/src/main.ts`
- [App shell & routes](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/app-routing.module.ts): Angular routing · `front-end/src/app/app-routing.module.ts`
- [Quiz authoring](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/quiz/quizCreation/quizCreationPage.component.ts): component workflow · Nested quiz, question, and answer configuration UI. · `front-end/src/app/components/quiz/quizCreation/quizCreationPage.component.ts`
- [Quiz play & result](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts): page components · `front-end/src/app/components/quiz/quiz-page/quiz-page.component.ts`
- [Profiles & statistics](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/src/app/components/user/user-stats-layout-container/user-stats-layout-container.component.ts): page components · `front-end/src/app/components/user/user-stats-layout-container/user-stats-layout-container.component.ts`
- **Quiz client services**: API and game logic
- **Stats client services**: API mapping

### Node.js API

- [HTTP server entry](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/index.js): Node.js entry · `backend/app/index.js`
- [Server builder](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/build-server.js): HTTP composition · `backend/app/build-server.js`
- [API router](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/index.js): route aggregation · `backend/app/api/index.js`
- [Resource routes](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/quizzes/index.js): HTTP endpoints · Users, quizzes, nested content, and attempts. · `backend/app/api/quizzes/index.js`
- [Domain managers](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/api/quizzes/manager.js): application layer · Separates route handling from domain and persistence operations. · `backend/app/api/quizzes/manager.js`
- [Domain models](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/models/index.js): model layer · Quiz, user, configuration, and statistics entities. · `backend/app/models/index.js`
- [Model base & validation](https://github.com/gabrielal-najjar/noesis/blob/master/backend/app/utils/base-model.js): data boundary · `backend/app/utils/base-model.js`
- [JSON datasets](https://github.com/gabrielal-najjar/noesis/blob/master/backend/database/quiz.data.json): file persistence · File-backed quizzes, questions, and statistics. · `backend/database/quiz.data.json`

### Deployment & testing

- [Nginx frontend](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/nginx.conf): static web server · `front-end/nginx.conf`
- [Docker Compose](https://github.com/gabrielal-najjar/noesis/blob/master/ops/docker-compose.yml): runtime composition · Normal and end-to-end container topology. · `ops/docker-compose.yml`
- [Playwright E2E](https://github.com/gabrielal-najjar/noesis/blob/master/front-end/e2e/scenarios/create-quiz-scenario.spec.ts): system tests · Exercises composed quiz creation flows. · `front-end/e2e/scenarios/create-quiz-scenario.spec.ts`

### Static prototype

Separate from the production runtime.

- [Maquette prototype](https://github.com/gabrielal-najjar/noesis/blob/master/maquette/matrio.py): Python/static prototype · Independent design prototype. · `maquette/matrio.py`

## Connections

- Angular bootstrap → App shell & routes: boots
- App shell & routes → Quiz authoring: routes to
- App shell & routes → Quiz play & result: routes to
- App shell & routes → Profiles & statistics: routes to
- Quiz authoring → Quiz client services: creates quizzes
- Quiz play & result → Quiz client services: plays attempts
- Quiz play & result → Stats client services: submits completion
- Profiles & statistics → Stats client services: loads statistics
- Quiz client services → Resource routes: quiz API
- Stats client services → Resource routes: attempt/stats API
- HTTP server entry → Server builder: starts
- Server builder → API router: mounts
- API router → Resource routes: registers
- Resource routes → Domain managers: delegates
- Domain managers → Domain models: uses
- Domain models → Model base & validation: extends boundary
- Domain models → JSON datasets: reads and writes
- Docker Compose → Nginx frontend: runs
- Docker Compose → HTTP server entry: runs
- Nginx frontend → Angular bootstrap: serves client
- Playwright E2E → Docker Compose: tests composed system
