# frakhmann/scribbles-backend architecture

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

- Interactive diagram: https://gitdiagram.com/frakhmann/scribbles-backend
- Repository: https://github.com/frakhmann/scribbles-backend

## Overview

This is a FastAPI backend for a university-oriented social feed. Users register and authenticate, then create and browse posts, comment and like content, and manage profiles and follows; university and section endpoints provide feed context. The sampled code confirms post creation/deletion broadcasts to connected feed clients. Router files for several advertised-by-tree domains were not sampled, and there is no README, so their internal behavior and wiring are not inferred.

Main entry points: [`app/main.py`](https://github.com/frakhmann/scribbles-backend/blob/main/app/main.py) (FastAPI app), [`app/models/generated_models.py`](https://github.com/frakhmann/scribbles-backend/blob/main/app/models/generated_models.py) (ORM models), [`app/auth/routes.py`](https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/routes.py) (Auth routes), [`app/routers/profile.py`](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/profile.py) (Profiles and follows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entrypoints"]
  node_app["FastAPI app<br/>[main.py]"]
  node_feed_socket["Feed WebSocket<br/>[main.py]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth["Auth routes<br/>[routes.py]"]
  node_authdeps["Auth dependencies<br/>[dependencies.py]"]
  node_authutils["Auth utilities<br/>[utils.py]"]
  node_profile["Profiles and follows<br/>[profile.py]"]
  node_usercrud["User data access<br/>[user.py]"]
  node_user_schema["User schemas<br/>[user.py]"]
end

subgraph group_social["Social feed"]
  node_posts["Post routes<br/>[posts.py]"]
  node_postcrud["Post data access<br/>[post.py]"]
  node_comments["Comment routes<br/>[comments.py]"]
  node_commentcrud["Comment data access<br/>[comment.py]"]
  node_comment_schema["Comment schemas<br/>[comment.py]"]
  node_likes["Like routes<br/>[likes.py]"]
  node_likecrud["Like data access<br/>[like.py]"]
end

subgraph group_context["University context"]
  node_sections["Section routes<br/>[sections.py]"]
  node_universities["University routes<br/>[universities.py]"]
end

subgraph group_persistence["Persistence and realtime"]
  node_session["DB sessions<br/>[session.py]"]
  node_models["ORM models"]
  node_database[("Relational database")]
  node_ws["WebSocket manager<br/>[ws_manager.py]"]
  node_static[("Static media files")]
end

node_client(("API client"))
node_email["Email service"]

node_client -->|"HTTP requests"| node_app
node_app -->|"routes to"| node_auth
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_posts
node_app -->|"routes to"| node_comments
node_app -->|"routes to"| node_likes
node_app -->|"routes to"| node_sections
node_app -->|"routes to"| node_universities
node_app -->|"serves"| node_feed_socket
node_auth -->|"validates identity"| node_authdeps
node_auth -->|"verifies and issues"| node_authutils
node_auth -->|"looks up users"| node_usercrud
node_auth -->|"queries and updates"| node_models
node_auth -.->|"sends verification"| node_email
node_auth -->|"validates payloads"| node_user_schema
node_profile -->|"requires identity"| node_authdeps
node_profile -->|"queries and updates"| node_models
node_profile -->|"loads user posts"| node_postcrud
node_profile -->|"loads user comments"| node_commentcrud
node_profile -->|"loads liked items"| node_likecrud
node_profile -->|"saves avatar media"| node_static
node_posts -->|"requires identity"| node_authdeps
node_posts -->|"creates posts"| node_postcrud
node_posts -->|"queries and deletes"| node_models
node_posts -->|"saves post media"| node_static
node_posts -->|"broadcasts events"| node_ws
node_comments -->|"manages comments"| node_commentcrud
node_comments -->|"validates payloads"| node_comment_schema
node_comments -->|"requires identity"| node_authdeps
node_likes -->|"manages likes"| node_likecrud
node_likes -->|"requires identity"| node_authdeps
node_sections -->|"queries context"| node_models
node_universities -->|"queries context"| node_models
node_session -->|"opens sessions"| node_database
node_session -->|"provides ORM base"| node_models
node_feed_socket -->|"connects clients"| node_ws
node_ws -->|"broadcasts feed events"| node_client
node_postcrud -->|"persists posts"| node_models
node_commentcrud -->|"persists comments"| node_models
node_likecrud -->|"persists likes"| node_models
node_usercrud -->|"persists users"| node_models
node_static -->|"serves media"| node_client

click node_app "https://github.com/frakhmann/scribbles-backend/blob/main/app/main.py"
click node_auth "https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/routes.py"
click node_authdeps "https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/dependencies.py"
click node_authutils "https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/utils.py"
click node_profile "https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/profile.py"
click node_usercrud "https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/user.py"
click node_user_schema "https://github.com/frakhmann/scribbles-backend/blob/main/app/schemas/user.py"
click node_posts "https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/posts.py"
click node_postcrud "https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/post.py"
click node_comments "https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/comments.py"
click node_commentcrud "https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/comment.py"
click node_comment_schema "https://github.com/frakhmann/scribbles-backend/blob/main/app/schemas/comment.py"
click node_likes "https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/likes.py"
click node_likecrud "https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/like.py"
click node_sections "https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/sections.py"
click node_universities "https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/universities.py"
click node_session "https://github.com/frakhmann/scribbles-backend/blob/main/app/db/session.py"
click node_models "https://github.com/frakhmann/scribbles-backend/blob/main/app/models/generated_models.py"
click node_ws "https://github.com/frakhmann/scribbles-backend/blob/main/app/core/ws_manager.py"
click node_feed_socket "https://github.com/frakhmann/scribbles-backend/blob/main/app/main.py"
click node_static "https://github.com/frakhmann/scribbles-backend/tree/main/app/static"

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_app,node_feed_socket,node_client toneBlue
class node_auth,node_authdeps,node_authutils,node_profile,node_usercrud,node_user_schema toneAmber
class node_posts,node_postcrud,node_comments,node_commentcrud,node_comment_schema,node_likes,node_likecrud toneMint
class node_sections,node_universities toneRose
class node_session,node_models,node_database,node_ws,node_static,node_email toneIndigo
```

## Components

### API entrypoints

- [FastAPI app](https://github.com/frakhmann/scribbles-backend/blob/main/app/main.py): `app/main.py`
- [Feed WebSocket](https://github.com/frakhmann/scribbles-backend/blob/main/app/main.py): `app/main.py`

### Identity and profiles

- [Auth routes](https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/routes.py): `app/auth/routes.py`
- [Auth dependencies](https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/dependencies.py): `app/auth/dependencies.py`
- [Auth utilities](https://github.com/frakhmann/scribbles-backend/blob/main/app/auth/utils.py): `app/auth/utils.py`
- [Profiles and follows](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/profile.py): `app/routers/profile.py`
- [User data access](https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/user.py): `app/crud/user.py`
- [User schemas](https://github.com/frakhmann/scribbles-backend/blob/main/app/schemas/user.py): `app/schemas/user.py`

### Social feed

- [Post routes](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/posts.py): `app/routers/posts.py`
- [Post data access](https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/post.py): `app/crud/post.py`
- [Comment routes](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/comments.py): `app/routers/comments.py`
- [Comment data access](https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/comment.py): `app/crud/comment.py`
- [Comment schemas](https://github.com/frakhmann/scribbles-backend/blob/main/app/schemas/comment.py): `app/schemas/comment.py`
- [Like routes](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/likes.py): `app/routers/likes.py`
- [Like data access](https://github.com/frakhmann/scribbles-backend/blob/main/app/crud/like.py): `app/crud/like.py`

### University context

- [Section routes](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/sections.py): `app/routers/sections.py`
- [University routes](https://github.com/frakhmann/scribbles-backend/blob/main/app/routers/universities.py): `app/routers/universities.py`

### Persistence and realtime

- [DB sessions](https://github.com/frakhmann/scribbles-backend/blob/main/app/db/session.py): `app/db/session.py`
- [ORM models](https://github.com/frakhmann/scribbles-backend/blob/main/app/models/generated_models.py): `app/models/generated_models.py`
- **Relational database**
- [WebSocket manager](https://github.com/frakhmann/scribbles-backend/blob/main/app/core/ws_manager.py): `app/core/ws_manager.py`
- [Static media files](https://github.com/frakhmann/scribbles-backend/tree/main/app/static): `app/static`

### Other components

- **API client**
- **Email service**

## Connections

- API client → FastAPI app: HTTP requests
- FastAPI app → Auth routes: routes to
- FastAPI app → Profiles and follows: routes to
- FastAPI app → Post routes: routes to
- FastAPI app → Comment routes: routes to
- FastAPI app → Like routes: routes to
- FastAPI app → Section routes: routes to
- FastAPI app → University routes: routes to
- FastAPI app → Feed WebSocket: serves
- Auth routes → Auth dependencies: validates identity
- Auth routes → Auth utilities: verifies and issues
- Auth routes → User data access: looks up users
- Auth routes → ORM models: queries and updates
- Auth routes → Email service: sends verification
- Auth routes → User schemas: validates payloads
- Profiles and follows → Auth dependencies: requires identity
- Profiles and follows → ORM models: queries and updates
- Profiles and follows → Post data access: loads user posts
- Profiles and follows → Comment data access: loads user comments
- Profiles and follows → Like data access: loads liked items
- Profiles and follows → Static media files: saves avatar media
- Post routes → Auth dependencies: requires identity
- Post routes → Post data access: creates posts
- Post routes → ORM models: queries and deletes
- Post routes → Static media files: saves post media
- Post routes → WebSocket manager: broadcasts events
- Comment routes → Comment data access: manages comments
- Comment routes → Comment schemas: validates payloads
- Comment routes → Auth dependencies: requires identity
- Like routes → Like data access: manages likes
- Like routes → Auth dependencies: requires identity
- Section routes → ORM models: queries context
- University routes → ORM models: queries context
- DB sessions → Relational database: opens sessions
- DB sessions → ORM models: provides ORM base
- Feed WebSocket → WebSocket manager: connects clients
- WebSocket manager → API client: broadcasts feed events
- Post data access → ORM models: persists posts
- Comment data access → ORM models: persists comments
- Like data access → ORM models: persists likes
- User data access → ORM models: persists users
- Static media files → API client: serves media
