# nikdanilov/flask-react-todo-app architecture

> Architecture diagram of the GitHub repository nikdanilov/flask-react-todo-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nikdanilov/flask-react-todo-app
- Repository: https://github.com/nikdanilov/flask-react-todo-app

## Overview

##### Project type and purpose
- This is a full‑stack To‑Do web application.
- Front‑end: React & Redux SPA, bundled by Webpack, written in ES6+/SCSS.
- Back‑end: Python Flask REST API, JWT authentication, SQLAlchemy ORM, MySQL database.
- Database migration via Alembic.

##### File structure
- Top‑level:
- application/ – Flask app modules (app.py routes, models.py ORM models, utils/auth.py JWT helpers).
- migrations/ – Alembic config & versioned migration scripts.
- static/ – front‑end source: webpack configs, package.json, React/Redux code under src/, SCSS, images, test config.
- config.py – database connection string.
- manage.py – CLI for DB creation and running the server.
- tests/ & test.py – pytest tests for API endpoints and models.
- Patterns:
- Backend: MVC/Blueprint style, utility module for auth.
- Frontend: Redux folder structure: actions, reducers, components, containers, store config, utils.
- Build scripts: Webpack splits dev/prod configs, Babel, ESLint, SCSS loader.

##### README for additional insights
- Confirms separation: front‑end (npm/React) vs back‑end (pip/Flask).
- Technology stack: Flask + SQLAlchemy + MySQL, React/Redux + React‑Router, Material‑UI, Webpack.

