API Service Setup
SDD Classification: L4-Operational
Authority: Engineering Team
Review Cycle: Quarterly
Prerequisites
Required Software
Optional Software
Quick Start
1. Clone and Setup
2. Start Dependencies
3. Run Migrations
4. Start Development Server
http://localhost:8080.
Project Structure
Environment Configuration
Environment Files
Required Variables
Secret Management
For production, use environment variables or secret management:Database Setup
Create Development Database
Run Migrations
Create New Migration
Seed Test Data
Development Workflow
Running the Server
Code Generation
Running Tests
Code Quality
IDE Setup
VS Code
Recommended extensions:- Go (golang.go)
- Go Test Explorer
- Error Lens
.vscode/settings.json):
GoLand / IntelliJ
- Enable Go modules: Preferences > Go > Go Modules
- Configure linter: Preferences > Tools > File Watchers
- Set test runner: Run > Edit Configurations
Docker Development
Build Container
Run Container
Docker Compose Services
Common Tasks
Adding a New Endpoint
- Define route in
internal/controller/routes.go - Create handler in
internal/controller/ - Add service method in
internal/service/ - Add repository method if database access needed
- Write tests for all layers
- Update OpenAPI spec if public endpoint
Adding a Database Migration
Adding a New Service Dependency
- Add to
internal/infra/orpkg/ - Update Wire providers in
internal/wire/ - Run
make generate - Update health checks if needed
Troubleshooting
Database Connection Issues
Redis Connection Issues
Build Failures
Test Failures
Make Targets Reference
Related Documentation
- Overview - Service overview
- Architecture - System design
- Testing - Test strategies
- Deployment - Production deployment
Document Status: Complete Version: 2.0