This demonstration project showcases a Go-based web service, highlighting best practices and architecture for modern Go web applications. It uses an event processing system as a concrete example to illustrate the construction of a fully functional and well-structured Go web service.
This demo project centers around event handling, demonstrating the complete workflow from database operations to API design and application bootstrapping. Through this practical use case, developers can gain valuable insights into building scalable, high-performance, and maintainable web services in Go.
- Clean Architecture implementation
- AWS SQS integration for event processing
- RESTful API with Echo framework
- PostgreSQL with GORM, supporting read replicas
- Graceful shutdown mechanism
- Environment-based configuration
adapter/storage: Database connection and configurationgorm.go: GORM database abstraction layer setuppostgres.go: PostgreSQL database connection implementation
api: API controllers and routingapi.go: API server and common request handlersevent_controller.go: Event-related API controllers
bootstrap: Application initialization and configurationapp.go: Main application structure and startup logicconfig.go: Configuration loading and managementsqs.go: AWS SQS consumer implementationwire.go: Dependency injection configuration
domain: Domain models and interface definitionsevent.go: Event-related domain models and interfaces
usecase: Business logic implementationevent_usecase.go: Event use case business logic
repository: Database operationsevent_repository.go: Event-related database operationsrepository.go: Generic database operation functions
main.go: Application entry point
