A modern, scalable timecard management service built with Go, featuring gRPC and REST APIs, event-driven architecture, and comprehensive monitoring.
- Dual API Support: REST and gRPC endpoints for maximum flexibility
- Event-Driven Architecture: Powered by Apache Kafka for reliable event processing
- Database Support: PostgreSQL integration with GORM for robust data persistence
- API Documentation: Swagger/OpenAPI documentation for easy API exploration
- Monitoring: Elastic APM integration for comprehensive application monitoring
- Containerized: Docker and Docker Compose support for easy deployment
- Development Tools: PGAdmin included for database management
- Kafka Management: Confluent Control Center for Kafka monitoring and management
- Language: Go 1.16+
- Framework: Gin (REST), gRPC
- Database: PostgreSQL
- ORM: GORM
- Message Broker: Apache Kafka
- Monitoring: Elastic APM
- Container: Docker
- Documentation: Swagger/OpenAPI
- Go 1.16 or higher
- Docker and Docker Compose
- Make (for using Makefile commands)
-
Clone the repository:
git clone https://github.com/patricksferraz/timecard-service.git cd timecard-service
-
Copy the environment file and configure it:
cp .env.example .env
-
Start the services using Docker Compose:
make up
-
The service will be available at:
- REST API: http://localhost:8080
- gRPC: localhost:50051
- Swagger UI: http://localhost:8080/swagger/index.html
- PGAdmin: http://localhost:9000
- Kafka Control Center: http://localhost:9021
.
├── application/ # Application layer (use cases)
├── cmd/ # Command line interface
├── domain/ # Domain models and interfaces
├── infrastructure/ # Infrastructure implementations
├── proto/ # Protocol buffer definitions
└── utils/ # Utility functions and helpers
# Docker Compose Operations
make up # Start services in detached mode
make down # Stop and remove containers, networks, and volumes
make start # Start existing services
make stop # Stop running services
make ps # List running services
make logs # View service logs
make attach # Attach to a service container (requires SERVICE=service_name)
make build # Build service images
make prune # Remove unused Docker resources
# Testing
make test # Run tests using docker-compose.test.yml
make gtest # Run Go tests with coverage report
# Code Generation
make gen # Generate Go code from Protocol Buffer definitions
You can run tests in two ways:
-
Using Docker Compose (recommended for CI/CD):
make test
-
Running Go tests directly with coverage:
make gtest
Once the service is running, you can access the Swagger documentation at: http://localhost:8080/swagger/index.html
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Patrick Ferraz - Initial work