# saaspegasus/django-boilerplate architecture

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

- Interactive diagram: https://gitdiagram.com/saaspegasus/django-boilerplate
- Repository: https://github.com/saaspegasus/django-boilerplate

## Overview

SaaS Pegasus is a Django SaaS starter: a visitor reaches the Django web application, uses its authentication and account features, and can receive web/API responses; background work is handled by Celery. The README also documents a generated OpenAPI client, PostgreSQL, Redis, and the HTMX/Alpine and Tailwind/DaisyUI front end. Sampled code confirms user form/model/helper responsibilities and the Celery task setup. Other product branches are included from README capabilities; their implementation paths were not sampled.

Main entry points: [`project/urls.py`](https://github.com/saaspegasus/django-boilerplate/blob/main/project/urls.py) (Django web app), [`apps/users/forms.py`](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/forms.py) (Signup forms), [`project/settings.py`](https://github.com/saaspegasus/django-boilerplate/blob/main/project/settings.py) (REST API), [`project/celery.py`](https://github.com/saaspegasus/django-boilerplate/blob/main/project/celery.py) (Celery worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_django["Django web app<br/>[urls.py]"]
  node_web_views["Web views<br/>[views.py]"]
  node_web_meta["Page metadata<br/>[meta.py]"]
  node_frontend["HTMX and styling"]
end

subgraph group_identity["Identity and users"]
  node_auth["Allauth authentication<br/>[settings.py]"]
  node_signup["Signup forms<br/>[forms.py]"]
  node_user_model[("User accounts<br/>[models.py]")]
  node_user_helpers["User validation<br/>[helpers.py]"]
  node_user_signals["Account signals<br/>[signals.py]"]
end

subgraph group_api["API client"]
  node_rest_api["REST API<br/>[settings.py]"]
  node_client["Generated API client<br/>[runtime.ts]"]
end

subgraph group_runtime["Application runtime"]
  node_postgres[("PostgreSQL")]
  node_celery["Celery worker<br/>[celery.py]"]
  node_scheduled_tasks["Scheduled tasks<br/>[tasks.py]"]
  node_redis["Redis broker"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests pages"| node_django
node_django -->|"routes requests"| node_web_views
node_web_views -.->|"returns pages"| node_visitor
node_django -.->|"serves interface"| node_frontend
node_django -->|"provides sign-in"| node_auth
node_auth -->|"uses signup form"| node_signup
node_signup -->|"validates avatar"| node_user_helpers
node_signup -->|"uses account model"| node_user_model
node_user_model -.->|"persists accounts"| node_postgres
node_django -->|"builds page metadata"| node_web_meta
node_visitor -->|"calls API"| node_rest_api
node_client -.->|"sends HTTP requests"| node_rest_api
node_rest_api -.->|"returns API data"| node_visitor
node_celery -->|"discovers tasks"| node_scheduled_tasks
node_scheduled_tasks -.->|"clears expired sessions"| node_postgres
node_celery -->|"uses broker"| node_redis

click node_django "https://github.com/saaspegasus/django-boilerplate/blob/main/project/urls.py"
click node_web_views "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/web/views.py"
click node_web_meta "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/web/meta.py"
click node_auth "https://github.com/saaspegasus/django-boilerplate/blob/main/project/settings.py"
click node_signup "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/forms.py"
click node_user_model "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/models.py"
click node_user_helpers "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/helpers.py"
click node_user_signals "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/signals.py"
click node_rest_api "https://github.com/saaspegasus/django-boilerplate/blob/main/project/settings.py"
click node_client "https://github.com/saaspegasus/django-boilerplate/blob/main/api-client/runtime.ts"
click node_celery "https://github.com/saaspegasus/django-boilerplate/blob/main/project/celery.py"
click node_scheduled_tasks "https://github.com/saaspegasus/django-boilerplate/blob/main/apps/web/tasks.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_django,node_web_views,node_web_meta,node_frontend toneBlue
class node_auth,node_signup,node_user_model,node_user_helpers,node_user_signals toneAmber
class node_rest_api,node_client toneMint
class node_postgres,node_celery,node_scheduled_tasks,node_redis toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Django web app](https://github.com/saaspegasus/django-boilerplate/blob/main/project/urls.py): `project/urls.py`
- [Web views](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/web/views.py): `apps/web/views.py`
- [Page metadata](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/web/meta.py): `apps/web/meta.py`
- **HTMX and styling**

### Identity and users

- [Allauth authentication](https://github.com/saaspegasus/django-boilerplate/blob/main/project/settings.py): `project/settings.py`
- [Signup forms](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/forms.py): `apps/users/forms.py`
- [User accounts](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/models.py): `apps/users/models.py`
- [User validation](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/helpers.py): `apps/users/helpers.py`
- [Account signals](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/users/signals.py): `apps/users/signals.py`

### API client

- [REST API](https://github.com/saaspegasus/django-boilerplate/blob/main/project/settings.py): `project/settings.py`
- [Generated API client](https://github.com/saaspegasus/django-boilerplate/blob/main/api-client/runtime.ts): `api-client/runtime.ts`

### Application runtime

- **PostgreSQL**
- [Celery worker](https://github.com/saaspegasus/django-boilerplate/blob/main/project/celery.py): `project/celery.py`
- [Scheduled tasks](https://github.com/saaspegasus/django-boilerplate/blob/main/apps/web/tasks.py): `apps/web/tasks.py`
- **Redis broker**

### Other components

- **Visitor**

## Connections

- Visitor → Django web app: requests pages (evidence: `README.md`)
- Django web app → Web views: routes requests
- Web views → Visitor: returns pages
- Django web app → HTMX and styling: serves interface (evidence: `README.md`)
- Django web app → Allauth authentication: provides sign-in (evidence: `README.md`)
- Allauth authentication → Signup forms: uses signup form (evidence: `project/settings.py`)
- Signup forms → User validation: validates avatar (evidence: `apps/users/forms.py`)
- Signup forms → User accounts: uses account model (evidence: `apps/users/forms.py`)
- User accounts → PostgreSQL: persists accounts (evidence: `README.md`)
- Django web app → Page metadata: builds page metadata
- Visitor → REST API: calls API (evidence: `README.md`)
- Generated API client → REST API: sends HTTP requests (evidence: `README.md`)
- REST API → Visitor: returns API data
- Celery worker → Scheduled tasks: discovers tasks (evidence: `project/celery.py`)
- Scheduled tasks → PostgreSQL: clears expired sessions (evidence: `README.md`)
- Celery worker → Redis broker: uses broker
