# omarelmadboly54-sketch/image_processing_service architecture

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

- Interactive diagram: https://gitdiagram.com/omarelmadboly54-sketch/image_processing_service
- Repository: https://github.com/omarelmadboly54-sketch/image_processing_service

## Overview

This is a Go user-account API, not an image-processing workflow in the sampled runtime. Its visible user-to-result paths are account creation (JSON request, validation, password hashing, persistence) and login (lookup, password verification, signed access token). Configuration and PostgreSQL setup are wired at startup. The README is empty; unsampled behavior, including password-helper internals and migration effects, is not inferred.

Main entry points: [`internal/service/users.go`](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/service/users.go) (User workflows), [`main.go`](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/main.go) (Server startup), [`internal/controller/users.go`](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/controller/users.go) (User routes), [`internal/providers/postgres/users.go`](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/providers/postgres/users.go) (Postgres users)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP entry"]
  node_main["Server startup<br/>[main.go]"]
  node_controller["User routes<br/>[users.go]"]
  node_presenters["Request mapping<br/>[users.go]"]
end

subgraph group_users["User domain"]
  node_service["User workflows<br/>[users.go]"]
  node_user_model["User model<br/>[users.go]"]
  node_repository["Repository contract<br/>[users.go]"]
  node_postgres_users["Postgres users<br/>[users.go]"]
  node_errors["Application errors<br/>[errors.go]"]
end

subgraph group_auth["Authentication"]
  node_password["Password helpers<br/>[password.go]"]
  node_token_maker["Token contract<br/>[maker.go]"]
  node_jwt_maker["JWT signer<br/>[jwt_maker.go]"]
  node_payload["Token payload<br/>[payload.go]"]
end

subgraph group_setup["Runtime setup"]
  node_config_init["Database setup<br/>[configuration.go]"]
  node_config_loader["Config loader<br/>[viper.go]"]
  node_config_model["Config model<br/>[configuration.go]"]
end

node_client(("API client"))
node_database[("PostgreSQL")]

node_client -->|"sends requests"| node_controller
node_main -->|"initializes database"| node_config_init
node_config_init -->|"loads settings"| node_config_loader
node_config_loader -->|"populates"| node_config_model
node_config_init -->|"opens connection"| node_database
node_main -->|"creates signer"| node_jwt_maker
node_main -->|"creates repository"| node_postgres_users
node_main -->|"creates service"| node_service
node_main -->|"registers routes"| node_controller
node_controller -->|"maps request"| node_presenters
node_controller -->|"invokes workflows"| node_service
node_service -->|"uses contract"| node_repository
node_service -->|"hashes and verifies"| node_password
node_service -->|"creates access token"| node_token_maker
node_jwt_maker -->|"builds claims"| node_payload
node_postgres_users -->|"implements contract"| node_repository
node_postgres_users -->|"reads and writes"| node_user_model
node_postgres_users -->|"queries"| node_database
node_presenters -->|"maps account"| node_user_model
node_service -->|"handles account"| node_user_model
node_service -->|"returns domain errors"| node_errors
node_controller -->|"maps errors"| node_errors

click node_main "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/main.go"
click node_controller "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/controller/users.go"
click node_presenters "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/presenters/users.go"
click node_service "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/service/users.go"
click node_user_model "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/models/users.go"
click node_repository "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/repository/users.go"
click node_postgres_users "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/providers/postgres/users.go"
click node_password "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/util/password.go"
click node_token_maker "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/token/maker.go"
click node_jwt_maker "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/token/jwt_maker.go"
click node_payload "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/token/payload.go"
click node_config_init "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/configuration/configuration.go"
click node_config_loader "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/util/viper.go"
click node_config_model "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/models/configuration.go"
click node_errors "https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/apperrors/errors.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_main,node_controller,node_presenters,node_client toneBlue
class node_service,node_user_model,node_repository,node_postgres_users,node_errors,node_database toneAmber
class node_password,node_token_maker,node_jwt_maker,node_payload toneMint
class node_config_init,node_config_loader,node_config_model toneRose
```

## Components

### HTTP entry

- [Server startup](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/main.go): `main.go`
- [User routes](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/controller/users.go): `internal/controller/users.go`
- [Request mapping](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/presenters/users.go): `internal/presenters/users.go`

### User domain

- [User workflows](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/service/users.go): `internal/service/users.go`
- [User model](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/models/users.go): `internal/models/users.go`
- [Repository contract](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/repository/users.go): `internal/repository/users.go`
- [Postgres users](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/providers/postgres/users.go): `internal/providers/postgres/users.go`
- [Application errors](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/apperrors/errors.go): `internal/apperrors/errors.go`

### Authentication

- [Password helpers](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/util/password.go): `internal/util/password.go`
- [Token contract](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/token/maker.go): `token/maker.go`
- [JWT signer](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/token/jwt_maker.go): `token/jwt_maker.go`
- [Token payload](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/token/payload.go): `token/payload.go`

### Runtime setup

- [Database setup](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/configuration/configuration.go): `configuration/configuration.go`
- [Config loader](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/util/viper.go): `internal/util/viper.go`
- [Config model](https://github.com/omarelmadboly54-sketch/image_processing_service/blob/main/internal/models/configuration.go): `internal/models/configuration.go`

### Other components

- **API client**
- **PostgreSQL**

## Connections

- API client → User routes: sends requests (evidence: `internal/controller/users.go`)
- Server startup → Database setup: initializes database (evidence: `main.go`)
- Database setup → Config loader: loads settings (evidence: `configuration/configuration.go`)
- Config loader → Config model: populates (evidence: `internal/util/viper.go`)
- Database setup → PostgreSQL: opens connection (evidence: `configuration/configuration.go`)
- Server startup → JWT signer: creates signer (evidence: `main.go`)
- Server startup → Postgres users: creates repository (evidence: `main.go`)
- Server startup → User workflows: creates service (evidence: `main.go`)
- Server startup → User routes: registers routes (evidence: `main.go`)
- User routes → Request mapping: maps request (evidence: `internal/controller/users.go`)
- User routes → User workflows: invokes workflows (evidence: `internal/controller/users.go`)
- User workflows → Repository contract: uses contract (evidence: `internal/service/users.go`)
- User workflows → Password helpers: hashes and verifies (evidence: `internal/service/users.go`)
- User workflows → Token contract: creates access token (evidence: `internal/service/users.go`)
- JWT signer → Token payload: builds claims (evidence: `token/jwt_maker.go`)
- Postgres users → Repository contract: implements contract (evidence: `internal/providers/postgres/users.go`)
- Postgres users → User model: reads and writes (evidence: `internal/providers/postgres/users.go`)
- Postgres users → PostgreSQL: queries (evidence: `internal/providers/postgres/users.go`)
- Request mapping → User model: maps account (evidence: `internal/presenters/users.go`)
- User workflows → User model: handles account (evidence: `internal/service/users.go`)
- User workflows → Application errors: returns domain errors (evidence: `internal/service/users.go`)
- User routes → Application errors: maps errors (evidence: `internal/controller/users.go`)
