Tags:
IT
Very very nice Book.
Application Architecture
graph TB
subgraph Infrastructure ["Infrastructure"]
DB["<br/>Database Connection<br/>sql.DB"]
LOG["<br/>Logger<br/>slog.Logger"]
WG["<br/>WaitGroup<br/>sync.WaitGroup"]
end
subgraph DataAccessLayer ["Data Access Layer"]
MODELS["<br/>Models<br/>data.Models"]
MM["<br/>MovieModel<br/>data.MovieModel"] --> DB
UM["<br/>UserModel<br/>data.UserModel"] --> DB
TM["<br/>TokenModel<br/>data.TokenModel"] --> DB
PM["<br/>PermissionModel<br/>data.PermissionModel"] --> DB
MODELS --> MM
MODELS --> UM
MODELS --> TM
MODELS --> PM
end
subgraph ApplicationLayer ["Application Layer"]
CFG["<br/>Config<br/>main.config"]
APP["<br/>Application (Handlers and Helpers)<br/>main.application"]
MAILER["<br/>Mailer<br/>mailer.Mailer"]
VALIDATOR["<br/>Validator<br/>validator.Validator"]
APP --> MODELS
APP --> CFG
APP --> MAILER
APP -.-> VALIDATOR
end
subgraph TransportLayer ["Transport Layer"]
SERVER["<br/>HTTP Server<br/>http.Server"]
ROUTER["<br/>Router (+ Custom Middlewares)<br/>httprouter.Router"]
SERVER --> ROUTER
ROUTER --> APP
end
subgraph Legend ["Legend"]
STDLIB["<br/>stdlib"] ~~~ CUSTOM["<br/>custom"] ~~~ THIRDPARTY["<br/>3rd party"]
end
%% Color Legend:
%% Green: Custom Application Components
%% Blue: Go Standard Library Components
%% Gray: External Library Components (3rd party dependencies)
style APP fill:#2e7d32,stroke:#1b5e20,stroke-width:3px,color:#ffffff
style DB fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#ffffff
style SERVER fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#ffffff
style LOG fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#ffffff
style WG fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#ffffff
style MODELS fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style MM fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style UM fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style TM fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style PM fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style MAILER fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style VALIDATOR fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style CFG fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style ROUTER fill:#4d4d4d,stroke:#666666,stroke-width:2px,color:#ffffff
style STDLIB fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#ffffff
style CUSTOM fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style THIRDPARTY fill:#4d4d4d,stroke:#666666,stroke-width:2px,color:#ffffff
%% Subgraph styling with light yellow background and black text
style Infrastructure fill:#fff7d9,stroke:#333,stroke-width:2px,color:#000000
style DataAccessLayer fill:#fff7d9,stroke:#333,stroke-width:2px,color:#000000
style ApplicationLayer fill:#fff7d9,stroke:#333,stroke-width:2px,color:#000000
style TransportLayer fill:#fff7d9,stroke:#333,stroke-width:2px,color:#000000
style Legend fill:#fff7d9,stroke:#333,stroke-width:2px,color:#000000