This repository implements the requested architecture:
- API service (Node.js + Express)
- Processing service (Golang)
- NATS for inter-service communication
- SQL persistence with PostgreSQL
- React SPA for upload and status tracking
The sample input file is available at:
/home/runner/work/unicast-tehnical-task/unicast-tehnical-task/.task-material/video.mp4
GET /files- list all files and statusesGET /files/:id- get details for one filePOST /files/process- queue processing from absolute path- body:
{ "filePath": "/absolute/path/to/file.mp4" }
- body:
POST /files/upload- uploadmultipart/form-datafieldfileand queue processingDELETE /files/:id- delete DB record and processed init segment file
Statuses:
ProcessingSuccessfulFailed
The processing service expects the first two MP4 boxes to be:
ftypmoov
Those two boxes are extracted and written into a new output file <original>.init.mp4, then a NATS result message is sent to the API service.
docker compose up --build./api-service/uploads:/app/uploadsstores uploaded files from SPA/API./api-service/processed:/app/processedstores extracted initialization segments./:/workspace:roprovides read-only access to repository files for absolute-path processing
postgres_dataDocker volume stores PostgreSQL data
After startup:
- API:
http://localhost:3000 - SPA:
http://localhost:5173 - NATS:
nats://localhost:4222 - PostgreSQL:
postgresql://postgres:postgres@localhost:5432/unicast
cd api-service
npm install
npm startcd processing-service
go run ./cmd/processorcd spa
npm install
npm run devSet SPA API target if needed:
VITE_API_BASE_URL=http://localhost:3000 npm run devcd api-service && npm test
cd processing-service && go test ./...
cd spa && npm test- Upload support (
POST /files/upload) was added for easier SPA integration. - The source MP4 file is not deleted by
DELETE /files/:id; only stored metadata and extracted processing output are removed. - No known unresolved issues.