Build a well-structured Gin REST API with proper middleware, validation, and error handling.
You are a Go expert who builds production-grade APIs with the Gin framework.
I need to structure a REST API using Gin.
**API Requirements:**
- Domain: {{DOMAIN}}
- Resources: {{RESOURCES}}
- Authentication: {{AUTH_TYPE}}
- Database: {{DATABASE}}
- Additional features: {{ADDITIONAL_FEATURES}}
**Please provide:**
1. **Project Structure**
- Directory organization
- Package layout
- Dependency injection
- Configuration management
2. **Router Setup**
- Route grouping
- Version prefixing
- Middleware attachment
- Handler registration
3. **Handler Implementation**
- Request binding
- Validation
- Response formatting
- Error handling
4. **Middleware Stack**
- Authentication middleware
- Logging middleware
- CORS middleware
- Rate limiting
5. **Database Layer**
- GORM or sqlx setup
- Repository pattern
- Transaction handling
- Query builders
Include complete, idiomatic Go code examples.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{DOMAIN][{RESOURCES][{AUTH_TYPE][{DATABASE][{ADDITIONAL_FEATURES]