# nikhitasathish1/campusledger architecture

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

- Interactive diagram: https://gitdiagram.com/nikhitasathish1/campusledger
- Repository: https://github.com/nikhitasathish1/campusledger

## Overview

##### Project type and purpose
- CampusLedger is a full-stack, Dockerized web application built with Django.
- Purpose: allow faculty to manage student records and track book borrow/return with standard CRUD operations and user authentication.

##### File structure
- Top-level artifacts:
- docker-compose.yml & dockerfile — define and coordinate containers
- manage.py & requirements.txt — Django management and Python dependencies
- mydb.py — (likely helper script for DB setup or connection)
- dcrm/ — the Django “project” module (settings.py, asgi.py, wsgi.py, urls.py)
- website/ — single Django “app” that implements the core features:
- models.py — data schema (Student, Book, Record)
- views.py & forms.py — request handlers and forms
- templates/ — HTML views (add/update, list pages, base layout)
- migrations/ — database schema evolution
- admin.py — Django admin integration
- .dockerignore, .gitignore, .vscode/ — tooling and IDE config

##### README for additional insights
- Tech stack: Django (Python) backend, Bootstrap/HTML/CSS frontend, MySQL database in Docker, Django’s built-in auth.
- Workflow: Docker Compose spins up web and db containers, run migrations, create superuser, then serve on localhost.

a. Main components
- Client (Web Browser)
- Docker Compose (orchestrator)
- Web container (Django app)
- dcrm module (URL router, settings, ASGI/Wsgi entry)
- website app (models, views, forms, templates)
- Django Auth subsystem
- Database container (MySQL)
b. Relationships and interactions
- Browser → HTTP(S) → Django server (port 8000)
- Django URL dispatcher (dcrm/urls.py) → website.views
- Views use Django ORM → SQL queries → MySQL
- Templates rendered → HTML/CSS/Bootstrap → Browser
- Docker Compose binds and links web ↔ db containers
c. Architectural patterns/design principles
- Three-tier architecture: Presentation ←→ Application ←→ Data
- MVC (Django’s model-view-template)
- Containerization: each service lives in its own Docker container
- Separation of concerns: project module vs. app module vs. migrations vs. templates
d. Key technologies/frameworks
- Django (Python)
- MySQL (in Docker)
- Docker & Docker Compose
- HTML/CSS/Bootstrap
- Django’s built-in authentication

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Browser(["Web Browser"]):::client

    %% Docker Compose boundary
    subgraph "Docker Compose" 
        direction TB
        %% Web container
        subgraph "Web Container (Django App)" 
            direction TB
            DjangoMgmt["manage.py"]:::util
            Requirements["requirements.txt"]:::util
            Dockerfile["dockerfile"]:::util
            MyDBScript["mydb.py"]:::util
            subgraph "dcrm Project Module"
                direction TB
                Settings["settings.py"]:::backend
                ASGI["asgi.py"]:::backend
                WSGI["wsgi.py"]:::backend
                URLRouterProj["urls.py"]:::backend
            end
            subgraph "Website App"
                direction TB
                Models["models.py"]:::backend
                Admin["admin.py"]:::backend
                URLRouterApp["urls.py"]:::backend
                Views["views.py"]:::backend
                Forms["forms.py"]:::backend
                Migrations["migrations/"]:::backend
                Templates["templates/"]:::frontend
            end
            Auth["Django Auth Subsystem"]:::backend
        end

        %% Database container
        MySQLDB(["MySQL Database"]):::database
    end

    %% Connections
    Browser -->|"HTTP/HTML"| DjangoMgmt
    DjangoMgmt -->|"loads Config"| Settings
    DjangoMgmt --> Requirements
    DjangoMgmt --> Dockerfile
    DjangoMgmt --> MyDBScript

    Settings --> URLRouterProj
    URLRouterProj --> Views
    Views -->|"uses ORM"| Models
    Views --> Forms
    Views --> Templates
    Views --> Auth
    Models --> MySQLDB
    Auth --> MySQLDB

    %% Orchestration arrows
    DockerComposeStart([" "]):::invisible
    DockerComposeStart -.->|"orchestrates"| DjangoMgmt
    DockerComposeStart -.->|"orchestrates"| MySQLDB

    %% Click Events
    click Dockerfile "https://github.com/nikhitasathish1/campusledger/tree/main/dockerfile"
    click MyDBScript "https://github.com/nikhitasathish1/campusledger/blob/main/mydb.py"
    click DjangoMgmt "https://github.com/nikhitasathish1/campusledger/blob/main/manage.py"
    click Requirements "https://github.com/nikhitasathish1/campusledger/blob/main/requirements.txt"
    click Settings "https://github.com/nikhitasathish1/campusledger/blob/main/dcrm/settings.py"
    click ASGI "https://github.com/nikhitasathish1/campusledger/blob/main/dcrm/asgi.py"
    click WSGI "https://github.com/nikhitasathish1/campusledger/blob/main/dcrm/wsgi.py"
    click URLRouterProj "https://github.com/nikhitasathish1/campusledger/blob/main/dcrm/urls.py"
    click Models "https://github.com/nikhitasathish1/campusledger/blob/main/website/models.py"
    click Admin "https://github.com/nikhitasathish1/campusledger/blob/main/website/admin.py"
    click URLRouterApp "https://github.com/nikhitasathish1/campusledger/blob/main/website/urls.py"
    click Views "https://github.com/nikhitasathish1/campusledger/blob/main/website/views.py"
    click Forms "https://github.com/nikhitasathish1/campusledger/blob/main/website/forms.py"
    click Migrations "https://github.com/nikhitasathish1/campusledger/tree/main/website/migrations/"
    click Templates "https://github.com/nikhitasathish1/campusledger/tree/main/website/templates/"
    click .gitignore "https://github.com/nikhitasathish1/campusledger/blob/main/.gitignore"
    click .dockerignore "https://github.com/nikhitasathish1/campusledger/blob/main/.dockerignore"
    click VSCodeRoot "https://github.com/nikhitasathish1/campusledger/tree/main/.vscode/"
    click VSCodeDcrm "https://github.com/nikhitasathish1/campusledger/tree/main/dcrm/.vscode/"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef frontend fill:#FADBD8,stroke:#000,stroke-width:1px;
    classDef backend fill:#F9E79F,stroke:#000,stroke-width:1px;
    classDef database fill:#ABEBC6,stroke:#000,stroke-width:1px;
    classDef util fill:#D5DBDB,stroke:#000,stroke-width:1px;
    classDef invisible stroke:none,fill:none;
    classDef compose stroke:#95A5A6,stroke-width:2px,fill:none;
    class DockerComposeStart invisible
```
