# tensai22/whispr_backend architecture

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

- Interactive diagram: https://gitdiagram.com/tensai22/whispr_backend
- Repository: https://github.com/tensai22/whispr_backend

## Overview

Whispr is a Django messaging and social-chat backend. The main user journey is account registration or login, then profile and user discovery, followed by real-time global chat over WebSockets; authenticated API endpoints also expose groups and communities. The chat consumer persists incoming messages and broadcasts them to connected clients through the configured channel layer. The graph includes the account, chat, and community data stages. Evidence is limited to the README and indexed excerpts; some URL and deployment wiring is therefore omitted or shown as unverified.

Main entry points: [`logic/views.py`](https://github.com/tensai22/whispr_backend/blob/master/logic/views.py) (Account API), [`chat/views.py`](https://github.com/tensai22/whispr_backend/blob/master/chat/views.py) (Chat and community API), [`chat/consumers.py`](https://github.com/tensai22/whispr_backend/blob/master/chat/consumers.py) (Chat consumer), [`Whispr_backend/settings.py`](https://github.com/tensai22/whispr_backend/blob/master/Whispr_backend/settings.py) (Django settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_chat_pages["Chat pages<br/>[index.html]"]
end

subgraph group_accounts["Accounts"]
  node_account_api["Account API<br/>[views.py]"]
  node_user_profiles[("User profiles<br/>[models.py]")]
  node_account_serializers["Profile serializer<br/>[serializers.py]"]
  node_profile_signals["Profile signals<br/>[signals.py]"]
  node_account_routes["Account routes<br/>[urls.py]"]
end

subgraph group_social["Chat and communities"]
  node_chat_api["Chat and community API<br/>[views.py]"]
  node_chat_serializers["Chat serializers<br/>[serializers.py]"]
  node_chat_models[("Chat data models<br/>[models.py]")]
  node_chat_routes["Chat routes<br/>[urls.py]"]
  node_ws_router["WebSocket routes<br/>[routing.py]"]
  node_chat_consumer["Chat consumer<br/>[consumers.py]"]
end

subgraph group_runtime["Runtime infrastructure"]
  node_asgi_router["ASGI router<br/>[routing.py]"]
  node_settings["Django settings<br/>[settings.py]"]
  node_db[("SQLite database<br/>[db.sqlite3]")]
  node_redis["Redis channel layer"]
end

node_person(("User"))

node_person -.->|"uses accounts"| node_account_api
node_account_routes -->|"routes to"| node_account_api
node_account_api -->|"reads and updates"| node_user_profiles
node_account_api -->|"serializes profiles"| node_account_serializers
node_profile_signals -->|"creates profile"| node_user_profiles
node_person -->|"opens chat"| node_chat_pages
node_chat_routes -->|"routes to"| node_chat_api
node_chat_api -->|"reads and writes"| node_chat_models
node_chat_api -->|"serializes data"| node_chat_serializers
node_ws_router -->|"dispatches to"| node_chat_consumer
node_asgi_router -->|"loads routes"| node_ws_router
node_chat_consumer -->|"persists messages"| node_chat_models
node_chat_consumer -->|"broadcasts events"| node_redis
node_settings -->|"configures layer"| node_redis
node_settings -->|"configures database"| node_db

click node_chat_pages "https://github.com/tensai22/whispr_backend/blob/master/chat/templates/chat/index.html"
click node_account_api "https://github.com/tensai22/whispr_backend/blob/master/logic/views.py"
click node_user_profiles "https://github.com/tensai22/whispr_backend/blob/master/logic/models.py"
click node_account_serializers "https://github.com/tensai22/whispr_backend/blob/master/logic/serializers.py"
click node_profile_signals "https://github.com/tensai22/whispr_backend/blob/master/logic/signals.py"
click node_account_routes "https://github.com/tensai22/whispr_backend/blob/master/logic/urls.py"
click node_chat_api "https://github.com/tensai22/whispr_backend/blob/master/chat/views.py"
click node_chat_serializers "https://github.com/tensai22/whispr_backend/blob/master/chat/serializers.py"
click node_chat_models "https://github.com/tensai22/whispr_backend/blob/master/chat/models.py"
click node_chat_routes "https://github.com/tensai22/whispr_backend/blob/master/chat/urls.py"
click node_ws_router "https://github.com/tensai22/whispr_backend/blob/master/chat/routing.py"
click node_chat_consumer "https://github.com/tensai22/whispr_backend/blob/master/chat/consumers.py"
click node_asgi_router "https://github.com/tensai22/whispr_backend/blob/master/Whispr_backend/routing.py"
click node_settings "https://github.com/tensai22/whispr_backend/blob/master/Whispr_backend/settings.py"
click node_db "https://github.com/tensai22/whispr_backend/blob/master/db.sqlite3"

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_chat_pages,node_person toneBlue
class node_account_api,node_user_profiles,node_account_serializers,node_profile_signals,node_account_routes toneAmber
class node_chat_api,node_chat_serializers,node_chat_models,node_chat_routes,node_ws_router,node_chat_consumer toneMint
class node_asgi_router,node_settings,node_db,node_redis toneRose
```

## Components

### User entry

- [Chat pages](https://github.com/tensai22/whispr_backend/blob/master/chat/templates/chat/index.html): `chat/templates/chat/index.html`

### Accounts

- [Account API](https://github.com/tensai22/whispr_backend/blob/master/logic/views.py): `logic/views.py`
- [User profiles](https://github.com/tensai22/whispr_backend/blob/master/logic/models.py): `logic/models.py`
- [Profile serializer](https://github.com/tensai22/whispr_backend/blob/master/logic/serializers.py): `logic/serializers.py`
- [Profile signals](https://github.com/tensai22/whispr_backend/blob/master/logic/signals.py): `logic/signals.py`
- [Account routes](https://github.com/tensai22/whispr_backend/blob/master/logic/urls.py): `logic/urls.py`

### Chat and communities

- [Chat and community API](https://github.com/tensai22/whispr_backend/blob/master/chat/views.py): `chat/views.py`
- [Chat serializers](https://github.com/tensai22/whispr_backend/blob/master/chat/serializers.py): `chat/serializers.py`
- [Chat data models](https://github.com/tensai22/whispr_backend/blob/master/chat/models.py): `chat/models.py`
- [Chat routes](https://github.com/tensai22/whispr_backend/blob/master/chat/urls.py): `chat/urls.py`
- [WebSocket routes](https://github.com/tensai22/whispr_backend/blob/master/chat/routing.py): `chat/routing.py`
- [Chat consumer](https://github.com/tensai22/whispr_backend/blob/master/chat/consumers.py): `chat/consumers.py`

### Runtime infrastructure

- [ASGI router](https://github.com/tensai22/whispr_backend/blob/master/Whispr_backend/routing.py): `Whispr_backend/routing.py`
- [Django settings](https://github.com/tensai22/whispr_backend/blob/master/Whispr_backend/settings.py): `Whispr_backend/settings.py`
- [SQLite database](https://github.com/tensai22/whispr_backend/blob/master/db.sqlite3): `db.sqlite3`
- **Redis channel layer**

### Other components

- **User**

## Connections

- User → Account API: uses accounts
- Account routes → Account API: routes to (evidence: `logic/urls.py`)
- Account API → User profiles: reads and updates (evidence: `logic/views.py`)
- Account API → Profile serializer: serializes profiles (evidence: `logic/views.py`)
- Profile signals → User profiles: creates profile (evidence: `logic/signals.py`)
- User → Chat pages: opens chat (evidence: `README.md`)
- Chat routes → Chat and community API: routes to (evidence: `chat/urls.py`)
- Chat and community API → Chat data models: reads and writes (evidence: `chat/views.py`)
- Chat and community API → Chat serializers: serializes data (evidence: `chat/views.py`)
- WebSocket routes → Chat consumer: dispatches to (evidence: `chat/routing.py`)
- ASGI router → WebSocket routes: loads routes (evidence: `Whispr_backend/routing.py`)
- Chat consumer → Chat data models: persists messages (evidence: `chat/consumers.py`)
- Chat consumer → Redis channel layer: broadcasts events (evidence: `README.md`)
- Django settings → Redis channel layer: configures layer (evidence: `Whispr_backend/settings.py`)
- Django settings → SQLite database: configures database (evidence: `Whispr_backend/settings.py`)
