# fatkharrofiqi/go-starter-template architecture

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

- Interactive diagram: https://gitdiagram.com/fatkharrofiqi/go-starter-template
- Repository: https://github.com/fatkharrofiqi/go-starter-template

## Overview

This Go starter backend serves HTTP APIs for JWT-based authentication and user management. The main workflow is client request → Fiber routing/middleware → controller validation and request handling → service business logic → PostgreSQL or Redis → response; authentication additionally issues, validates, refreshes, and blacklists tokens. The graph also preserves configuration, tracing, and database seeding capabilities. Source excerpts establish the principal wiring and service calls; links to unsampled routing or configuration internals are omitted where their invocation is not shown.

Main entry points: [`internal/app.go`](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/app.go) (Application bootstrap), [`internal/service/auth_service.go`](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/auth_service.go) (Authentication service), [`internal/route/route.go`](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/route/route.go) (HTTP routes), [`internal/service/user_service.go`](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/user_service.go) (User service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and configuration"]
  node_main["Server entry point<br/>[main.go]"]
  node_app["Application bootstrap<br/>[app.go]"]
  node_config["Runtime configuration<br/>[config.go]"]
  node_monitor["Tracing setup<br/>[monitoring.go]"]
  node_seedcmd["Seeder entry point<br/>[main.go]"]
end

subgraph group_http["HTTP API"]
  node_route["HTTP routes<br/>[route.go]"]
  node_authctl["Auth controller<br/>[auth_controller.go]"]
  node_userctl["User controller<br/>[user_controller.go]"]
  node_welcome["Welcome controller"]
  node_validation["Request validation<br/>[validation.go]"]
end

subgraph group_identity["Identity and access"]
  node_authmw["Auth middleware<br/>[auth_middleware.go]"]
  node_authsvc["Authentication service<br/>[auth_service.go]"]
  node_jwt["JWT service<br/>[jwt_service.go]"]
  node_blacklist["Blacklist service"]
  node_blacklistrepo["Token blacklist"]
end

subgraph group_users["User management and storage"]
  node_usersvc["User service<br/>[user_service.go]"]
  node_userrepo["User repository<br/>[user_repository.go]"]
  node_converter["User response converter"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis")]
  node_seeder["Seed data<br/>[seeder.go]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_route
node_main -->|"loads config"| node_config
node_main -->|"starts tracing"| node_monitor
node_main -->|"runs server"| node_app
node_app -->|"registers routes"| node_route
node_app -->|"provides controller"| node_authctl
node_app -->|"provides controller"| node_userctl
node_app -->|"provides controller"| node_welcome
node_route -.->|"routes auth"| node_authctl
node_route -.->|"routes users"| node_userctl
node_route -.->|"protects routes"| node_authmw
node_authctl -->|"validates input"| node_validation
node_authctl -->|"handles auth"| node_authsvc
node_userctl -->|"handles user actions"| node_usersvc
node_userctl -->|"reads claims"| node_authmw
node_authmw -->|"checks blacklist"| node_blacklist
node_authmw -->|"validates access"| node_jwt
node_authsvc -->|"issues tokens"| node_jwt
node_authsvc -->|"loads and creates users"| node_userrepo
node_authsvc -->|"checks and revokes"| node_blacklist
node_authsvc -.->|"runs transaction work"| node_userrepo
node_blacklist -.->|"checks and stores tokens"| node_blacklistrepo
node_blacklistrepo -->|"reads and writes"| node_redis
node_usersvc -->|"reads and writes users"| node_userrepo
node_usersvc -->|"converts responses"| node_converter
node_userrepo -->|"queries users"| node_postgres
node_usersvc -->|"caches profile"| node_redis
node_seedcmd -->|"runs seeding"| node_seeder
node_seedcmd -.->|"opens database"| node_postgres

click node_main "https://github.com/fatkharrofiqi/go-starter-template/blob/main/cmd/app/main.go"
click node_app "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/app.go"
click node_config "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/config/env/config.go"
click node_monitor "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/config/monitor/monitoring.go"
click node_route "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/route/route.go"
click node_authctl "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/controller/auth_controller.go"
click node_userctl "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/controller/user_controller.go"
click node_welcome "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/controller/welcome_controller.go"
click node_validation "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/config/validation/validation.go"
click node_authmw "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/middleware/auth_middleware.go"
click node_authsvc "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/auth_service.go"
click node_jwt "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/jwt_service.go"
click node_blacklist "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/blacklist_service.go"
click node_blacklistrepo "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/repository/token_blacklist_repository.go"
click node_usersvc "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/user_service.go"
click node_userrepo "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/repository/user_repository.go"
click node_converter "https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/dto/converter/user_to_response.go"
click node_seedcmd "https://github.com/fatkharrofiqi/go-starter-template/blob/main/cmd/seed/main.go"
click node_seeder "https://github.com/fatkharrofiqi/go-starter-template/blob/main/db/seeder/seeder.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_app,node_config,node_monitor,node_seedcmd,node_client toneBlue
class node_route,node_authctl,node_userctl,node_welcome,node_validation toneAmber
class node_authmw,node_authsvc,node_jwt,node_blacklist,node_blacklistrepo toneMint
class node_usersvc,node_userrepo,node_converter,node_postgres,node_redis,node_seeder toneRose
```

## Components

### Runtime and configuration

- [Server entry point](https://github.com/fatkharrofiqi/go-starter-template/blob/main/cmd/app/main.go): `cmd/app/main.go`
- [Application bootstrap](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/app.go): `internal/app.go`
- [Runtime configuration](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/config/env/config.go): `internal/config/env/config.go`
- [Tracing setup](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/config/monitor/monitoring.go): `internal/config/monitor/monitoring.go`
- [Seeder entry point](https://github.com/fatkharrofiqi/go-starter-template/blob/main/cmd/seed/main.go): `cmd/seed/main.go`

### HTTP API

- [HTTP routes](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/route/route.go): `internal/route/route.go`
- [Auth controller](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/controller/auth_controller.go): `internal/controller/auth_controller.go`
- [User controller](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/controller/user_controller.go): `internal/controller/user_controller.go`
- [Welcome controller](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/controller/welcome_controller.go): `internal/controller/welcome_controller.go`
- [Request validation](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/config/validation/validation.go): `internal/config/validation/validation.go`

### Identity and access

- [Auth middleware](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/middleware/auth_middleware.go): `internal/middleware/auth_middleware.go`
- [Authentication service](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/auth_service.go): `internal/service/auth_service.go`
- [JWT service](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/jwt_service.go): `internal/service/jwt_service.go`
- [Blacklist service](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/blacklist_service.go): `internal/service/blacklist_service.go`
- [Token blacklist](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/repository/token_blacklist_repository.go): `internal/repository/token_blacklist_repository.go`

### User management and storage

- [User service](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/service/user_service.go): `internal/service/user_service.go`
- [User repository](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/repository/user_repository.go): `internal/repository/user_repository.go`
- [User response converter](https://github.com/fatkharrofiqi/go-starter-template/blob/main/internal/dto/converter/user_to_response.go): `internal/dto/converter/user_to_response.go`
- **PostgreSQL**
- **Redis**
- [Seed data](https://github.com/fatkharrofiqi/go-starter-template/blob/main/db/seeder/seeder.go): `db/seeder/seeder.go`

### Other components

- **API client**

## Connections

- API client → HTTP routes: sends requests
- Server entry point → Runtime configuration: loads config (evidence: `cmd/app/main.go`)
- Server entry point → Tracing setup: starts tracing (evidence: `cmd/app/main.go`)
- Server entry point → Application bootstrap: runs server (evidence: `cmd/app/main.go`)
- Application bootstrap → HTTP routes: registers routes (evidence: `internal/app.go`)
- Application bootstrap → Auth controller: provides controller (evidence: `internal/app.go`)
- Application bootstrap → User controller: provides controller (evidence: `internal/app.go`)
- Application bootstrap → Welcome controller: provides controller (evidence: `internal/app.go`)
- HTTP routes → Auth controller: routes auth
- HTTP routes → User controller: routes users
- HTTP routes → Auth middleware: protects routes
- Auth controller → Request validation: validates input (evidence: `internal/controller/auth_controller.go`)
- Auth controller → Authentication service: handles auth (evidence: `internal/controller/auth_controller.go`)
- User controller → User service: handles user actions (evidence: `internal/controller/user_controller.go`)
- User controller → Auth middleware: reads claims (evidence: `internal/controller/user_controller.go`)
- Auth middleware → Blacklist service: checks blacklist (evidence: `internal/middleware/auth_middleware.go`)
- Auth middleware → JWT service: validates access (evidence: `internal/middleware/auth_middleware.go`)
- Authentication service → JWT service: issues tokens (evidence: `internal/service/auth_service.go`)
- Authentication service → User repository: loads and creates users (evidence: `internal/service/auth_service.go`)
- Authentication service → Blacklist service: checks and revokes (evidence: `internal/service/auth_service.go`)
- Authentication service → User repository: runs transaction work
- Blacklist service → Token blacklist: checks and stores tokens
- Token blacklist → Redis: reads and writes (evidence: `internal/repository/token_blacklist_repository.go`)
- User service → User repository: reads and writes users (evidence: `internal/service/user_service.go`)
- User service → User response converter: converts responses (evidence: `internal/service/user_service.go`)
- User repository → PostgreSQL: queries users (evidence: `internal/repository/user_repository.go`)
- User service → Redis: caches profile (evidence: `internal/service/user_service.go`)
- Seeder entry point → Seed data: runs seeding (evidence: `cmd/seed/main.go`)
- Seeder entry point → PostgreSQL: opens database