##### Elements
- Clear labels: “React SPA”, “Flask REST API”, “MySQL DB”, “Alembic Migration Service”.
- From Browser → API (HTTP/JSON).
- From API → DB (SQL via SQLAlchemy).
- From CLI (manage.py) → DB (CREATE TABLE via ORM).
- Hexagon or gear for build tools (Webpack/Alembic).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        subgraph "UI Components"
            direction TB
            AuthComp["AuthenticatedComponent"]:::frontend
            Dash["Dashboard"]:::frontend
            DetermineAuth["DetermineAuth"]:::frontend
            Footer["Footer"]:::frontend
            Header["Header"]:::frontend
            Home["Home"]:::frontend
            LoginView["LoginView"]:::frontend
            RegisterView["RegisterView"]:::frontend
            NotFound["NotFound"]:::frontend
            ProtectedView["ProtectedView"]:::frontend
            NotAuthComp["NotAuthenticatedComponent"]:::frontend
        end
        subgraph "State Management"
            direction TB
            AuthActions["auth.js (Actions)"]:::frontend
            DataActions["data.js (Actions)"]:::frontend
            AuthReducers["auth.js (Reducers)"]:::frontend
            DataReducers["data.js (Reducers)"]:::frontend
            RootReducer["index.js (Reducers)"]:::frontend
            StoreConfig["configureStore.js"]:::frontend
        end
        subgraph "Routing & Utils"
            direction TB
            Routes["routes.js"]:::frontend
            HTTPUtils["http_functions.js"]:::frontend
            MobileUtils["isMobileAndTablet.js"]:::frontend
            MiscUtils["misc.js"]:::frontend
            Parallax["parallax.js"]:::frontend
        end
        GlobalStyles["style.scss"]:::frontend
        Images["images/"]:::frontend
        ThemeStyles["fonts/roboto.scss + styles"]:::frontend
        SPA["React SPA\n(index.html)"]:::frontend
    end

    %% Build & Deployment
    subgraph "Build & Deployment" 
        direction TB
        PackageJSON["package.json"]:::tool
        Babel[".babelrc"]:::tool
        ESLint[".eslintrc"]:::tool
        WebpackCommon["common.config.js"]:::tool
        WebpackDev["dev.config.js"]:::tool
        WebpackProd["prod.config.js"]:::tool
        DevServer["server.js"]:::tool
        BinServer["bin/server.js"]:::tool
        KarmaConf["karma.conf.js"]:::test
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        AppEntry["app.py (Routes)"]:::backend
        AuthUtil["auth.py (JWT Helpers)"]:::backend
        Models["models.py (ORM)"]:::backend
        Config["config.py"]:::backend
        CLI["manage.py"]:::backend
        AltEntry["index.py"]:::backend
    end

    %% Database & Migrations
    subgraph "Database & Migrations"
        direction TB
        MySQL["MySQL DB"]:::db
        AlembicEnv["env.py"]:::tool
        AlembicIni["alembic.ini"]:::tool
        ScriptTemplate["script.py.mako"]:::tool
        Migrations["versions/"]:::tool
    end

    %% Testing
    subgraph "Testing"
        direction TB
        PytestConfig["testing_config.py"]:::test
        APItests["test_api.py"]:::test
        ModelTests["test_models.py"]:::test
        SingleRunner["test.py"]:::test
    end

    %% Data Flows
    SPA -->|"loads" | DevServer
    DevServer -->|"serves bundle"| SPA
    SPA -->|"dispatches actions"| AuthActions
    SPA -->|"dispatches actions"| DataActions
    SPA -->|"navigates"| Routes
    AuthActions -->|"calls API"| AppEntry
    DataActions -->|"calls API"| AppEntry
    AppEntry -->|"uses"| AuthUtil
    AppEntry -->|"interacts with"| Models
    Models -->|"queries"| MySQL
    CLI -->|"manages DB"| MySQL
    AlembicEnv -->|"runs migrations"| Migrations
    AppEntry -->|"reads config"| Config

    %% Tests Flow
    APItests -->|"tests"| AppEntry
    ModelTests -->|"tests"| Models
    SingleRunner -->|"runs"| APItests
    SingleRunner -->|"runs"| ModelTests

    %% Click Events
    click AuthComp "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/AuthenticatedComponent.js"
    click Dash "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/Dashboard.js"
    click DetermineAuth "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/DetermineAuth.js"
    click Footer "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/Footer/index.js"
    click Header "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/Header/index.js"
    click Home "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/Home/index.js"
    click LoginView "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/LoginView.js"
    click RegisterView "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/RegisterView.js"
    click NotFound "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/NotFound.js"
    click ProtectedView "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/ProtectedView.js"
    click NotAuthComp "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/components/NotAuthenticatedComponent.js"
    click AuthActions "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/actions/auth.js"
    click DataActions "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/actions/data.js"
    click AuthReducers "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/reducers/auth.js"
    click DataReducers "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/reducers/data.js"
    click RootReducer "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/reducers/index.js"
    click StoreConfig "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/store/configureStore.js"
    click Routes "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/routes.js"
    click HTTPUtils "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/utils/http_functions.js"
    click MobileUtils "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/utils/isMobileAndTablet.js"
    click MiscUtils "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/utils/misc.js"
    click Parallax "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/utils/parallax.js"
    click GlobalStyles "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/style.scss"
    click Images "https://github.com/nikdanilov/flask-react-todo-app/tree/master/static/src/images/"
    click ThemeStyles "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/src/containers/App/styles/fonts/roboto.scss"
    click SPA "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/index.html"
    click PackageJSON "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/package.json"
    click Babel "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/.babelrc"
    click ESLint "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/.eslintrc"
    click WebpackCommon "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/webpack/common.config.js"
    click WebpackDev "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/webpack/dev.config.js"
    click WebpackProd "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/webpack/prod.config.js"
    click DevServer "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/server.js"
    click BinServer "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/bin/server.js"
    click KarmaConf "https://github.com/nikdanilov/flask-react-todo-app/blob/master/static/karma.conf.js"
    click AppEntry "https://github.com/nikdanilov/flask-react-todo-app/blob/master/application/app.py"
    click AuthUtil "https://github.com/nikdanilov/flask-react-todo-app/blob/master/application/utils/auth.py"
    click Models "https://github.com/nikdanilov/flask-react-todo-app/blob/master/application/models.py"
    click Config "https://github.com/nikdanilov/flask-react-todo-app/blob/master/config.py"
    click CLI "https://github.com/nikdanilov/flask-react-todo-app/blob/master/manage.py"
    click AltEntry "https://github.com/nikdanilov/flask-react-todo-app/blob/master/index.py"
    click MySQL "https://github.com/nikdanilov/flask-react-todo-app/blob/master/config.py"
    click AlembicEnv "https://github.com/nikdanilov/flask-react-todo-app/blob/master/migrations/env.py"
    click AlembicIni "https://github.com/nikdanilov/flask-react-todo-app/blob/master/migrations/alembic.ini"
    click ScriptTemplate "https://github.com/nikdanilov/flask-react-todo-app/blob/master/migrations/script.py.mako"
    click Migrations "https://github.com/nikdanilov/flask-react-todo-app/tree/master/migrations/versions/"
    click PytestConfig "https://github.com/nikdanilov/flask-react-todo-app/blob/master/testing_config.py"
    click APItests "https://github.com/nikdanilov/flask-react-todo-app/blob/master/tests/test_api.py"
    click ModelTests "https://github.com/nikdanilov/flask-react-todo-app/blob/master/tests/test_models.py"
    click SingleRunner "https://github.com/nikdanilov/flask-react-todo-app/blob/master/test.py"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1B4F72
    classDef backend fill:#D5F5E3,stroke:#145A32
    classDef db fill:#FADBD8,stroke:#7B241C
    classDef tool fill:#F9E79F,stroke:#7E5109
    classDef test fill:#E8DAEF,stroke:#6C3483
```
