# 4geeksacademy/jwt-auth-token-joseangel architecture

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

- Interactive diagram: https://gitdiagram.com/4geeksacademy/jwt-auth-token-joseangel
- Repository: https://github.com/4geeksacademy/jwt-auth-token-joseangel

## Overview

1. This repository is a full-stack boilerplate with two primary runtimes: a Python/Flask backend and a React frontend. The backend exposes an API; the frontend is a separate client app that consumes it.

2. The backend lives under `src/api` and is organized into small domain-oriented modules: `routes.py` for HTTP endpoints, `models.py` for SQLAlchemy database models, `admin.py` for admin-related behavior, `commands.py` for CLI tasks, and `utils.py` for shared helpers. `src/app.py` and `src/wsgi.py` act as the Flask application entry and WSGI deployment entrypoints.

3. Database access is abstracted through SQLAlchemy, with schema changes managed by Alembic under `migrations/`. The presence of `migrations/env.py` and version files indicates the backend is designed around explicit migration workflows rather than ad hoc table creation.

4. The backend also includes custom Flask CLI commands. The README specifically calls out commands for inserting test users and test data, which means the API layer is not only serving HTTP but also providing operational utilities for seeding and maintenance.

5. The frontend is in `src/front` and is a single-page application built with React. `main.jsx` bootstraps the client, `routes.jsx` defines page routing, and `store.js` plus `hooks/useGlobalReducer.jsx` provide shared state management for the app.

6. UI structure is split between reusable components and route-level pages. Components such as `Navbar`, `Footer`, `ScrollToTop`, and `BackendURL` are shared layout/utility pieces, while `Home`, `Login`, `Signup`, `Private`, `Demo`, and `Single` represent routed screens and feature entry points.

7. The client/server boundary is clear: React handles presentation and navigation in the browser, while Flask provides data and business logic through API endpoints. The `BackendURL` component suggests the frontend is configured to point to a backend base URL, likely driven by environment variables for local and deployed environments.

8. The app appears to support authentication and protected content. The existence of `Login`, `Signup`, and `Private` pages, combined with a global reducer/store, suggests frontend state is used to track session or user context while backend routes enforce the actual data/API access rules.

9. Build and deployment are explicitly separated from source. `vite.config.js` and the `dist/` directory indicate the frontend is bundled with Vite, while `public/bundle.js` and `public/index.html` show a prebuilt/static output path used for serving the compiled client in deployment scenarios.

10. Deployment targets are first-class in the repo. `Procfile`, `render.yaml`, `Dockerfile.render`, `render_build.sh`, and the container/devcontainer files show support for Render, Docker-based builds, and cloud IDEs like Codespaces/Gitpod.

11. Environment and dependency management are split by runtime. Python uses Pipenv (`Pipfile`, `Pipfile.lock`) and `requirements.txt`, while the frontend uses npm (`package.json`, `package-lock.json`). The `.env.example` file documents runtime configuration, especially database and backend settings.

12. Supporting assets and docs are included as part of the repo’s operational workflow. `docs/HELP.md`, `docs/CHANGE_LOG.md`, and scripts like `database.sh` and `docs/assets/reset_migrations.bash` indicate this template is intended to be easy to reset, migrate, and maintain across different developer environments.

