# omarelmadboly54-sketch/simple_project architecture

> Architecture diagram of the GitHub repository omarelmadboly54-sketch/simple_project, 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/omarelmadboly54-sketch/simple_project
- Repository: https://github.com/omarelmadboly54-sketch/simple_project

## Overview

This is a Gin-based cinema API for user accounts, movies, and showtimes. Requests enter domain controllers, which handle HTTP input and responses; the user flow includes registration and login, with login checking credentials and issuing a JWT, while admin routes enforce token and role checks. Services provide domain logic over repository interfaces, with PostgreSQL implementations persisting data. The sampled source shows user-layer calls in detail; movie and showtime internals are represented from the tree and wiring in main.go, so their internal links are left unverified.

Main entry points: [`main.go`](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/main.go) (Server wiring), [`internal/controller/users.go`](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/users.go) (User controller), [`internal/service/users.go`](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/users.go) (User service), [`internal/service/movies.go`](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/movies.go) (Movie service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP entry"]
  node_runtime["Server wiring<br/>[main.go]"]
  node_user_http["User controller<br/>[users.go]"]
  node_movie_http["Movie controller<br/>[movies.go]"]
  node_show_http["Showtime controller<br/>[showtimes.go]"]
  node_presenters["Request presenters<br/>[users.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_config_loader["Config loader<br/>[viper.go]"]
end

subgraph group_identity["Identity and access"]
  node_auth_middleware["Auth middleware<br/>[middleware.go]"]
  node_jwt["JWT maker<br/>[jwt_maker.go]"]
  node_token_payload["Token payload<br/>[payload.go]"]
  node_user_service["User service<br/>[users.go]"]
  node_user_models["User models<br/>[users.go]"]
end

subgraph group_domain["Cinema domains"]
  node_movie_service["Movie service<br/>[movies.go]"]
  node_show_service["Showtime service<br/>[showtimes.go]"]
  node_movie_models["Movie models<br/>[movies.go]"]
  node_show_models["Showtime models<br/>[showtimes.go]"]
end

subgraph group_persistence["Persistence"]
  node_user_repo["User repository<br/>[users.go]"]
  node_movie_repo["Movie repository<br/>[movies.go]"]
  node_show_repo["Showtime repository<br/>[showtimes.go]"]
  node_pg_users["Postgres users<br/>[users.go]"]
  node_pg_movies["Postgres movies<br/>[movies.go]"]
  node_pg_show["Postgres showtimes<br/>[showtimes.go]"]
  node_database[("PostgreSQL")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_user_http
node_runtime -->|"loads settings"| node_config
node_config -->|"loads environment"| node_config_loader
node_runtime -->|"registers routes"| node_user_http
node_runtime -->|"registers routes"| node_movie_http
node_runtime -->|"registers routes"| node_show_http
node_runtime -->|"wires service"| node_user_service
node_runtime -->|"wires service"| node_movie_service
node_runtime -->|"wires service"| node_show_service
node_runtime -->|"creates repository"| node_pg_users
node_runtime -->|"creates repository"| node_pg_movies
node_runtime -->|"creates repository"| node_pg_show
node_runtime -->|"creates token maker"| node_jwt
node_user_http -->|"binds requests"| node_presenters
node_user_http -->|"calls service"| node_user_service
node_user_http -->|"protects admin routes"| node_auth_middleware
node_auth_middleware -->|"verifies token"| node_jwt
node_user_service -->|"reads and writes"| node_user_repo
node_user_service -->|"issues tokens"| node_jwt
node_user_service -->|"handles users"| node_user_models
node_pg_show -->|"queries and saves"| node_database
node_movie_http -.->|"calls service"| node_movie_service
node_show_http -.->|"calls service"| node_show_service
node_movie_service -.->|"uses repository"| node_movie_repo
node_show_service -.->|"uses repository"| node_show_repo
node_pg_users -.->|"uses database"| node_database
node_pg_movies -.->|"uses database"| node_database

click node_runtime "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/main.go"
click node_user_http "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/users.go"
click node_movie_http "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/movies.go"
click node_show_http "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/showtimes.go"
click node_presenters "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/presenters/users.go"
click node_auth_middleware "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/middleware/middleware.go"
click node_jwt "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/token/jwt_maker.go"
click node_token_payload "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/token/payload.go"
click node_user_service "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/users.go"
click node_movie_service "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/movies.go"
click node_show_service "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/showtimes.go"
click node_movie_models "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/models/movies.go"
click node_show_models "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/models/showtimes.go"
click node_user_models "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/models/users.go"
click node_user_repo "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/repository/users.go"
click node_movie_repo "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/repository/movies.go"
click node_show_repo "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/repository/showtimes.go"
click node_pg_users "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/providers/postgres/users.go"
click node_pg_movies "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/providers/postgres/movies.go"
click node_pg_show "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/providers/postgres/showtimes.go"
click node_config "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/configuration/config.go"
click node_config_loader "https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/util/viper.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_user_http,node_movie_http,node_show_http,node_presenters,node_config,node_config_loader,node_client toneBlue
class node_auth_middleware,node_jwt,node_token_payload,node_user_service,node_user_models toneAmber
class node_movie_service,node_show_service,node_movie_models,node_show_models toneMint
class node_user_repo,node_movie_repo,node_show_repo,node_pg_users,node_pg_movies,node_pg_show,node_database toneRose
```

## Components

### HTTP entry

- [Server wiring](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/main.go): `main.go`
- [User controller](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/users.go): `internal/controller/users.go`
- [Movie controller](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/movies.go): `internal/controller/movies.go`
- [Showtime controller](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/controller/showtimes.go): `internal/controller/showtimes.go`
- [Request presenters](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/presenters/users.go): `internal/presenters/users.go`
- [Configuration](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/configuration/config.go): `configuration/config.go`
- [Config loader](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/util/viper.go): `internal/util/viper.go`

### Identity and access

- [Auth middleware](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/middleware/middleware.go): `internal/middleware/middleware.go`
- [JWT maker](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/token/jwt_maker.go): `token/jwt_maker.go`
- [Token payload](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/token/payload.go): `token/payload.go`
- [User service](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/users.go): `internal/service/users.go`
- [User models](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/models/users.go): `internal/models/users.go`

### Cinema domains

- [Movie service](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/movies.go): `internal/service/movies.go`
- [Showtime service](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/service/showtimes.go): `internal/service/showtimes.go`
- [Movie models](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/models/movies.go): `internal/models/movies.go`
- [Showtime models](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/models/showtimes.go): `internal/models/showtimes.go`

### Persistence

- [User repository](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/repository/users.go): `internal/repository/users.go`
- [Movie repository](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/repository/movies.go): `internal/repository/movies.go`
- [Showtime repository](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/repository/showtimes.go): `internal/repository/showtimes.go`
- [Postgres users](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/providers/postgres/users.go): `internal/providers/postgres/users.go`
- [Postgres movies](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/providers/postgres/movies.go): `internal/providers/postgres/movies.go`
- [Postgres showtimes](https://github.com/omarelmadboly54-sketch/simple_project/blob/main/internal/providers/postgres/showtimes.go): `internal/providers/postgres/showtimes.go`
- **PostgreSQL**

### Other components

- **API client**

## Connections

- API client → User controller: sends requests (evidence: `internal/controller/users.go`)
- Server wiring → Configuration: loads settings (evidence: `main.go`)
- Configuration → Config loader: loads environment (evidence: `configuration/config.go`)
- Server wiring → User controller: registers routes (evidence: `main.go`)
- Server wiring → Movie controller: registers routes (evidence: `main.go`)
- Server wiring → Showtime controller: registers routes (evidence: `main.go`)
- Server wiring → User service: wires service (evidence: `main.go`)
- Server wiring → Movie service: wires service (evidence: `main.go`)
- Server wiring → Showtime service: wires service (evidence: `main.go`)
- Server wiring → Postgres users: creates repository (evidence: `main.go`)
- Server wiring → Postgres movies: creates repository (evidence: `main.go`)
- Server wiring → Postgres showtimes: creates repository (evidence: `main.go`)
- Server wiring → JWT maker: creates token maker (evidence: `main.go`)
- User controller → Request presenters: binds requests (evidence: `internal/controller/users.go`)
- User controller → User service: calls service (evidence: `internal/controller/users.go`)
- User controller → Auth middleware: protects admin routes (evidence: `internal/controller/users.go`)
- Auth middleware → JWT maker: verifies token (evidence: `internal/middleware/middleware.go`)
- User service → User repository: reads and writes (evidence: `internal/service/users.go`)
- User service → JWT maker: issues tokens (evidence: `internal/service/users.go`)
- User service → User models: handles users (evidence: `internal/service/users.go`)
- Postgres showtimes → PostgreSQL: queries and saves (evidence: `internal/providers/postgres/showtimes.go`)
- Movie controller → Movie service: calls service
- Showtime controller → Showtime service: calls service
- Movie service → Movie repository: uses repository
- Showtime service → Showtime repository: uses repository
- Postgres users → PostgreSQL: uses database
- Postgres movies → PostgreSQL: uses database
