How gyrozepelix/mithril-cms works
Main Components
a) API Layer
• This at the top level
• Using HTTP/REST endpoints
• Connected to the handlers package (/internal/handlers)
b) Core Service Layer
• Authentication Service (/internal/service/auth)
• User Management Service (/internal/service/user)
• Content Management Service (implied by content.go handler)
c) Persistence Layer
• PostgreSQL Database (implied by SQL migrations and sqlc usage)
• Database Models and Queries (/internal/storage/persistence)
d) Middleware Layer
• Authentication Middleware (/internal/middleware/auth.go)
e) Supporting Components
• Configuration Management (/internal/config)
• Logging System (/internal/logging)
• Error Handling (/internal/errs)
Relationship Flows to Illustrate
• Client → API Layer (HTTP Requests)
• API Layer → Middleware → Handlers
• Handlers → Services
• Services → Storage Layer
• Storage Layer → Database
Architectural Patterns to Highlight
The project follows several clear patterns that should be represented:
• Clean Architecture (layers are well-separated)
• Repository Pattern (storage/persistence)
• Middleware Pattern (auth middleware)
• Service Layer Pattern (internal/service)
Technical Details
Annotations for:
• Go as the primary language
• JWT Authentication (based on jwt.go)
• SQL Migrations (db/migration)
• SQLC for database operations
• Docker support (docker-compose.yml)
Component Grouping
Related components:
a) Authentication Components:
• JWT Service
• Encryption Service
• Auth Middleware
b) User Management:
• User Service
• User Handler
• User Storage
c) Content Management:
• Content Handler
• Content Service (implied)
• Content Storage (implied)