# buechijonas/swissfy architecture

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

- Interactive diagram: https://gitdiagram.com/buechijonas/swissfy
- Repository: https://github.com/buechijonas/swissfy

## Overview

Swissfy is a social network with a Vue SPA and Django REST backend. Users authenticate through govex, then browse and publish posts, stories, reels and albums; interact through social connections, comments and encrypted chats; and receive notifications and achievements. Moderation and account administration provide distinct staff workflows. The README documents the backend app dependency direction and storage/authentication architecture; several implementation paths below are identified from the tree but were not sampled, so their internal call links are omitted.

Main entry points: [`backend/main/urls.py`](https://github.com/buechijonas/swissfy/blob/master/backend/main/urls.py) (Django REST API), [`backend/swissfy/posts/models/posts.py`](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/posts.py) (Posts and stories), [`frontend/swissfy/src/App.vue`](https://github.com/buechijonas/swissfy/blob/master/frontend/swissfy/src/App.vue) (Swissfy SPA), [`backend/swissfy/chats`](https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/chats) (Encrypted chats)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_spa["Swissfy SPA<br/>[App.vue]"]
  node_routing["Page routing<br/>[index.js]"]
  node_client_api["API clients"]
  node_client_state["Auth and events"]
end

subgraph group_social["Social features"]
  node_posts["Posts and stories<br/>[posts.py]"]
  node_feed["Feed and audience<br/>[feed.py]"]
  node_albums["Albums and saved<br/>[albums.py]"]
  node_social_graph["Social connections<br/>[models.py]"]
  node_chats["Encrypted chats"]
  node_notifications["Notifications"]
  node_achievements["Achievements"]
end

subgraph group_trust["Accounts and trust"]
  node_accounts["Accounts and OIDC"]
  node_roles["Role policy<br/>[roles.py]"]
  node_moderation["Reports and sanctions<br/>[models.py]"]
end

subgraph group_backend["Backend platform"]
  node_api["Django REST API<br/>[urls.py]"]
  node_events["Live events<br/>[events.py]"]
  node_encryption["Content encryption<br/>[encryption.py]"]
  node_storage_adapter["Encrypted media storage<br/>[storage.py]"]
  node_shared_models["Shared model layer<br/>[models.py]"]
  node_backfill["Encryption backfill<br/>[backfill.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("PostgreSQL")]
  node_media[("Media files")]
end

node_browser(("Browser user"))
node_govex["govex / authentik"]

node_browser -->|"uses"| node_spa
node_browser -->|"signs in"| node_govex
node_spa -->|"routes pages"| node_routing
node_spa -->|"initializes and watches"| node_client_state
node_client_state -->|"connects to"| node_events
node_client_api -->|"requests"| node_api
node_api -->|"routes auth"| node_accounts
node_api -->|"routes content"| node_posts
node_api -->|"routes connections"| node_social_graph
node_api -->|"routes chats"| node_chats
node_api -->|"routes notifications"| node_notifications
node_api -->|"routes moderation"| node_moderation
node_api -->|"reads and writes"| node_database
node_accounts -->|"exchanges identity"| node_govex
node_accounts -->|"assigns roles"| node_roles
node_moderation -->|"checks and changes"| node_roles
node_moderation -->|"reviews content"| node_posts
node_posts -.->|"supports feed"| node_feed
node_posts -.->|"supports albums"| node_albums
node_posts -.->|"uses relationships"| node_social_graph
node_chats -.->|"notifies"| node_notifications
node_posts -.->|"notifies activity"| node_notifications
node_achievements -.->|"persists progress"| node_database
node_events -->|"listens for events"| node_database
node_api -->|"publishes events"| node_events
node_api -->|"stores uploads"| node_storage_adapter
node_storage_adapter -->|"encrypts and decrypts"| node_encryption
node_storage_adapter -->|"reads and writes"| node_media
node_posts -.->|"encrypts content"| node_encryption
node_shared_models -.->|"provides encrypted fields"| node_encryption
node_backfill -.->|"migrates stored rows"| node_database
node_chats -->|"stores ciphertext"| node_database

click node_spa "https://github.com/buechijonas/swissfy/blob/master/frontend/swissfy/src/App.vue"
click node_routing "https://github.com/buechijonas/swissfy/blob/master/frontend/swissfy/src/router/index.js"
click node_client_api "https://github.com/buechijonas/swissfy/tree/master/frontend/swissfy/src/api"
click node_client_state "https://github.com/buechijonas/swissfy/tree/master/frontend/swissfy/src/stores"
click node_posts "https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/posts.py"
click node_feed "https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/feed.py"
click node_albums "https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/albums.py"
click node_social_graph "https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/social/models.py"
click node_chats "https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/chats"
click node_notifications "https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/notifications"
click node_achievements "https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/achievements"
click node_accounts "https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/accounts"
click node_roles "https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/accounts/roles.py"
click node_moderation "https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/moderation/models.py"
click node_api "https://github.com/buechijonas/swissfy/blob/master/backend/main/urls.py"
click node_events "https://github.com/buechijonas/swissfy/blob/master/backend/commons/events.py"
click node_encryption "https://github.com/buechijonas/swissfy/blob/master/backend/commons/encryption.py"
click node_storage_adapter "https://github.com/buechijonas/swissfy/blob/master/backend/commons/storage.py"
click node_shared_models "https://github.com/buechijonas/swissfy/blob/master/backend/commons/models.py"
click node_backfill "https://github.com/buechijonas/swissfy/blob/master/backend/commons/backfill.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_spa,node_routing,node_client_api,node_client_state,node_browser toneBlue
class node_posts,node_feed,node_albums,node_social_graph,node_chats,node_notifications,node_achievements toneAmber
class node_accounts,node_roles,node_moderation toneMint
class node_api,node_events,node_encryption,node_storage_adapter,node_shared_models,node_backfill toneRose
class node_database,node_media,node_govex toneIndigo
```

## Components

### Web client

- [Swissfy SPA](https://github.com/buechijonas/swissfy/blob/master/frontend/swissfy/src/App.vue): `frontend/swissfy/src/App.vue`
- [Page routing](https://github.com/buechijonas/swissfy/blob/master/frontend/swissfy/src/router/index.js): `frontend/swissfy/src/router/index.js`
- [API clients](https://github.com/buechijonas/swissfy/tree/master/frontend/swissfy/src/api): `frontend/swissfy/src/api`
- [Auth and events](https://github.com/buechijonas/swissfy/tree/master/frontend/swissfy/src/stores): `frontend/swissfy/src/stores`

### Social features

- [Posts and stories](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/posts.py): `backend/swissfy/posts/models/posts.py`
- [Feed and audience](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/feed.py): `backend/swissfy/posts/models/feed.py`
- [Albums and saved](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/posts/models/albums.py): `backend/swissfy/posts/models/albums.py`
- [Social connections](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/social/models.py): `backend/swissfy/social/models.py`
- [Encrypted chats](https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/chats): `backend/swissfy/chats`
- [Notifications](https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/notifications): `backend/swissfy/notifications`
- [Achievements](https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/achievements): `backend/swissfy/achievements`

### Accounts and trust

- [Accounts and OIDC](https://github.com/buechijonas/swissfy/tree/master/backend/swissfy/accounts): `backend/swissfy/accounts`
- [Role policy](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/accounts/roles.py): `backend/swissfy/accounts/roles.py`
- [Reports and sanctions](https://github.com/buechijonas/swissfy/blob/master/backend/swissfy/moderation/models.py): `backend/swissfy/moderation/models.py`

### Backend platform

- [Django REST API](https://github.com/buechijonas/swissfy/blob/master/backend/main/urls.py): `backend/main/urls.py`
- [Live events](https://github.com/buechijonas/swissfy/blob/master/backend/commons/events.py): `backend/commons/events.py`
- [Content encryption](https://github.com/buechijonas/swissfy/blob/master/backend/commons/encryption.py): `backend/commons/encryption.py`
- [Encrypted media storage](https://github.com/buechijonas/swissfy/blob/master/backend/commons/storage.py): `backend/commons/storage.py`
- [Shared model layer](https://github.com/buechijonas/swissfy/blob/master/backend/commons/models.py): `backend/commons/models.py`
- [Encryption backfill](https://github.com/buechijonas/swissfy/blob/master/backend/commons/backfill.py): `backend/commons/backfill.py`

### Persistence

- **PostgreSQL**
- **Media files**

### Other components

- **Browser user**
- **govex / authentik**

## Connections

- Browser user → Swissfy SPA: uses
- Browser user → govex / authentik: signs in
- Swissfy SPA → Page routing: routes pages (evidence: `frontend/swissfy/src/App.vue`)
- Swissfy SPA → Auth and events: initializes and watches (evidence: `frontend/swissfy/src/App.vue`)
- Auth and events → Live events: connects to
- API clients → Django REST API: requests
- Django REST API → Accounts and OIDC: routes auth
- Django REST API → Posts and stories: routes content
- Django REST API → Social connections: routes connections
- Django REST API → Encrypted chats: routes chats
- Django REST API → Notifications: routes notifications
- Django REST API → Reports and sanctions: routes moderation
- Django REST API → PostgreSQL: reads and writes
- Accounts and OIDC → govex / authentik: exchanges identity
- Accounts and OIDC → Role policy: assigns roles (evidence: `backend/swissfy/moderation/models.py`)
- Reports and sanctions → Role policy: checks and changes (evidence: `backend/swissfy/moderation/models.py`)
- Reports and sanctions → Posts and stories: reviews content
- Posts and stories → Feed and audience: supports feed
- Posts and stories → Albums and saved: supports albums
- Posts and stories → Social connections: uses relationships
- Encrypted chats → Notifications: notifies
- Posts and stories → Notifications: notifies activity
- Achievements → PostgreSQL: persists progress
- Live events → PostgreSQL: listens for events
- Django REST API → Live events: publishes events
- Django REST API → Encrypted media storage: stores uploads
- Encrypted media storage → Content encryption: encrypts and decrypts (evidence: `backend/commons/storage.py`)
- Encrypted media storage → Media files: reads and writes (evidence: `backend/commons/storage.py`)
- Posts and stories → Content encryption: encrypts content
- Shared model layer → Content encryption: provides encrypted fields
- Encryption backfill → PostgreSQL: migrates stored rows
- Encrypted chats → PostgreSQL: stores ciphertext
