This project implements a backend streaming system that generates encrypted data streams over sockets, validates and decrypts incoming messages, persists time-bucketed records into a database, and exposes REST APIs for real-time data consumption.
The solution is fully containerized and can be started with a single Docker Compose command.
The system consists of two backend services:
- Periodically generates encrypted message streams
- Sends encrypted data over TCP sockets every 10 seconds
- Each stream contains 49–499 encrypted messages
- Payload fields:
- name
- origin
- destination
- secret_key (SHA-256 checksum)
- Encryption algorithm: AES-256-CTR
- Messages are separated using pipe (
|) delimiter
- Accepts socket connections
- Decrypts incoming message stream
- Validates SHA-256 checksum for integrity
- Discards corrupted messages
- Groups valid messages into minute-based time buckets
- Persists aggregated records into PostgreSQL
- Exposes REST APIs for frontend consumption
project-root
│
├── docker-compose.yml
├── README.md
│
├── emitter-service.jar
├── listener-service.jar
│
├── Dockerfile
Both services use pre-built executable JAR files packaged into Docker images.
Install the following:
- Docker 24+
- Docker Compose v2+
- Git
Required ports:
| Port | Purpose |
|---|---|
| 5432 | PostgreSQL |
| 8080 | Listener REST API |
| 9000 | Listener TCP Socket Server |
git clone git@github.com:Guyvinay/encrypted-timeseries.git
cd encrypted-timeseries
docker-compose build
docker-compose up -d
docker ps
docker logs listener-serviceAccess APIs:
- Latest stats:
http://localhost:8080/api/stats/latest - Latest records:
http://localhost:8080/api/records/latest