# londheshubham153/django-notes-app architecture

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

- Interactive diagram: https://gitdiagram.com/londheshubham153/django-notes-app
- Repository: https://github.com/londheshubham153/django-notes-app

## Overview

##### Project Type and Purpose
- Full-stack web application
- Frontend: React SPA (“mynotes” directory)
- Backend: Django REST API (“api” app within “notesapp” project)
- Data store: SQLite (db.sqlite3)
- Deployed via Docker, reverse-proxied by Nginx

##### File Structure
- Top-level:
– Dockerfile, docker-compose.yml, Jenkinsfile, Procfile
– manage.py, requirements.txt (Python), mynotes/package.json (Node)
– nginx/Dockerfile + default.conf (reverse proxy)
- “notesapp/” – Django project (settings, URLs, WSGI/ASGI)
- “api/” – Django app: models.py, serializers.py, views.py, urls.py, migrations
- “mynotes/” – React app:
– “src/” holds components, pages, assets
– “build/” holds production artifacts (HTML/CSS/JS)
- “staticfiles/” – Collected Django static assets (including React build and DRF docs)
- “db.sqlite3” – Local relational database

##### README for Context
- Describes building a Docker image and running it on port 8000
- Advises installing Nginx reverse proxy on the host
- The app is intended as a simple note-taking service

##### Main Components and Interactions
a. Frontend (React SPA)
– Served as static files (index.html, .js, .css)
– Hosted behind Nginx (or Django static handler)
– Runs in the user’s browser
b. Reverse Proxy (Nginx)
– Accepts HTTP requests on port 80/443
– Routes “/api/” calls to Django container on port 8000
– Serves static assets directly (React build, Django admin CSS/JS)
c. Backend (Django REST Framework)
– Exposes REST endpoints under /api/
– Implements CRUD for Note model
– Uses Django ORM over SQLite
d. Database (SQLite)
– File-based local DB (db.sqlite3)
e. CI/CD (Jenkins)
– Builds Docker images, runs tests, pushes to registry
f. Container Orchestration (Docker Compose)
– Defines “web” (Django), “nginx” services
– Mounts volumes for code and static files

##### Architectural Patterns and Design Principles
- Separation of Concerns:
– UI (React) vs. API (Django DRF) vs. Data (SQLite)
- Layered Architecture:
– Presentation (Browser + React)
– API/Business (Django views, serializers, models)
– Data Access (ORM → SQLite)
- Reverse Proxy Pattern:
– Nginx handles TLS, caching, static content, load balancing
- Containerization:
– Each component runs in its own Docker container

##### Final Checklist for the Engineer
– Add callouts for important config: docker-compose.yml, nginx/default.conf, settings.py

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers and Components
    Browser["User's Browser\n(React SPA)"]:::frontend
    ReactBuild["React Build\n(mynotes/build)"]:::frontend
    StaticFiles["Static Files\n(staticfiles/)"]:::infra
    subgraph "Docker Compose Environment"
        direction TB
        Nginx["Nginx Reverse Proxy"]:::infra
        Django["Django REST API"]:::backend
    end
    SQLite["SQLite Database\n(db.sqlite3)"]:::data
    Jenkins["Jenkins CI Pipeline"]:::ci

    %% Data Flows
    Browser -->|HTTP GET /, /static| Nginx
    Browser -->|XHR /api/*| Nginx
    Nginx -->|proxy_pass /api| Django
    Nginx -->|serves files| ReactBuild
    Nginx -->|serves files| StaticFiles
    Django -->|ORM queries| SQLite
    Jenkins -->|build & test| DockerCompose_Env["Docker Compose Environment"]

    %% Click Events
    click Browser "https://github.com/londheshubham153/django-notes-app/blob/main/mynotes/src/index.js"
    click ReactBuild "https://github.com/londheshubham153/django-notes-app/tree/main/mynotes/build/"
    click StaticFiles "https://github.com/londheshubham153/django-notes-app/tree/main/staticfiles/"
    click Nginx "https://github.com/londheshubham153/django-notes-app/blob/main/nginx/default.conf"
    click Django "https://github.com/londheshubham153/django-notes-app/blob/main/notesapp/settings.py"
    click SQLite "https://github.com/londheshubham153/django-notes-app/blob/main/db.sqlite3"
    click Jenkins "https://github.com/londheshubham153/django-notes-app/tree/main/Jenkinsfile"
    click DockerCompose_Env "https://github.com/londheshubham153/django-notes-app/blob/main/docker-compose.yml"

    %% Styling
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6,stroke-width:2px
    classDef backend  fill:#E8D0FF,stroke:#6f42c1,color:#6f42c1,stroke-width:2px
    classDef infra    fill:#D0FFD8,stroke:#28a745,color:#28a745,stroke-width:2px
    classDef data     fill:#FFF5D0,stroke:#D28806,color:#D28806,stroke-width:2px
    classDef ci       fill:#FFE0D0,stroke:#d73a49,color:#d73a49,stroke-width:2px
```
