# kevinguzman420/delagracia-app-cra architecture

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

- Interactive diagram: https://gitdiagram.com/kevinguzman420/delagracia-app-cra
- Repository: https://github.com/kevinguzman420/delagracia-app-cra

## Overview

1. **Overall shape**
   This repository is a two-part system: a **React frontend** in `src/` and a **Python API backend** in `api/`. The frontend is a single-page app, while the backend is organized as a domain-based service with separate modules for authentication, admin, and each department.

2. **Frontend boundary**
   The browser app is centered around `src/App.js`, `src/pages/`, and `src/components/`. Pages handle route-level screens, components handle reusable UI, and `ProtectedRoute.jsx`/department-specific protection components gate access to authenticated or role-specific areas.

3. **Frontend domain layout**
   The UI is split by business area: `admin`, `departments`, `new believer` flows, and `personal account`. Under `src/components/departments/`, each department has its own container, director views, member views, and shared/common subcomponents. This is a strong clue that each department has independent workflows but shares a common app shell.

4. **Frontend state and data flow**
   `src/context/Departments/` contains a context/reducer/state trio, so department data is managed centrally rather than passed deeply through props. The typical flow is: page loads → context or component fetches API data → forms/modals update state → UI refreshes lists and detail panels.

5. **Modal-driven interactions**
   A large portion of user actions happen through modal dialogs in `src/components/modal-content/` and the generic `Modal.jsx`. These modals are used for operations like adding members, assigning tutors/CDPs, creating discipleships/networks, and showing details. That means many workflows are list-first with inline object creation/editing.

6. **Backend structure**
   The API in `api/app/` is split into packages by domain: `auth`, `admin`, `departments`, `networks`, `school`, `new_convert`, and `various`. Each domain package includes `api_v1_0/resources.py` and often `schemas.py` and `models.py`, indicating a layered design of HTTP resources, serialization/validation, and persistence models.

7. **Backend core infrastructure**
   Shared backend infrastructure lives in `db.py`, `ext.py`, `models.py`, and `schemas.py`. `config/` contains environment-specific settings (`default`, `dev`, `prod`), and `entrypoint.py` is the runtime entry for launching the API. This suggests the backend is intended to be deployed as a configurable service rather than embedded in the frontend.

8. **Business-domain boundaries**
   The department packages reflect distinct operational domains: affirmation, education, evangelism, give grace, intercession, liberation, networks, visits, school, and new convert handling. Each one has its own resources and models, so the architecture is not a generic CRUD app; it is a multi-domain workflow system with department-specific data and permissions.

9. **Email/notification subsystem**
   `api/app/common/mail.py` plus the HTML templates in `api/app/templates/` show a notification pipeline. Templates cover events like student addition, assignments, attendance, retreat attendance, translation, unsubscribe, and workflow completion. This means the backend does more than store data: it also triggers outbound communication based on domain events.

10. **Frontend/backend contract**
    The frontend’s department views and admin screens align closely with backend resource modules, suggesting a REST-style API contract keyed by domain. The UI focuses on operational tasks—listing people, assigning responsibilities, tracking attendance, creating activities—while the API owns persistence, validation, and notification side effects.

11. **Tooling and runtime**
    The frontend uses the standard React build/test setup (`package.json`, `public/`, `src/setupTests.js`) and styling includes CSS plus `tailwind.config.js`. The backend is a Python application with explicit dependency management in `api/requirements.txt`. The repo therefore combines a modern SPA frontend with a structured Python service backend.

12. **What to capture in an architecture diagram**
    A good diagram would show: browser users → React SPA → authenticated API calls → domain-based Python resources → database/models → email templates/notification delivery. Around that core, draw separate bounded domains for admin, auth, and each department, with shared infrastructure underneath and modal-driven user actions on the frontend side.

