This project is a backend application demonstrating expertise in RabbitMQ, PostgreSQL, Redis, and Golang.
It includes CSV ingestion, message queuing, data storage, an API with filtering, encryption, validation, logging, SSE for real-time updates, and Dockerization.
- 📂 CSV File Upload in UI → Can upload CSV file in the UI and it will be sent into the service .
- 📂 CSV Ingestion → Parses CSV files and sends data to RabbitMQ queue.
- 📨 Message Queue Processing → Consumes messages, validates them, and stores data in PostgreSQL and Redis.
- 🔒 Security
- Encrypts email column in the database.
- Prevents SQL Injection attacks with proper query handling.
- Uses data validation for email and name fields.
- 📝 Logging & Error Handling → Centralized logging for troubleshooting and debugging.
- ⚡ Performance Optimizations
- Uses Redis cache before querying PostgreSQL.
- Optimized SQL queries to improve API response times.
- 📡 Server-Sent Events (SSE) → Streams real-time user updates to the frontend.
- 🐳 Docker & Docker Compose → Fully containerized application.
| Component | Technology Used |
|---|---|
| Language | Golang |
| Queue Broker | RabbitMQ |
| Database | PostgreSQL |
| Cache | Redis |
| API Framework | net/http |
| Logging | log |
| Validation | regex, custom functions |
| Frontend | HTML, JavaScript (SSE) |
golang-backend/
│── api/
│ ├── handlers/
│ │ ├── sse_handler.go # SSE event streaming
│── cmd/
│ ├── api/
│ │ ├── main.go # API server setup
│ ├── consumer/
│ │ ├── main.go # Message queue consumer
│── config/
│ ├── config.go # Parse .env and load config
│── internal/
│ ├── models/
│ │ ├── user.go # User struct definition
│ ├── rabbitmq/
│ │ ├── consumer.go # PostgreSQL operations
│ │ ├── producer.go # Redis operations
│ ├── repository/
│ │ ├── postgres.go # PostgreSQL operations
│ │ ├── redis.go # Redis operations
│ ├── services/
│ │ ├── encryption.go # Logging service
│ │ ├── logging.go # Logging service
│ │ ├── validation.go # Validation functions
│── web/
│ ├── index.html # Frontend with SSE integration
│── .env # Environment config
│── data.csv # CSV data to produce
│── docker-compose.yml # Docker container configuration
│── Dockerfile # Golang application Dockerfile
│── README.md # Documentation
│── go.mod # Go dependency module
│── go.sum # Go Indirect dependencies
Create a .env file in the project root:
DATABASE_URL=postgres://user:password@db:5432/golang_db?sslmode=disable
RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672/
REDIS_URL=redis://redis:6379
docker-compose up --build- PostgreSQL runs on port 5432
- RabbitMQ runs on port 5672
- Redis runs on port 6379
go run cmd/consumer/main.go
go run cmd/api/main.goSend a POST request to upload a CSV file.
curl -X POST -F "file=@data.csv" http://localhost:8080/api/upload- Open
index.htmlin the browser. - Users will appear live as they are added.
- Or test via CLI:
curl -N http://localhost:8080/ssePOST /api/upload
| Parameter | Type | Description |
|---|---|---|
file |
File | CSV file to upload |
GET /sse
Response:
data: [{"id":1, "first_name":"John", "last_name":"Doe", "email":"john@example.com"}]✔ Email column encryption in PostgreSQL
✔ Data validation before database insertion
✔ SQL injection protection using parameterized queries
✔ Secure API endpoints with input sanitization
✔ Uses Redis cache before querying PostgreSQL
✔ Filters API results efficiently
✔ Batch processing for CSV ingestion
✔ Uses SSE instead of polling for real-time updates
To run unit tests:
go test ./...