How takuma123-type/go-api-study works
Project type and purpose
• This is a Go-based backend service implementing a RESTful API.
• It follows a Clean/Onion/Hexagonal architecture with clearly separated layers: domain, use cases, interface adapters, and infrastructure.
• It manages entities such as users, mentors, plans, contract requests, and contract approvals and persists them in MySQL via Docker.
File structure
• Top-level Docker configuration for Go and MySQL.
• src/domain: core entities, factories, IDs, repositories, and value objects (pure business logic).
• src/usecase: application/business rules (input DTOs → use case logic → output DTOs).
• src/interface: adapters
• controller: HTTP handlers
• database: repository implementations
• presenter: translates use case outputs to response models
• src/infra: framework & infrastructure
• router: HTTP routing layer
• middleware: error handling, transactions
• rdb: DB connection
• datamodel: ORM/DB schema models
• src/cmd/main.go: application entrypoint
• Tests and mocks under domain and mock.
Key architectural insights (from README/file tree)
• Clean Architecture: each layer depends only inward (interface → usecase → domain).
• Dependency inversion: controllers and repository impls depend on domain contracts.
• Dockerized deployment: service + MySQL companion container.