A Twitter-like microservice built with Go, PostgreSQL, Redis, and Kafka.
- User registration and management
- Tweet creation and retrieval
- User following/followers system
- Timeline generation using fan-out approach
- Real-time updates using Kafka
- RESTful API with Swagger documentation
- Containerized with Docker
- Go 1.19+
- Docker and Docker Compose
- Make (optional, but recommended)
- System Architecture - High-level overview of the architecture and components.
.
├── cmd/ # Application entry points
├── docs/ # Documentation
├── internal/
│ ├── adapters/ # External implementations (DB, Kafka, etc.)
│ ├── application/ # Business logic and use cases
│ ├── domain/ # Core business entities and interfaces
│ └── interfaces/ # API handlers and web layer
├── migrations/ # Database migrations
├── scripts/ # Utility scripts
├── .env.example # Example environment variables
├── docker-compose.yml # Main Docker Compose file
├── docker-compose.test.yml # Test environment Docker Compose
└── Makefile # Common tasks
git clone https://github.com/fedeberco/uala-tweets.git
cd uala-tweetsStart all required services (PostgreSQL, Redis, Kafka, ZooKeeper):
make start-dockermake start-localdocker-compose up --buildThe application will be available at http://localhost:8000
Once the application is running, access the Swagger UI at:
http://localhost:8000/swagger/index.html
make test| Command | Description |
|---|---|
make start-local |
Start all services in Docker and run app locally |
make test |
Run all tests with test database |
make install-deps |
Install Go dependencies |
make swagger |
Generate Swagger API documentation |
make build |
Build the application binary |
make clean |
Clean build artifacts |
| Command | Description |
|---|---|
make start-docker |
Start all services in Docker |
make stop-docker |
Stop all Docker services |
make docker-logs |
View container logs |
make docker-build |
Build Docker images |
make docker-up |
Start services in detached mode |
make docker-down |
Stop and remove containers |
make docker-restart |
Restart all services |
| Command | Description |
|---|---|
make migrate-up |
Run database migrations |
make migrate-down |
Rollback the last migration |
make migrate-down-all |
Rollback all migrations |
| Command | Description |
|---|---|
make test-env-up |
Start test environment with test database |
make test-env-down |
Stop test environment |
Key environment variables:
PORT: Application port (default: 8000)DB_URL: PostgreSQL connection stringREDIS_ADDR: Redis address (default: localhost:6379)KAFKA_BROKER: Kafka broker address (default: localhost:9092)