# prasadbhatane/employee-management-system---flask architecture

> Architecture diagram of the GitHub repository prasadbhatane/employee-management-system---flask, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prasadbhatane/employee-management-system---flask
- Repository: https://github.com/prasadbhatane/employee-management-system---flask

## Overview

##### Project type and purpose
- This is a full-stack web application called “Employee Management System” built in Python.
- It consists of two distinct Flask services:
- A RESTful API service (“api” folder) using Flask-RESTful and SQLAlchemy against a MySQL database
- A server-rendered frontend web app (“app” folder) using Flask templates and static assets

##### File structure
- Top level
- README.md – high-level overview and instructions
- api/
- api.py – Flask-RESTful application entry point
- resources.py – endpoint definitions (e.g. EmployeeResource)
- models.py – SQLAlchemy ORM class definitions
- db.py – database connection/session setup
- settings.py – configuration (DB URI, API settings)
- app/
- app.py – front-end Flask application entry point, defines view routes
- system.py – likely business-logic or API client wrapper
- templates/ – Jinja2 templates (home, login, register, admin, details, edit)
- static/style.css – UI styling

##### README for additional insights
- The system follows REST API protocols for CRUD operations on employee data.
- Front end and API must be run separately (two processes).

##### Main components
a. External Actors
- User’s web browser (employee or admin)
b. Frontend Service (“app”)
- Routes (login, register, view/edit details)
- Templates and Static assets
- system.py (business logic or HTTP client)
c. Backend API Service (“api”)
- Flask-RESTful app (api.py)
- Resource layer (resources.py)
- Data layer (models.py + db.py)
- Configuration (settings.py)
d. MySQL Database
- Stores employee records and credentials

##### Relationships and data flows
- User browser <—HTTP—> Frontend Flask app
- Frontend app (system.py or direct HTTP) <—HTTP—> Backend REST API
- Backend API <—SQLAlchemy calls—> MySQL DB

##### Architectural patterns and design principles
- Separation of concerns
- Presentation layer (app/templates)
- API/business logic layer (api/resources.py)
- Data access layer (api/models.py + db session)
- RESTful architecture for API
- MVC style in the frontend: Controllers (view functions in app.py), Models (remote API), Views (templates)

##### Key technologies and frameworks
- Python 3.x
- Flask (both services)
- Flask-RESTful (API routing & resources)
- SQLAlchemy (ORM)
- MySQL (relational database)
- Jinja2 templates, CSS

##### Detail without over-fragmentation
- Every logical component (configuration, resource layer, templates)
- Dependencies and data flows

User → Frontend Flask App → Backend REST API → MySQL Database,
along with all internal subcomponents and technologies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    direction TB

    Browser["User's Web Browser"]:::external

    subgraph "Frontend Service"
        direction TB
        FE_App["app.py"]:::frontend
        FE_System["system.py"]:::frontend
        Templates["templates/"]:::frontend
        Static["static/style.css"]:::frontend
    end

    subgraph "API Service"
        direction TB
        API_App["api.py"]:::backend
        Resources["resources.py"]:::backend
        Models["models.py"]:::backend
        DB_Setup["db.py"]:::backend
        Settings["settings.py"]:::backend
        Req["requirements.txt"]:::backend
    end

    DB[(MySQL Database)]:::database

    Browser -->|HTTP GET/POST| FE_App
    FE_App -->|invokes| FE_System
    FE_App -->|renders| Templates
    FE_App -->|serves| Static
    FE_System -->|HTTP CRUD Calls| API_App
    API_App -->|routes to| Resources
    Resources -->|uses ORM| Models
    Models -->|initiates session| DB_Setup
    DB_Setup -->|connects| DB
    Resources -->|reads config| Settings
    API_App -->|depends on| Req

    click FE_App "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/app/app.py"
    click FE_System "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/app/system.py"
    click Templates "https://github.com/prasadbhatane/employee-management-system---flask/tree/main/app/templates/"
    click Static "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/app/static/style.css"
    click API_App "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/api/api.py"
    click Resources "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/api/resources.py"
    click Models "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/api/models.py"
    click DB_Setup "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/api/db.py"
    click Settings "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/api/settings.py"
    click Req "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/api/requirements.txt"
    click README "https://github.com/prasadbhatane/employee-management-system---flask/blob/main/README.md"

    classDef frontend fill:#cce5ff,stroke:#004085,color:#000;
    classDef backend fill:#d4edda,stroke:#155724,color:#000;
    classDef database fill:#fff3cd,stroke:#856404,color:#000;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000;
```
