# edraithenni/totallyguysproject architecture

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

- Interactive diagram: https://gitdiagram.com/edraithenni/totallyguysproject
- Repository: https://github.com/edraithenni/totallyguysproject

## Overview

This is a Go/Gin backend for a movie-playlist social app. Requests enter through the API server, pass authentication where required, and reach handlers for movie discovery, accounts, playlists, reviews, threaded comments, follows, and moderation; handlers use PostgreSQL-backed models and some publish WebSocket notifications. The README also documents OMDb movie lookup and admin content controls. The graph includes those documented capabilities, while unsampled handler details are represented at their exact directory path; edges are limited to relationships visible in excerpts or README statements.

Main entry points: [`internal/server/server.go`](https://github.com/edraithenni/totallyguysproject/blob/main/internal/server/server.go) (HTTP routing), [`internal/ws/wshub.go`](https://github.com/edraithenni/totallyguysproject/blob/main/internal/ws/wshub.go) (Live notifications), [`cmd/server/main.go`](https://github.com/edraithenni/totallyguysproject/blob/main/cmd/server/main.go) (Server bootstrap), [`internal/handlers/admin_handlers.go`](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/admin_handlers.go) (Admin controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API runtime"]
  node_runtime["Server bootstrap<br/>[main.go]"]
  node_router["HTTP routing<br/>[server.go]"]
end

subgraph group_identity["Identity and moderation"]
  node_auth["Authentication<br/>[auth.go]"]
  node_authmw["JWT middleware<br/>[auth_middleware.go]"]
  node_admin["Admin controls<br/>[admin_handlers.go]"]
  node_ban["Ban registry<br/>[banned.go]"]
end

subgraph group_catalog["Movie collections"]
  node_movies["Movie search<br/>[movie.go]"]
  node_playlists["Playlists<br/>[playlists.go]"]
end

subgraph group_community["Social discussions"]
  node_users["User profiles<br/>[user.go]"]
  node_follows["User follows<br/>[follow.go]"]
  node_reviews["Movie reviews<br/>[reviews.go]"]
  node_comments["Review discussions<br/>[comments.go]"]
end

subgraph group_state["Persistence and events"]
  node_database_init["Database setup<br/>[database.go]"]
  node_models["Domain models<br/>[models.go]"]
  node_postgres[("PostgreSQL")]
  node_websocket["Live notifications<br/>[wshub.go]"]
end

node_client(("API client"))
node_omdb["OMDb API"]

node_client -->|"sends requests"| node_router
node_runtime -->|"initializes database"| node_database_init
node_runtime -->|"starts server"| node_router
node_router -->|"routes auth"| node_auth
node_router -->|"applies middleware"| node_authmw
node_router -->|"routes admin"| node_admin
node_router -->|"routes movies"| node_movies
node_router -->|"routes playlists"| node_playlists
node_router -->|"routes reviews"| node_reviews
node_router -->|"routes discussions"| node_comments
node_router -->|"routes follows"| node_follows
node_router -->|"routes profiles"| node_users
node_router -->|"upgrades connection"| node_websocket
node_authmw -->|"validates tokens"| node_auth
node_admin -->|"bans users"| node_ban
node_movies -.->|"fetches movie data"| node_omdb
node_auth -.->|"notifies users"| node_websocket
node_reviews -->|"publishes updates"| node_websocket
node_admin -->|"sends notices"| node_websocket
node_runtime -->|"loads ban state"| node_models
node_database_init -->|"migrates schema"| node_models
node_database_init -->|"opens connection"| node_postgres
node_movies -.->|"reads and writes"| node_postgres
node_playlists -.->|"reads and writes"| node_postgres
node_reviews -->|"reads and writes"| node_postgres
node_comments -.->|"reads and writes"| node_postgres
node_users -.->|"reads and writes"| node_postgres
node_follows -.->|"reads and writes"| node_postgres
node_websocket -->|"persists notifications"| node_postgres

click node_runtime "https://github.com/edraithenni/totallyguysproject/blob/main/cmd/server/main.go"
click node_router "https://github.com/edraithenni/totallyguysproject/blob/main/internal/server/server.go"
click node_auth "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/auth.go"
click node_authmw "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/auth_middleware.go"
click node_admin "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/admin_handlers.go"
click node_ban "https://github.com/edraithenni/totallyguysproject/blob/main/internal/banned/banned.go"
click node_users "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/user.go"
click node_follows "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/follow.go"
click node_movies "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/movie.go"
click node_playlists "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/playlists.go"
click node_reviews "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/reviews.go"
click node_comments "https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/comments.go"
click node_database_init "https://github.com/edraithenni/totallyguysproject/blob/main/internal/database/database.go"
click node_models "https://github.com/edraithenni/totallyguysproject/blob/main/internal/models/models.go"
click node_websocket "https://github.com/edraithenni/totallyguysproject/blob/main/internal/ws/wshub.go"

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_runtime,node_router,node_client toneBlue
class node_auth,node_authmw,node_admin,node_ban toneAmber
class node_movies,node_playlists,node_omdb toneMint
class node_users,node_follows,node_reviews,node_comments toneRose
class node_database_init,node_models,node_postgres,node_websocket toneIndigo
```

## Components

### API runtime

- [Server bootstrap](https://github.com/edraithenni/totallyguysproject/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [HTTP routing](https://github.com/edraithenni/totallyguysproject/blob/main/internal/server/server.go): `internal/server/server.go`

### Identity and moderation

- [Authentication](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/auth.go): `internal/handlers/auth.go`
- [JWT middleware](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/auth_middleware.go): `internal/handlers/auth_middleware.go`
- [Admin controls](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/admin_handlers.go): `internal/handlers/admin_handlers.go`
- [Ban registry](https://github.com/edraithenni/totallyguysproject/blob/main/internal/banned/banned.go): `internal/banned/banned.go`

### Movie collections

- [Movie search](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/movie.go): `internal/handlers/movie.go`
- [Playlists](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/playlists.go): `internal/handlers/playlists.go`

### Social discussions

- [User profiles](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/user.go): `internal/handlers/user.go`
- [User follows](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/follow.go): `internal/handlers/follow.go`
- [Movie reviews](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/reviews.go): `internal/handlers/reviews.go`
- [Review discussions](https://github.com/edraithenni/totallyguysproject/blob/main/internal/handlers/comments.go): `internal/handlers/comments.go`

### Persistence and events

- [Database setup](https://github.com/edraithenni/totallyguysproject/blob/main/internal/database/database.go): `internal/database/database.go`
- [Domain models](https://github.com/edraithenni/totallyguysproject/blob/main/internal/models/models.go): `internal/models/models.go`
- **PostgreSQL**
- [Live notifications](https://github.com/edraithenni/totallyguysproject/blob/main/internal/ws/wshub.go): `internal/ws/wshub.go`

### Other components

- **API client**
- **OMDb API**

## Connections

- API client → HTTP routing: sends requests (evidence: `README.md`)
- Server bootstrap → Database setup: initializes database (evidence: `cmd/server/main.go`)
- Server bootstrap → HTTP routing: starts server (evidence: `cmd/server/main.go`)
- HTTP routing → Authentication: routes auth (evidence: `internal/server/server.go`)
- HTTP routing → JWT middleware: applies middleware (evidence: `internal/server/server.go`)
- HTTP routing → Admin controls: routes admin (evidence: `internal/server/server.go`)
- HTTP routing → Movie search: routes movies (evidence: `internal/server/server.go`)
- HTTP routing → Playlists: routes playlists (evidence: `internal/server/server.go`)
- HTTP routing → Movie reviews: routes reviews (evidence: `internal/server/server.go`)
- HTTP routing → Review discussions: routes discussions (evidence: `README.md`)
- HTTP routing → User follows: routes follows (evidence: `README.md`)
- HTTP routing → User profiles: routes profiles (evidence: `internal/server/server.go`)
- HTTP routing → Live notifications: upgrades connection (evidence: `internal/server/server.go`)
- JWT middleware → Authentication: validates tokens (evidence: `internal/handlers/auth_middleware.go`)
- Admin controls → Ban registry: bans users (evidence: `internal/handlers/admin_handlers.go`)
- Movie search → OMDb API: fetches movie data (evidence: `README.md`)
- Authentication → Live notifications: notifies users (evidence: `README.md`)
- Movie reviews → Live notifications: publishes updates (evidence: `internal/handlers/reviews.go`)
- Admin controls → Live notifications: sends notices (evidence: `internal/handlers/admin_handlers.go`)
- Server bootstrap → Domain models: loads ban state (evidence: `cmd/server/main.go`)
- Database setup → Domain models: migrates schema (evidence: `internal/database/database.go`)
- Database setup → PostgreSQL: opens connection (evidence: `internal/database/database.go`)
- Movie search → PostgreSQL: reads and writes
- Playlists → PostgreSQL: reads and writes
- Movie reviews → PostgreSQL: reads and writes (evidence: `internal/handlers/reviews.go`)
- Review discussions → PostgreSQL: reads and writes
- User profiles → PostgreSQL: reads and writes
- User follows → PostgreSQL: reads and writes
- Live notifications → PostgreSQL: persists notifications (evidence: `internal/ws/wshub.go`)
