# thomas-mckanna/django-rolla-mission architecture

> Architecture diagram of the GitHub repository thomas-mckanna/django-rolla-mission, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thomas-mckanna/django-rolla-mission
- Repository: https://github.com/thomas-mckanna/django-rolla-mission

## Overview

##### Project type and purpose
- This is a full‑stack Django web application with a REST API used by a companion Android app, plus a browser‑based admin/UI.
- Its purpose is to receive and store check‑in data (including images) from an Android client, manage that data via web pages (templates + Django Admin), and serve/report it back to clients.

##### File structure
Top‑level modules:
- rolla_mission/ – the Django project (settings, URLs, WSGI/ASGI, storage backends)
- patron_checkin/ – a Django app providing models, views, templates, static CSS, URLs, and migrations for check‑in features & admin UI
- api/ – a Django REST Framework app exposing serializers, viewsets, and URL endpoints for the Android client
- checkin_date_filter/ – a small app supplying custom filters and views used by patron_checkin
- conf/ – Apache HTTPD configuration for hosting (mod_wsgi + proxy setups)
- static/ and templates/ – compiled and third‑party static assets (Django Admin, DRF docs, base templates)
- requirements.txt – Python dependencies

##### README for additional insights
- Hosted on AWS Lightsail behind HTTPS
- Postgres as primary relational DB
- AWS S3 used for all image/media storage
- Android app communicates via DRF API
- Secrets and environment variables injected via a wrapper script

##### Main components & their relationships
a. Clients
- Android Application (external mobile client)
- Web Browser (Django Admin & custom HTML templates)
b. Web/API Layer
- Apache HTTPD (reverse proxy, SSL termination)
- uWSGI/mod_wsgi or Gunicorn serving the Django application
- Django project (“rolla_mission”) with three apps:
- api (REST endpoints)
- patron_checkin (UI views, models, admin)
- checkin_date_filter (utility filters)
c. Data Storage
- PostgreSQL Database (primary relational store)
- AWS S3 Bucket (media/images)
d. Infrastructure / External Services
- AWS Lightsail instance
- AWS S3 service
- (Optional) AWS RDS if Postgres is managed in production

##### Data flows & interactions
- Android App → HTTPS → Apache HTTPD → Django/api.views → serializers → ORM → PostgreSQL
- Django Views (patron_checkin) → ORM → PostgreSQL → render templates → Browser
- Django Media Uploads → boto3/S3 backend → AWS S3
- Browser or Android → fetch media URLs directly from S3 (or via signed URLs)

##### Architectural patterns & design principles
- Monolithic Django project segmented into reusable “apps” for domain separation
- MVC‑style (Django views/templates/models) augmented by RESTful resources (DRF serializers & viewsets)
- 12‑factor app principles: environment‑based configuration, external backing services (Postgres, S3)
- Separation of concerns: static/media vs. dynamic content, admin vs. API vs. public UI

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Clients"
        Android["Android App"]:::frontend
        Browser["Web Browser"]:::frontend
    end

    Android -->|HTTPS| Apache["Apache HTTPD"]:::infra
    Browser -->|HTTP/HTTPS| Apache

    subgraph "AWS Lightsail"
        Apache
        Wrapper["Env Wrapper Script"]:::infra
        AppLayer["Django Application"]:::app
        Entry["manage.py"]:::infra
        Req["requirements.txt"]:::infra
    end

    Apache -->|WSGI/Proxy| AppLayer
    Wrapper -->|injects env| AppLayer
    Entry -->|entrypoint| AppLayer
    Req -->|dependencies| AppLayer

    subgraph "Django Application"
        Core["rolla_mission (Core)"]:::app
        subgraph "API App"
            API["api (DRF)"]:::app
        end
        subgraph "Patron Check-In App"
            Patron["patron_checkin"]:::app
        end
        subgraph "Date Filter App"
            DateFilter["checkin_date_filter"]:::app
        end
        Core --> API
        Core --> Patron
        Core --> DateFilter
    end

    Android -->|REST API| API
    Browser -->|UI Views| Patron

    AppLayer -->|ORM| Postgres["PostgreSQL"]:::db
    AppLayer -->|boto3 S3 API| S3["AWS S3"]:::db
    AppLayer -->|serves| Static["Global Static Assets"]:::static
    AppLayer -->|renders| Templates["Global Templates"]:::template

    S3 -->|Media URLs| Browser

    classDef frontend fill:#B3D4FC,stroke:#4682B4;
    classDef app fill:#C8E6C9,stroke:#2E7D32;
    classDef db fill:#FFECB3,stroke:#F57C00;
    classDef infra fill:#E0E0E0,stroke:#616161;
    classDef static fill:#FFE0B2,stroke:#FB8C00;
    classDef template fill:#D1C4E9,stroke:#6A1B9A;

    click Core "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/rolla_mission/"
    click API "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/api/"
    click Patron "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/patron_checkin/"
    click DateFilter "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/checkin_date_filter/"
    click Apache "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/conf/"
    click Static "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/static/"
    click Templates "https://github.com/thomas-mckanna/django-rolla-mission/tree/master/templates/"
    click Entry "https://github.com/thomas-mckanna/django-rolla-mission/blob/master/manage.py"
    click Req "https://github.com/thomas-mckanna/django-rolla-mission/blob/master/requirements.txt"
```