Main entry points: [`src/app.py`](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/app.py) (App entry), [`src/api/models.py`](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/models.py) (Data models), [`src/front/routes.jsx`](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/routes.jsx) (Page routes), [`render.yaml`](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/render.yaml) (Render config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_app_entry["App entry<br/>Flask entrypoint<br/>[app.py]"]
  node_wsgi_entry["WSGI entry<br/>Deployment entrypoint<br/>[wsgi.py]"]
  node_api_routes["API routes<br/>HTTP endpoints<br/>[routes.py]"]
  node_api_models[("Data models<br/>SQLAlchemy models<br/>[models.py]")]
  node_api_commands["CLI commands<br/>Flask CLI<br/>[commands.py]"]
  node_api_admin["Admin logic<br/>Admin helpers<br/>[admin.py]"]
  node_api_utils["Shared utils<br/>Backend helpers<br/>[utils.py]"]
  node_migrations["Migrations<br/>Alembic schema"]
end

subgraph group_frontend["Frontend"]
  node_frontend_boot["Client boot<br/>React bootstrap<br/>[main.jsx]"]
  node_frontend_routes["Page routes<br/>SPA routing<br/>[routes.jsx]"]
  node_frontend_store["Global store<br/>State container<br/>[store.js]"]
  node_frontend_hook["Reducer hook<br/>React hook"]
  node_ui_shell["UI shell<br/>Shared components"]
  node_ui_pages["Screens<br/>Route pages"]
  node_backend_url["Backend URL<br/>API config<br/>[BackendURL.jsx]"]
end

subgraph group_ops["Deploy"]
  node_vite_build["Vite build<br/>Frontend bundler<br/>[vite.config.js]"]
  node_public_bundle["Static bundle<br/>Built frontend<br/>[bundle.js]"]
  node_render_cfg["Render config<br/>Deployment config<br/>[render.yaml]"]
  node_docker_render["Render Docker<br/>Container build<br/>[Dockerfile.render]"]
  node_procfile["Procfile<br/>Process config"]
  node_env_example["Env example<br/>Config template<br/>[.env.example]"]
end

node_app_entry -->|"registers"| node_api_routes
node_app_entry -->|"uses"| node_api_models
node_app_entry -->|"registers"| node_api_commands
node_app_entry -->|"includes"| node_api_admin
node_app_entry -->|"shares"| node_api_utils
node_wsgi_entry -->|"boots"| node_app_entry
node_api_routes -->|"queries"| node_api_models
node_api_routes -->|"uses"| node_api_utils
node_api_admin -->|"manages"| node_api_models
node_api_commands -->|"seeds"| node_api_models
node_api_commands -->|"uses"| node_api_utils
node_migrations -->|"tracks"| node_api_models
node_frontend_boot -->|"mounts"| node_frontend_routes
node_frontend_boot -->|"initializes"| node_frontend_store
node_frontend_routes -->|"navigates"| node_ui_pages
node_frontend_routes -->|"composes"| node_ui_shell
node_frontend_store -->|"exposes"| node_frontend_hook
node_ui_shell -->|"configures"| node_backend_url
node_frontend_routes -->|"depends on"| node_backend_url
node_vite_build -->|"bundles"| node_frontend_boot
node_vite_build -->|"outputs"| node_public_bundle
node_render_cfg -->|"uses"| node_docker_render
node_render_cfg -->|"starts"| node_procfile
node_render_cfg -->|"expects"| node_env_example
node_docker_render -->|"runs"| node_procfile

click node_app_entry "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/app.py"
click node_wsgi_entry "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/wsgi.py"
click node_api_routes "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/routes.py"
click node_api_models "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/models.py"
click node_api_commands "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/commands.py"
click node_api_admin "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/admin.py"
click node_api_utils "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/utils.py"
click node_migrations "https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/migrations"
click node_frontend_boot "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/main.jsx"
click node_frontend_routes "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/routes.jsx"
click node_frontend_store "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/store.js"
click node_frontend_hook "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/hooks/useGlobalReducer.jsx"
click node_ui_shell "https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/src/front/components"
click node_ui_pages "https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/src/front/pages"
click node_backend_url "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/components/BackendURL.jsx"
click node_vite_build "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/vite.config.js"
click node_public_bundle "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/public/bundle.js"
click node_render_cfg "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/render.yaml"
click node_docker_render "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/Dockerfile.render"
click node_procfile "https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/Procfile"
click node_env_example "https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/.env.example"

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_app_entry,node_wsgi_entry,node_api_routes,node_api_models,node_api_commands,node_api_admin,node_api_utils,node_migrations toneBlue
class node_frontend_boot,node_frontend_routes,node_frontend_store,node_frontend_hook,node_ui_shell,node_ui_pages,node_backend_url toneAmber
class node_vite_build,node_public_bundle,node_render_cfg,node_docker_render,node_procfile,node_env_example toneMint
```

## Components

### Backend

Flask API, ORM, and operational commands

- [App entry](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/app.py): Flask entrypoint · Creates and configures the Flask application · `src/app.py`
- [WSGI entry](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/wsgi.py): Deployment entrypoint · Process entry used by WSGI servers · `src/wsgi.py`
- [API routes](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/routes.py): HTTP endpoints · Defines the backend request handlers and API surface · `src/api/routes.py`
- [Data models](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/models.py): SQLAlchemy models · Database schema and ORM entities · `src/api/models.py`
- [CLI commands](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/commands.py): Flask CLI · Operational commands for seeding and maintenance · `src/api/commands.py`
- [Admin logic](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/admin.py): Admin helpers · Admin-related backend behavior · `src/api/admin.py`
- [Shared utils](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/api/utils.py): Backend helpers · Common backend utility functions · `src/api/utils.py`
- [Migrations](https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/migrations): Alembic schema · Explicit database migration workflow · `migrations`

### Frontend

React client app and UI composition

- [Client boot](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/main.jsx): React bootstrap · Starts the browser application · `src/front/main.jsx`
- [Page routes](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/routes.jsx): SPA routing · Defines client-side navigation and page composition · `src/front/routes.jsx`
- [Global store](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/store.js): State container · Shared app state and reducer wiring · `src/front/store.js`
- [Reducer hook](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/hooks/useGlobalReducer.jsx): React hook · Hook for global state access and updates · `src/front/hooks/useGlobalReducer.jsx`
- [UI shell](https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/src/front/components): Shared components · Reusable layout and utility components · `src/front/components`
- [Screens](https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/src/front/pages): Route pages · Route-level views for public, auth, and protected flows · `src/front/pages`
- [Backend URL](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/src/front/components/BackendURL.jsx): API config · Client-side backend base URL configuration · `src/front/components/BackendURL.jsx`

### Deploy

Build, container, and environment support

- [Vite build](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/vite.config.js): Frontend bundler · Bundles the React app for production · `vite.config.js`
- [Static bundle](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/public/bundle.js): Built frontend · Compiled client assets served from public · `public/bundle.js`
- [Render config](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/render.yaml): Deployment config · Cloud deployment and build settings · `render.yaml`
- [Render Docker](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/Dockerfile.render): Container build · Dockerfile used for Render builds · `Dockerfile.render`
- [Procfile](https://github.com/4geeksacademy/jwt-auth-token-joseangel/tree/main/Procfile): Process config · Defines runtime process launch for deployment · `Procfile`
- [Env example](https://github.com/4geeksacademy/jwt-auth-token-joseangel/blob/main/.env.example): Config template · Documents required runtime variables · `.env.example`

## Connections

- App entry → API routes: registers · Flask app mounts API endpoints
- App entry → Data models: uses · App initializes ORM-backed data layer
- App entry → CLI commands: registers · App exposes operational CLI commands
- App entry → Admin logic: includes · App wires admin behavior
- App entry → Shared utils: shares · App and API modules use common helpers
- WSGI entry → App entry: boots · WSGI imports the Flask app
- API routes → Data models: queries · Endpoints read and write database entities
- API routes → Shared utils: uses · Route handlers reuse backend helpers
- Admin logic → Data models: manages · Admin layer operates on persisted data
- CLI commands → Data models: seeds · CLI tasks create test users and data
- CLI commands → Shared utils: uses · Commands share helper logic
- Migrations → Data models: tracks · Alembic versions evolve the ORM schema
- Client boot → Page routes: mounts · Client bootstraps routing
- Client boot → Global store: initializes · App initializes global state
- Page routes → Screens: navigates · Routes map URLs to screens
- Page routes → UI shell: composes · Routes use shared layout components
- Global store → Reducer hook: exposes · Store is accessed through a global reducer hook
- UI shell → Backend URL: configures · Shared UI includes backend endpoint wiring
- Page routes → Backend URL: depends on · Pages and route flow need backend API location
- Vite build → Client boot: bundles · Vite compiles the React entrypoint
- Vite build → Static bundle: outputs · Build emits the browser bundle
- Render config → Render Docker: uses · Deployment config coordinates container build
- Render config → Procfile: starts · Deployment uses process launch settings
- Render config → Env example: expects · Deployment is driven by environment variables
- Render Docker → Procfile: runs · Container image launches the app process
