A distributed, microservices-based citizen reporting platform built with Go, React, and event-driven architecture.
- Overview
- Architecture
- Tech Stack
- Prerequisites
- Quick Start
- Detailed Setup
- Running the Application
- Development
- Testing
- Documentation
- Troubleshooting
The Citizen Reporting System enables citizens to report issues (road damage, health concerns, security issues, etc.) to government authorities while maintaining anonymity. The system features:
- Microservices Architecture: 11 independent services
- Event-Driven Communication: Apache Kafka for async messaging
- Strong Anonymity: Reporter identity protection
- RBAC + ABAC Authorization: Role and attribute-based access control
- Real-time Notifications: Multi-channel notification system
- SLA Management: Automatic escalation based on SLA policies
- Public Feed: Community engagement with upvoting
- API Gateway - Single entry point, routing, rate limiting
- Authentication Service - User authentication via Keycloak
- Authorization Service - RBAC + ABAC enforcement
- Report Service - Report management
- Media Service - File upload handling (MinIO)
- Case Management Service - Case lifecycle
- Notification Service - Multi-channel notifications
- Escalation Service - SLA monitoring and escalation
- Feed Service - Public feed and search (OpenSearch)
- Upvote Service - Community engagement
- Integration Service - Event processing
- PostgreSQL: Primary database (per-service isolation)
- Redis: Caching and session management
- Apache Kafka: Event streaming
- MinIO: S3-compatible object storage
- OpenSearch: Full-text search
- Keycloak: Identity and access management
- Prometheus + Grafana: Monitoring and metrics
- Jaeger: Distributed tracing
- Language: Go 1.21+
- Framework: Gin
- Database: PostgreSQL 15
- Cache: Redis 7
- Message Broker: Apache Kafka 3.5
- Object Storage: MinIO
- Search Engine: OpenSearch 2.11
- Framework: React 18
- Language: TypeScript
- Build Tool: Vite
- UI Library: Material-UI
- State Management: React Query
- Routing: React Router
- Containerization: Docker
- Orchestration: docker-compose (local), Kubernetes (production)
- CI/CD: GitHub Actions
- Monitoring: Prometheus, Grafana, Jaeger
See TECHSTACK.md for complete details.
- Docker (>= 20.10)
- Docker Compose (>= 2.0)
- Make (for automation)
- Go (>= 1.21)
- Node.js (>= 18)
- npm or yarn
- PostgreSQL Client (psql)
- RAM: Minimum 8GB (16GB recommended)
- Disk Space: 10GB free space
- OS: Linux, macOS, or Windows with WSL2
# 1. Clone the repository
git clone <repository-url>
cd if4031-tubes-aat
# 2. Quick start (setup + infrastructure + services)
make quickstart
# Wait for infrastructure to be ready (~2 minutes)
# 3. Build and run all services
make build
make run
# 4. Check status
make status
# 5. Access the application
# Frontend: http://localhost:3000
# API Gateway: http://localhost:8081
# Keycloak Admin: http://localhost:8080 (admin/admin)# 1. Setup and start infrastructure
make setup
make infra-up
# 2. Wait for services to be healthy
make health
# 3. Run services locally (in separate terminals)
cd services/report-service
go run cmd/server/main.go
# 4. Run frontend
make dev-frontend# Create environment file
make setup
# This creates .env from .env.example
# Edit .env to customize configurationDefault credentials:
- PostgreSQL:
postgres/postgres - Keycloak:
admin/admin - MinIO:
minioadmin/minioadmin - Grafana:
admin/admin
# Start all infrastructure (Kafka, PostgreSQL, Redis, etc.)
make infra-up
# Verify infrastructure is running
docker ps
# Check health
make healthAccess URLs:
- PostgreSQL:
localhost:5432 - Redis:
localhost:6379 - Kafka:
localhost:29092(external) /kafka:9092(internal) - Kafka UI: http://localhost:8090
- MinIO Console: http://localhost:9001
- OpenSearch: http://localhost:9200
- Keycloak: http://localhost:8080
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001
- Jaeger: http://localhost:16686
# Create required Kafka topics
make kafka-create-topics
# List topics
make kafka-topicsDatabases are created automatically on PostgreSQL startup via init-db.sql.
Databases created:
auth_dbauthz_dbreport_dbmedia_dbcase_dbnotification_dbescalation_dbupvote_dbfeed_dbintegration_dbkeycloak
# Build all Docker images
make build
# This may take 5-10 minutes on first run# Start everything
make run
# View logs
make logs
# View logs for specific service
make logs-service SERVICE=report-service
# Check status
make status
# Stop everything
make stop
# Restart
make restart# Start only microservices (infrastructure must be running)
make services-up
# Stop only microservices
make services-down| Service | Port | URL |
|---|---|---|
| Frontend | 3000 | http://localhost:3000 |
| API Gateway | 8081 | http://localhost:8081 |
| Auth Service | 8082 | http://localhost:8082 |
| Authorization Service | 8083 | http://localhost:8083 |
| Report Service | 8084 | http://localhost:8084 |
| Media Service | 8085 | http://localhost:8085 |
| Case Service | 8086 | http://localhost:8086 |
| Notification Service | 8087 | http://localhost:8087 |
| Escalation Service | 8088 | http://localhost:8088 |
| Feed Service | 8089 | http://localhost:8089 |
| Upvote Service | 8091 | http://localhost:8091 |
| Integration Service | 8092 | http://localhost:8092 |
# 1. Start infrastructure only
make infra-up
# 2. Navigate to service
cd services/report-service
# 3. Install dependencies
go mod download
# 4. Run service
go run cmd/server/main.go
# 5. Run tests
go test ./...
# 6. Run tests with coverage
go test -cover ./...# 1. Navigate to frontend
cd frontend
# 2. Install dependencies
npm install
# 3. Start development server
npm run dev
# 4. Build for production
npm run build
# 5. Preview production build
npm run preview
# Frontend will be available at http://localhost:3000For Go services, use tools like:
- air:
go install github.com/cosmtrek/air@latest - CompileDaemon:
go get github.com/githubnemo/CompileDaemon
# Example with air
cd services/report-service
air# Run all unit tests
make test-unit
# Test specific service
cd services/report-service
go test ./internal/domain/service/... -v# Run integration tests
make test-integration
# Integration tests use Testcontainers for real dependencies# Run E2E tests (requires all services running)
cd tests/e2e/cypress
npm install
npx cypress open- TECHSTACK.md - Complete technology stack
- DB_SCHEMA.md - Database schema documentation
- STRUCTURE.md - Project structure and folder organization
- CLAUDE.md - System requirements and architecture guidelines
API documentation is available via Swagger/OpenAPI:
- After starting services, visit: http://localhost:8081/swagger/index.html
# Check what's using a port
lsof -i :8080
# Stop conflicting services or change ports in docker-compose.yml# Increase Docker memory allocation
# Docker Desktop > Settings > Resources > Memory (set to 8GB+)# Check logs
make logs
# Restart specific service
docker-compose restart report-service
# Clean restart
make clean
make run# Check PostgreSQL is running
make health
# Connect to database
make db-psql
# Check database exists
\l# Check Kafka is running
docker logs citizen-reporting-kafka
# List topics
make kafka-topics
# Recreate topics
make kafka-create-topics
# Access Kafka UI
# http://localhost:8090# Stop and remove containers
make stop
# Remove containers and volumes
make clean
# Remove everything including images
make clean-all
# Start fresh
make setup
make infra-up
make build
make run# View all logs
make logs
# View specific service
make logs-service SERVICE=report-service
# Follow logs in real-time
docker-compose logs -f report-service
# Check service health
make healthmake help # Show all available commands
make setup # Initial setup
make infra-up # Start infrastructure only
make infra-down # Stop infrastructure
make build # Build all services
make run # Run all services
make stop # Stop all services
make logs # View all logs
make status # Show service status
make health # Check health of services
make clean # Clean up containers and volumes
make quickstart # Quick start (setup + infra)
make all # Setup, build, and run everythingThis is currently a skeleton project with:
- ✅ Complete folder structure
- ✅ Docker configuration
- ✅ docker-compose setup
- ✅ Infrastructure services configured
- ✅ Makefile automation
- ⏳ Service implementations (TODO)
- ⏳ Frontend implementation (TODO)
- ⏳ Tests (TODO)
- Implement Report Service
- Implement Authentication & Authorization
- Implement Case Management
- Set up event-driven flows
- Implement remaining services
- Build frontend components
- Write tests
- Deploy to Kubernetes
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is part of an academic assignment for IF4031 - Advanced Application Technology course.
For issues and questions:
- Create an issue in the repository
- Contact the development team
Happy Coding! 🚀