Main entry points: [`api/app`](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app) (Core Infra), [`src/App.js`](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/App.js) (App Shell), [`api/app/common/mail.py`](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/api/app/common/mail.py) (Mail Service), [`src/pages`](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/pages) (Pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend SPA"]
  node_browser(("Users<br/>actors"))
  node_app_shell["App Shell<br/>react root<br/>[App.js]"]
  node_route_pages["Pages<br/>route screens"]
  node_ui_components["UI Components<br/>shared ui"]
  node_dept_context[("Department State<br/>context/reducer")]
  node_access_guard{{"Access Guards<br/>route protection<br/>[ProtectedRoute.jsx]"}}
  node_dept_shells["Dept Containers<br/>domain shells"]
  node_dept_workflows["Dept Views<br/>role views"]
  node_modal_flows["Modal Actions<br/>dialogs"]
  node_admin_pages["Admin Screens<br/>admin UI<br/>[Admin.jsx]"]
end

subgraph group_backend["API Service"]
  node_api_entry["API Entry<br/>wsgi entry<br/>[entrypoint.py]"]
  node_api_config["Config<br/>settings"]
  node_api_core[("Core Infra<br/>shared infra")]
  node_auth_domain{{"Auth<br/>domain API"}}
  node_admin_domain{{"Admin<br/>domain API"}}
  node_dept_domain{{"Departments API<br/>domain API"}}
  node_network_domain{{"Networks API<br/>domain API"}}
  node_new_convert_domain{{"New Convert API<br/>domain API"}}
  node_school_domain{{"School API<br/>domain API"}}
  node_various_domain{{"Various API<br/>domain API"}}
end

subgraph group_notifications["Notifications"]
  node_mail_pipeline["Mail Service<br/>notification pipeline<br/>[mail.py]"]
  node_mail_templates["Mail Templates<br/>html templates"]
end

node_browser -->|"opens app"| node_app_shell
node_app_shell -->|"routes to"| node_route_pages
node_app_shell -->|"composes"| node_ui_components
node_route_pages -->|"protected by"| node_access_guard
node_route_pages -->|"mounts"| node_dept_shells
node_dept_shells -->|"hosts"| node_dept_workflows
node_dept_workflows -->|"reads/writes"| node_dept_context
node_dept_workflows -->|"opens"| node_modal_flows
node_admin_pages -->|"opens"| node_modal_flows
node_ui_components -->|"includes"| node_modal_flows
node_app_shell -->|"calls API"| node_api_entry
node_api_entry -->|"loads"| node_api_config
node_api_entry -->|"initializes"| node_api_core
node_api_core -->|"supports"| node_auth_domain
node_api_core -->|"supports"| node_admin_domain
node_api_core -->|"supports"| node_dept_domain
node_api_core -->|"supports"| node_network_domain
node_api_core -->|"supports"| node_new_convert_domain
node_api_core -->|"supports"| node_school_domain
node_api_core -->|"supports"| node_various_domain
node_dept_domain -->|"triggers"| node_mail_pipeline
node_network_domain -->|"triggers"| node_mail_pipeline
node_new_convert_domain -->|"triggers"| node_mail_pipeline
node_mail_pipeline -->|"renders"| node_mail_templates
node_auth_domain -.->|"secures"| node_app_shell

click node_app_shell "https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/App.js"
click node_route_pages "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/pages"
click node_ui_components "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components"
click node_dept_context "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/context/Departments"
click node_access_guard "https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/components/ProtectedRoute.jsx"
click node_dept_shells "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components/departments"
click node_dept_workflows "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components/departments/afirmation"
click node_modal_flows "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components/modal-content"
click node_admin_pages "https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/pages/Admin.jsx"
click node_api_entry "https://github.com/kevinguzman420/delagracia-app-cra/blob/master/api/entrypoint.py"
click node_api_config "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/config"
click node_api_core "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app"
click node_auth_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/auth"
click node_admin_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/admin"
click node_dept_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/departments"
click node_network_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/networks"
click node_new_convert_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/new_convert"
click node_school_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/school"
click node_various_domain "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/various"
click node_mail_pipeline "https://github.com/kevinguzman420/delagracia-app-cra/blob/master/api/app/common/mail.py"
click node_mail_templates "https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/templates"

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_app_shell,node_route_pages,node_ui_components,node_dept_context,node_access_guard,node_dept_shells,node_dept_workflows,node_modal_flows,node_admin_pages toneBlue
class node_api_entry,node_api_config,node_api_core,node_auth_domain,node_admin_domain,node_dept_domain,node_network_domain,node_new_convert_domain,node_school_domain,node_various_domain toneAmber
class node_mail_pipeline,node_mail_templates toneMint
```

## Components

### Frontend SPA

React browser app for authenticated and role-specific workflows.

- **Users**: actors · People using the web app for admin and department workflows.
- [App Shell](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/App.js): react root · Top-level SPA composition and routing entry. · `src/App.js`
- [Pages](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/pages): route screens · Route-level screens for home, admin, departments, new believer, and personal account. · `src/pages`
- [UI Components](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components): shared ui · Reusable layout, modal, and admin/department UI building blocks. · `src/components`
- [Department State](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/context/Departments): context/reducer · Centralized department state, actions, and data flow. · `src/context/Departments`
- [Access Guards](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/components/ProtectedRoute.jsx): route protection · Authenticated and department-specific route gating. · `src/components/ProtectedRoute.jsx`
- [Dept Containers](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components/departments): domain shells · Department-level containers that anchor each workflow area. · `src/components/departments`
- [Dept Views](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components/departments/afirmation): role views · Director and member views for department operations. · `src/components/departments/afirmation`
- [Modal Actions](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/src/components/modal-content): dialogs · Add, assign, inspect, and update flows driven by modal dialogs. · `src/components/modal-content`
- [Admin Screens](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/src/pages/Admin.jsx): admin UI · Admin management screens for users, departments, and activities. · `src/pages/Admin.jsx`

### API Service

Python service with domain resources, models, and shared infrastructure.

- [API Entry](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/api/entrypoint.py): wsgi entry · Runtime entrypoint for starting the backend service. · `api/entrypoint.py`
- [Config](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/config): settings · Environment-specific backend configuration for default, dev, and prod. · `api/config`
- [Core Infra](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app): shared infra · Database, extensions, and shared base models/schemas. · `api/app`
- [Auth](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/auth): domain API · Authentication resources and API layer. · `api/app/auth`
- [Admin](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/admin): domain API · Administrative resources for platform management. · `api/app/admin`
- [Departments API](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/departments): domain API · Department resources and schemas for core operational data. · `api/app/departments`
- [Networks API](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/networks): domain API · Networks and discipleship resources and models. · `api/app/networks`
- [New Convert API](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/new_convert): domain API · New convert handling and related resources. · `api/app/new_convert`
- [School API](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/school): domain API · School-related resources and models. · `api/app/school`
- [Various API](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/various): domain API · Miscellaneous supporting resources and models. · `api/app/various`

### Notifications

Outbound mail templates and delivery helpers.

- [Mail Service](https://github.com/kevinguzman420/delagracia-app-cra/blob/master/api/app/common/mail.py): notification pipeline · Email helper and template-based notification delivery. · `api/app/common/mail.py`
- [Mail Templates](https://github.com/kevinguzman420/delagracia-app-cra/tree/master/api/app/templates): html templates · Domain-event email templates for assignments, attendance, retreats, and workflow completion. · `api/app/templates`

## Connections

- Users → App Shell: opens app · Users interact with the React SPA.
- App Shell → Pages: routes to · The SPA renders page-level screens.
- App Shell → UI Components: composes · Pages and layouts are built from shared UI components.
- Pages → Access Guards: protected by · Route screens are gated by auth and role checks.
- Pages → Dept Containers: mounts · Department pages load the relevant container.
- Dept Containers → Dept Views: hosts · Containers expose director and member workflows.
- Dept Views → Department State: reads/writes · Department views use centralized state for data loading and updates.
- Dept Views → Modal Actions: opens · Many actions are performed through modal dialogs.
- Admin Screens → Modal Actions: opens · Admin screens use modals for user and department operations.
- UI Components → Modal Actions: includes · Generic modal and domain-specific modal content live in shared components.
- App Shell → API Entry: calls API · Frontend submits authenticated requests to the backend service.
- API Entry → Config: loads · Runtime configuration selects environment-specific settings.
- API Entry → Core Infra: initializes · Service startup wires shared infrastructure.
- Core Infra → Auth: supports · Authentication uses shared models, schemas, and persistence.
- Core Infra → Admin: supports · Admin resources depend on shared infrastructure.
- Core Infra → Departments API: supports · Department resources depend on shared infrastructure.
- Core Infra → Networks API: supports · Networks resources depend on shared infrastructure.
- Core Infra → New Convert API: supports · New convert resources depend on shared infrastructure.
- Core Infra → School API: supports · School resources depend on shared infrastructure.
- Core Infra → Various API: supports · Miscellaneous resources depend on shared infrastructure.
- Departments API → Mail Service: triggers · Department events can generate outbound emails.
- Networks API → Mail Service: triggers · Network and discipleship events can generate notifications.
- New Convert API → Mail Service: triggers · New convert events can generate notifications.
- Mail Service → Mail Templates: renders · Notification content is assembled from HTML templates.
- Auth → App Shell: secures · Authentication underpins protected frontend access.
