# moises-darlan/ebd-gestao architecture

> Architecture diagram of the GitHub repository moises-darlan/ebd-gestao, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moises-darlan/ebd-gestao
- Repository: https://github.com/moises-darlan/ebd-gestao

## Overview

1. This is a monolithic Django application with three domain apps: `ebd` for the school/class workflow, `reports` for analytics and history, and `core` for the administrative landing area. The entrypoint is `manage.py`, with project configuration in `config/`.

2. The system is server-rendered, not API-driven. Browser requests are routed through Django URL configs into views, which render HTML templates and process forms. Shared layout comes from `templates/base.html`, while each app keeps its own templates under its own namespace.

3. `ebd` is the main operational subsystem. It appears to handle teacher login, dashboard/home pages, class access via access code, student CRUD, attendance/chamada, and per-class dashboards. Its `forms.py` suggests business validation is enforced at the form layer before data reaches the database.

4. The data model is persisted in PostgreSQL via Django ORM migrations. The `ebd/migrations` history shows iterative schema changes around classes, access codes, attendance records, and student birth date validation. The README confirms PostgreSQL is the primary datastore.

5. `reports` is a read-only analytics layer over the same operational data. Its templates indicate attendance history, detailed call records, and class analysis views. This module likely aggregates attendance and scoring data to produce rankings and historical reports.

6. `core` is the admin-facing subsystem. The presence of `admin_dashboard.html` and a migration named `0001_create_superuser.py` suggests this app provides a privileged dashboard for staff-level users and may bootstrap an initial administrator account or admin access path.

7. Authorization is role-based and split into two main paths: teachers use the normal application flow after login, while administrators are gated by `is_staff`. Within the teacher flow, access to a specific class is further restricted by a turma access code.

8. The primary business flow is: login -> teacher dashboard -> select/access turma -> manage students -> record attendance and scoring -> generate reports. Attendance data and points entered during chamada feed both the class dashboard and the reports module, and also drive the admin summary metrics.

9. The frontend is classic Django templates plus static CSS. `static/css/base.css` and the template structure suggest a shared responsive UI rather than a client-side SPA. The README also references Chart.js, which is likely used only in the reporting/analysis pages for charts.

10. Deployment is conventional Django on Gunicorn, with WhiteNoise for static files. The project is configured to read `DATABASE_URL`, `SECRET_KEY`, and debug settings from the environment, which matches both local `.env` use and production deployment on Render.

11. The important architectural boundary is between presentation and persistence: views and forms handle all request logic, while models/migrations own the schema and state. There is no sign of separate services, queues, or asynchronous workers; everything runs inside one Django process against one database.

12. For an architecture diagram, the clearest high-level boxes are: browser/UI, Django routing and templates, the three app modules (`core`, `ebd`, `reports`), and PostgreSQL. Cross-cutting concerns are authentication/authorization, shared static assets, and chart/report rendering on the frontend.

