Files
mygo/docs/server/decisions/0001-server-foundation.md
T

28 lines
1.1 KiB
Markdown

# ADR-0001: Select the Server Foundation
Status: Accepted
Date: 2026-04-25
## Context
MyGO needed a server stack that supports local development, relational metadata, configurable deployment, and multiple file storage backends.
## Decision
- Use Gin for HTTP routing and middleware.
- Use GORM with SQLite and PostgreSQL drivers.
- Use Viper for YAML and environment configuration, with a Cobra flag for the config file path.
- Use local file storage first and expose storage through `internal/storage`.
- Use UUIDs for file and domain identities.
- Use JWT access tokens and database-backed refresh sessions.
- Use offset and limit pagination for the initial API.
- Return direct JSON success bodies and a shared JSON error shape.
- Organize the server as Handler -> Service -> Repository and Storage.
## Consequences
- SQLite supports a zero-service local setup; PostgreSQL supports multi-instance deployments.
- Repository and storage interfaces isolate infrastructure choices from services.
- Database-backed refresh sessions support rotation and revocation.
- Offset pagination remains suitable for the current dataset size and API scope.