A distributed user registration system with event-driven architecture.
Flow:
- User Registration – The user submits a registration form on the Frontend (Next.js)
- Server Action – The browser invokes the
registerUser()Server Action which returns a JSON response - gRPC Communication – The Next.js server communicates with the Backend (Spring) over a gRPC channel using binary protocol
- Event Publishing – The backend produces a
user_registeredevent to Kafka - Event Consumption – The Notification Service (Go) consumes messages from the Kafka topic
- Email Delivery – The notification service sends a welcome email via Resend
Ping Test (gRPC health check):
Successful Registration:
Duplicate Email Validation:
Kafka UI – Events Published:
Welcome Email Received:
| Service | Port | URL |
|---|---|---|
| Frontend | 3000 | http://localhost:3000 |
| Backend (gRPC) | 9090 | localhost:9090 |
| Kafka (host) | 29094 | localhost:29094 |
| Kafka (internal) | 9094 | cephid-kafka:9094 |
| Kafka UI | 8080 | http://localhost:8080 |
| Notification Service | - | (Kafka consumer, no exposed port) |
| Variable | Service | Description |
|---|---|---|
RESEND_API_KEY |
notification-service | Resend API key for sending emails |
Prerequisites:
- Docker and Docker Compose installed
- Resend API key (get one at resend.com)
1. Configure environment:
Create notification-service/.env file:
RESEND_API_KEY=re_xxxxxxxxx2. Start all services:
# Build and start all containers
docker-compose up --build3. Access the application:
| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Kafka UI | http://localhost:8080 |
Useful commands:
# Start in detached mode
docker-compose up -d --build
# View logs
docker-compose logs -f
# View logs for specific service
docker-compose logs -f frontend
docker-compose logs -f backend
docker-compose logs -f notification-service
# Stop all services
docker-compose down
# Stop and remove volumes (clean slate)
docker-compose down -v