Main entry points: [`config/settings.py`](https://github.com/moises-darlan/ebd-gestao/blob/main/config/settings.py) (Settings), [`config/urls.py`](https://github.com/moises-darlan/ebd-gestao/blob/main/config/urls.py) (Root URLs), [`ebd/models.py`](https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/models.py) (EBD models), [`ebd/views.py`](https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/views.py) (EBD views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Presentation"]
  node_browser(("Browser<br/>client"))
  node_base_template["Base layout<br/>django template<br/>[base.html]"]
  node_static_css["Base CSS<br/>static styles<br/>[base.css]"]
end

subgraph group_platform["Django platform"]
  node_manage_py["Entrypoint<br/>django launcher<br/>[manage.py]"]
  node_settings_py["Settings<br/>project config<br/>[settings.py]"]
  node_urls_py["Root URLs<br/>router<br/>[urls.py]"]
  node_wsgi_py["WSGI app<br/>deployment entry<br/>[wsgi.py]"]
  node_asgi_py["ASGI app<br/>deployment entry<br/>[asgi.py]"]
end

subgraph group_apps["Domain apps"]
  node_core_urls["Core URLs<br/>route module<br/>[urls.py]"]
  node_core_views["Admin views<br/>staff UI<br/>[views.py]"]
  node_core_template["Admin dashboard<br/>template"]
  node_ebd_urls["EBD URLs<br/>route module<br/>[urls.py]"]
  node_ebd_views["EBD views<br/>workflow UI<br/>[views.py]"]
  node_ebd_forms["EBD forms<br/>validation layer<br/>[forms.py]"]
  node_ebd_models["EBD models<br/>domain model<br/>[models.py]"]
  node_ebd_templates["EBD templates<br/>server views"]
  node_reports_urls["Reports URLs<br/>route module<br/>[urls.py]"]
  node_reports_views["Reports views<br/>analytics UI<br/>[views.py]"]
  node_reports_templates["Reports templates<br/>charts views"]
  node_reports_models["Reports models<br/>read layer<br/>[models.py]"]
end

subgraph group_data["Persistence"]
  node_ebd_migrations[("EBD migrations<br/>schema history")]
  node_core_migration[("Superuser migration<br/>bootstrap migration")]
  node_db[("PostgreSQL<br/>database")]
end

node_browser -->|"requests"| node_urls_py
node_manage_py -->|"loads"| node_settings_py
node_manage_py -->|"boots"| node_urls_py
node_urls_py -->|"includes"| node_core_urls
node_urls_py -->|"includes"| node_ebd_urls
node_urls_py -->|"includes"| node_reports_urls
node_core_urls -->|"routes to"| node_core_views
node_ebd_urls -->|"routes to"| node_ebd_views
node_reports_urls -->|"routes to"| node_reports_views
node_core_views -->|"renders"| node_core_template
node_ebd_views -->|"renders"| node_ebd_templates
node_reports_views -->|"renders"| node_reports_templates
node_ebd_views -->|"validates"| node_ebd_forms
node_ebd_views -->|"reads/writes"| node_ebd_models
node_reports_views -->|"reads"| node_ebd_models
node_ebd_forms -->|"binds"| node_ebd_models
node_ebd_models -->|"evolves via"| node_ebd_migrations
node_core_views -->|"queries"| node_db
node_ebd_models -->|"persists to"| node_db
node_reports_models -->|"reads from"| node_db
node_core_migration -->|"seeds"| node_db
node_ebd_templates -->|"extends"| node_base_template
node_reports_templates -->|"extends"| node_base_template
node_base_template -->|"uses"| node_static_css
node_settings_py -->|"configures"| node_db
node_settings_py -->|"serves"| node_static_css
node_settings_py -->|"exposes"| node_wsgi_py
node_settings_py -->|"exposes"| node_asgi_py

click node_base_template "https://github.com/moises-darlan/ebd-gestao/blob/main/templates/base.html"
click node_static_css "https://github.com/moises-darlan/ebd-gestao/blob/main/static/css/base.css"
click node_manage_py "https://github.com/moises-darlan/ebd-gestao/blob/main/manage.py"
click node_settings_py "https://github.com/moises-darlan/ebd-gestao/blob/main/config/settings.py"
click node_urls_py "https://github.com/moises-darlan/ebd-gestao/blob/main/config/urls.py"
click node_wsgi_py "https://github.com/moises-darlan/ebd-gestao/blob/main/config/wsgi.py"
click node_asgi_py "https://github.com/moises-darlan/ebd-gestao/blob/main/config/asgi.py"
click node_core_urls "https://github.com/moises-darlan/ebd-gestao/blob/main/core/urls.py"
click node_core_views "https://github.com/moises-darlan/ebd-gestao/blob/main/core/views.py"
click node_core_template "https://github.com/moises-darlan/ebd-gestao/blob/main/core/templates/core/admin_dashboard.html"
click node_ebd_urls "https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/urls.py"
click node_ebd_views "https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/views.py"
click node_ebd_forms "https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/forms.py"
click node_ebd_models "https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/models.py"
click node_ebd_templates "https://github.com/moises-darlan/ebd-gestao/tree/main/ebd/templates/ebd"
click node_reports_urls "https://github.com/moises-darlan/ebd-gestao/blob/main/reports/urls.py"
click node_reports_views "https://github.com/moises-darlan/ebd-gestao/blob/main/reports/views.py"
click node_reports_templates "https://github.com/moises-darlan/ebd-gestao/tree/main/reports/templates/reports"
click node_reports_models "https://github.com/moises-darlan/ebd-gestao/blob/main/reports/models.py"
click node_ebd_migrations "https://github.com/moises-darlan/ebd-gestao/tree/main/ebd/migrations"
click node_core_migration "https://github.com/moises-darlan/ebd-gestao/blob/main/core/migrations/0001_create_superuser.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_browser,node_base_template,node_static_css toneBlue
class node_manage_py,node_settings_py,node_urls_py,node_wsgi_py,node_asgi_py toneAmber
class node_core_urls,node_core_views,node_core_template,node_ebd_urls,node_ebd_views,node_ebd_forms,node_ebd_models,node_ebd_templates,node_reports_urls,node_reports_views,node_reports_templates,node_reports_models toneMint
class node_ebd_migrations,node_core_migration,node_db toneRose
```

## Components

### Presentation

Browser-facing templates and static assets

- **Browser**: client · Teachers and staff use the server-rendered UI
- [Base layout](https://github.com/moises-darlan/ebd-gestao/blob/main/templates/base.html): django template · Shared page shell for the whole site · `templates/base.html`
- [Base CSS](https://github.com/moises-darlan/ebd-gestao/blob/main/static/css/base.css): static styles · Shared styling for the rendered UI · `static/css/base.css`

### Django platform

Project entrypoint, settings, and routing

- [Entrypoint](https://github.com/moises-darlan/ebd-gestao/blob/main/manage.py): django launcher · Command-line entry into the Django project · `manage.py`
- [Settings](https://github.com/moises-darlan/ebd-gestao/blob/main/config/settings.py): project config · Environment-driven Django configuration · `config/settings.py`
- [Root URLs](https://github.com/moises-darlan/ebd-gestao/blob/main/config/urls.py): router · Top-level URL dispatcher for the site · `config/urls.py`
- [WSGI app](https://github.com/moises-darlan/ebd-gestao/blob/main/config/wsgi.py): deployment entry · Production application entrypoint · `config/wsgi.py`
- [ASGI app](https://github.com/moises-darlan/ebd-gestao/blob/main/config/asgi.py): deployment entry · Async-capable application entrypoint · `config/asgi.py`

### Domain apps

Operational, reporting, and admin subsystems

- [Core URLs](https://github.com/moises-darlan/ebd-gestao/blob/main/core/urls.py): route module · Admin-facing route definitions · `core/urls.py`
- [Admin views](https://github.com/moises-darlan/ebd-gestao/blob/main/core/views.py): staff UI · Privileged dashboard and admin-facing screens · `core/views.py`
- [Admin dashboard](https://github.com/moises-darlan/ebd-gestao/blob/main/core/templates/core/admin_dashboard.html): template · Staff landing page and summary view · `core/templates/core/admin_dashboard.html`
- [EBD URLs](https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/urls.py): route module · Teacher workflow route definitions · `ebd/urls.py`
- [EBD views](https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/views.py): workflow UI · Login, dashboard, class access, attendance, and student screens · `ebd/views.py`
- [EBD forms](https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/forms.py): validation layer · Business validation before persistence · `ebd/forms.py`
- [EBD models](https://github.com/moises-darlan/ebd-gestao/blob/main/ebd/models.py): domain model · Teachers, classes, students, attendance, and access code state · `ebd/models.py`
- [EBD templates](https://github.com/moises-darlan/ebd-gestao/tree/main/ebd/templates/ebd): server views · Teacher login, dashboard, turma access, student management, and chamada screens · `ebd/templates/ebd`
- [Reports URLs](https://github.com/moises-darlan/ebd-gestao/blob/main/reports/urls.py): route module · Analytics and history route definitions · `reports/urls.py`
- [Reports views](https://github.com/moises-darlan/ebd-gestao/blob/main/reports/views.py): analytics UI · Read-only attendance history and class analysis pages · `reports/views.py`
- [Reports templates](https://github.com/moises-darlan/ebd-gestao/tree/main/reports/templates/reports): charts views · History, details, and analysis screens, likely including charts · `reports/templates/reports`
- [Reports models](https://github.com/moises-darlan/ebd-gestao/blob/main/reports/models.py): read layer · Analytics layer over operational data · `reports/models.py`

### Persistence

Database and schema evolution

- [EBD migrations](https://github.com/moises-darlan/ebd-gestao/tree/main/ebd/migrations): schema history · Iterative schema changes for classes, attendance, and validation · `ebd/migrations`
- [Superuser migration](https://github.com/moises-darlan/ebd-gestao/blob/main/core/migrations/0001_create_superuser.py): bootstrap migration · Creates or seeds privileged admin access · `core/migrations/0001_create_superuser.py`
- **PostgreSQL**: database · Primary persistent datastore accessed through Django ORM

## Connections

- Browser → Root URLs: requests · Browser traffic enters the Django router
- Entrypoint → Settings: loads · Django starts with project settings
- Entrypoint → Root URLs: boots · Management command entry resolves the root URL config
- Root URLs → Core URLs: includes · Root routing dispatches to the admin app
- Root URLs → EBD URLs: includes · Root routing dispatches to the main workflow app
- Root URLs → Reports URLs: includes · Root routing dispatches to analytics routes
- Core URLs → Admin views: routes to · Admin routes resolve to staff views
- EBD URLs → EBD views: routes to · Teacher workflow routes resolve to operational views
- Reports URLs → Reports views: routes to · Reporting routes resolve to analytics views
- Admin views → Admin dashboard: renders · Admin views render the staff dashboard
- EBD views → EBD templates: renders · Operational views render the teacher-facing templates
- Reports views → Reports templates: renders · Analytics views render report pages and charts
- EBD views → EBD forms: validates · Forms enforce business rules before save
- EBD views → EBD models: reads/writes · Teacher workflow manipulates operational domain state
- Reports views → EBD models: reads · Reports aggregate the same operational records
- EBD forms → EBD models: binds · Validated form input maps onto domain entities
- EBD models → EBD migrations: evolves via · Schema changes are tracked in migration history
- Admin views → PostgreSQL: queries · Admin dashboard reads persisted state
- EBD models → PostgreSQL: persists to · ORM models store operational data in PostgreSQL
- Reports models → PostgreSQL: reads from · Reporting layer uses the same database
- Superuser migration → PostgreSQL: seeds · Bootstrap migration creates privileged admin access
- EBD templates → Base layout: extends · App templates share the common layout
- Reports templates → Base layout: extends · Report pages share the common layout
- Base layout → Base CSS: uses · Shared layout is styled by the global stylesheet
- Settings → PostgreSQL: configures · Environment settings point Django at PostgreSQL
- Settings → Base CSS: serves · Static asset configuration supports CSS delivery
- Settings → WSGI app: exposes · Production deployment uses WSGI
- Settings → ASGI app: exposes · Async-capable deployment path is available
