# alan-00280/eventseat-pbl-uas architecture

> Architecture diagram of the GitHub repository alan-00280/eventseat-pbl-uas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alan-00280/eventseat-pbl-uas
- Repository: https://github.com/alan-00280/eventseat-pbl-uas

## Overview

EventSeat is a Go/Fiber REST backend whose implemented workflow is account registration and JWT-based authentication: API routes invoke auth services, which validate credentials and use repositories for user and refresh-token state in PostgreSQL. Middleware handles request policy and access-token checks; helpers provide validation, hashing, JWT, and response support. The README also describes event registration, ticketing, notifications, and feedback as product goals, but the available source excerpts show no corresponding runtime modules, so those subsystems are not represented as implemented. MongoDB and Redis/Asynq are documented or configured but not connected to a demonstrated product workflow.

Main entry points: [`app/service/auth_service.go`](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/service/auth_service.go) (Auth service), [`config/app.go`](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/app.go) (Fiber server), [`main.go`](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/main.go) (Application startup), [`database/postgres.go`](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/database/postgres.go) (PostgreSQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_fiber["Fiber server<br/>[app.go]"]
  node_routes["API routes<br/>[routes.go]"]
  node_middleware["Request middleware<br/>[middleware.go]"]
  node_auth_middleware["Auth middleware<br/>[auth.go]"]
end

subgraph group_identity["Identity workflow"]
  node_auth_service["Auth service<br/>[auth_service.go]"]
  node_auth_models["Auth models<br/>[auth.go]"]
  node_user_model["User model<br/>[user.go]"]
  node_auth_helpers["Auth helpers<br/>[security.go]"]
  node_jwt_helper["JWT manager<br/>[jwt.go]"]
  node_validation["Request validation<br/>[validator.go]"]
  node_auth_context["Auth context<br/>[context.go]"]
end

subgraph group_persistence["Persistence"]
  node_user_repo["User repository<br/>[user_repo.go]"]
  node_token_repo["Token repository<br/>[token_repo.go]"]
  node_postgres_pool[("PostgreSQL pool<br/>[postgres.go]")]
  node_postgres[("PostgreSQL")]
  node_mongo_conn["MongoDB connection<br/>[mongo.go]"]
  node_mongo[("MongoDB")]
end

subgraph group_platform["Platform support"]
  node_configuration["Runtime config<br/>[env.go]"]
  node_application_start["Application startup<br/>[main.go]"]
  node_error_models["HTTP error models<br/>[errors.go]"]
  node_http_models["HTTP response models<br/>[http.go]"]
  node_authz["Authorization rules<br/>[authz.go]"]
  node_redis_asynq["Redis task client<br/>[app.go]"]
  node_redis[("Redis")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_fiber
node_fiber -->|"registers middleware"| node_middleware
node_fiber -->|"registers routes"| node_routes
node_routes -->|"dispatches auth"| node_auth_service
node_routes -->|"guards routes"| node_auth_middleware
node_auth_middleware -->|"parses token"| node_jwt_helper
node_auth_middleware -->|"stores identity"| node_auth_context
node_auth_service -->|"reads and creates users"| node_user_repo
node_auth_service -->|"rotates token state"| node_token_repo
node_auth_service -->|"issues access token"| node_jwt_helper
node_auth_service -->|"validates input"| node_validation
node_auth_service -->|"hashes credentials"| node_auth_helpers
node_auth_service -->|"reads identity"| node_auth_context
node_user_repo -->|"queries users"| node_postgres_pool
node_token_repo -.->|"stores refresh tokens"| node_postgres_pool
node_postgres_pool -->|"connects pool"| node_postgres
node_application_start -->|"loads settings"| node_configuration
node_application_start -->|"creates pool"| node_postgres_pool
node_application_start -->|"wires dependencies"| node_auth_service
node_application_start -->|"starts server"| node_fiber
node_mongo_conn -->|"connects client"| node_mongo
node_application_start -.->|"initializes optional store"| node_mongo_conn
node_redis_asynq -->|"configures client"| node_redis
node_auth_service -->|"parses auth requests"| node_auth_models
node_auth_service -->|"uses user records"| node_user_model
node_fiber -->|"normalizes errors"| node_error_models
node_fiber -->|"returns responses"| node_http_models
node_authz -->|"checks actor identity"| node_user_model

click node_fiber "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/app.go"
click node_routes "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/routes/routes.go"
click node_middleware "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/middleware/middleware.go"
click node_auth_middleware "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/middleware/auth.go"
click node_auth_service "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/service/auth_service.go"
click node_auth_models "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/auth.go"
click node_user_model "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/user.go"
click node_auth_helpers "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/security.go"
click node_jwt_helper "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/jwt.go"
click node_validation "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/validator.go"
click node_auth_context "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/context.go"
click node_user_repo "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/repository/user_repo.go"
click node_token_repo "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/repository/token_repo.go"
click node_postgres_pool "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/database/postgres.go"
click node_mongo_conn "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/database/mongo.go"
click node_configuration "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/env.go"
click node_application_start "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/main.go"
click node_error_models "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/errors.go"
click node_http_models "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/http.go"
click node_authz "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/authz.go"
click node_redis_asynq "https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/app.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_fiber,node_routes,node_middleware,node_auth_middleware,node_client toneBlue
class node_auth_service,node_auth_models,node_user_model,node_auth_helpers,node_jwt_helper,node_validation,node_auth_context toneAmber
class node_user_repo,node_token_repo,node_postgres_pool,node_postgres,node_mongo_conn,node_mongo toneMint
class node_configuration,node_application_start,node_error_models,node_http_models,node_authz,node_redis_asynq,node_redis toneRose
```

## Components

### HTTP API

- [Fiber server](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/app.go): `config/app.go`
- [API routes](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/routes/routes.go): `routes/routes.go`
- [Request middleware](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/middleware/middleware.go): `middleware/middleware.go`
- [Auth middleware](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/middleware/auth.go): `middleware/auth.go`

### Identity workflow

- [Auth service](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/service/auth_service.go): `app/service/auth_service.go`
- [Auth models](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/auth.go): `app/model/auth.go`
- [User model](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/user.go): `app/model/user.go`
- [Auth helpers](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/security.go): `helper/security.go`
- [JWT manager](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/jwt.go): `helper/jwt.go`
- [Request validation](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/validator.go): `helper/validator.go`
- [Auth context](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/context.go): `helper/context.go`

### Persistence

- [User repository](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/repository/user_repo.go): `app/repository/user_repo.go`
- [Token repository](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/repository/token_repo.go): `app/repository/token_repo.go`
- [PostgreSQL pool](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/database/postgres.go): `database/postgres.go`
- **PostgreSQL**
- [MongoDB connection](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/database/mongo.go): `database/mongo.go`
- **MongoDB**

### Platform support

- [Runtime config](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/env.go): `config/env.go`
- [Application startup](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/main.go): `main.go`
- [HTTP error models](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/errors.go): `app/model/errors.go`
- [HTTP response models](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/app/model/http.go): `app/model/http.go`
- [Authorization rules](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/helper/authz.go): `helper/authz.go`
- [Redis task client](https://github.com/alan-00280/eventseat-pbl-uas/blob/main/config/app.go): `config/app.go`
- **Redis**

### Other components

- **API client**

## Connections

- API client → Fiber server: sends requests (evidence: `README.md`)
- Fiber server → Request middleware: registers middleware (evidence: `config/app.go`)
- Fiber server → API routes: registers routes (evidence: `config/app.go`)
- API routes → Auth service: dispatches auth (evidence: `routes/routes.go`)
- API routes → Auth middleware: guards routes (evidence: `routes/routes.go`)
- Auth middleware → JWT manager: parses token (evidence: `middleware/auth.go`)
- Auth middleware → Auth context: stores identity (evidence: `middleware/auth.go`)
- Auth service → User repository: reads and creates users (evidence: `app/service/auth_service.go`)
- Auth service → Token repository: rotates token state (evidence: `app/service/auth_service.go`)
- Auth service → JWT manager: issues access token (evidence: `app/service/auth_service.go`)
- Auth service → Request validation: validates input (evidence: `app/service/auth_service.go`)
- Auth service → Auth helpers: hashes credentials (evidence: `app/service/auth_service.go`)
- Auth service → Auth context: reads identity (evidence: `app/service/auth_service.go`)
- User repository → PostgreSQL pool: queries users (evidence: `app/repository/user_repo.go`)
- Token repository → PostgreSQL pool: stores refresh tokens
- PostgreSQL pool → PostgreSQL: connects pool (evidence: `database/postgres.go`)
- Application startup → Runtime config: loads settings (evidence: `main.go`)
- Application startup → PostgreSQL pool: creates pool (evidence: `main.go`)
- Application startup → Auth service: wires dependencies (evidence: `main.go`)
- Application startup → Fiber server: starts server (evidence: `main.go`)
- MongoDB connection → MongoDB: connects client (evidence: `database/mongo.go`)
- Application startup → MongoDB connection: initializes optional store
- Redis task client → Redis: configures client (evidence: `config/app.go`)
- Auth service → Auth models: parses auth requests (evidence: `app/service/auth_service.go`)
- Auth service → User model: uses user records (evidence: `app/service/auth_service.go`)
- Fiber server → HTTP error models: normalizes errors (evidence: `config/app.go`)
- Fiber server → HTTP response models: returns responses (evidence: `config/app.go`)
- Authorization rules → User model: checks actor identity (evidence: `helper/authz.go`)
