Lightweight receipt extraction service using NestJS, BullMQ, Redis, Ollama (LLM), Postgres and S3. This repo contains backend and frontend components and orchestration for local development.
- backend โ NestJS backend (API, queue consumers, websocket gateway)
- frontend โ React frontend (upload/list/details, realtime updates)
- docker-compose.yml โ local Redis & Ollama services
Layers:
- Frontend (React) โ REST + WebSocket client
- Backend (NestJS) โ Controllers, Services, WebSocket Gateway
- Processing Layer โ BullMQ queues, Redis cache, Ollama LLM
- Storage Layer โ Postgres (main), Redis (temp), S3 (images)

- Node.js 18+ and npm
- Docker & docker-compose
- PostgreSQL (local or remote)
- AWS credentials (for S3) or local S3-compatible service
- Ollama model (qwen2.5vl:7b) for image โ structured data
# Start Redis and ollama service
docker-compose up -d
# Verify services are running
docker-compose ps# Install qwen
docker exec ollama-vision ollama pull qwen2.5vl:7bcd backend
npm installnano .envRequired environment variables:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database
DATABASE_URL= <Postgres URL>
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
# AWS S3
AWS_REGION=eu-north-1
AWS_ACCESS_KEY_ID=<AWS_KEY>
AWS_SECRET_ACCESS_KEY=<ACCESS_SECRET>
# Ollama
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=qwen2.5vl:7b
# CORS
CORS_ORIGIN=http://localhost:5173
# frontend/.env.example
VITE_API_URL=http://localhost:3000
VITE_WS_URL=ws://localhost:3000
# Generate initial migration (if needed)
npm npx prisma generate
# Development mode (with hot reload)
npm run start:devBackend should now be running at http://localhost:3000
It also exposes a queeue monitoring dashboard at http://localhost:3000/queues
cd frontend
npm install# Development mode
npm run devFrontend should now be running at http://localhost:5173
cd backend
# Unit tests
npm run test
# E2E tests
npm run test:e2e
cd frontend
# Run tests
npm run test- Redis connection errors: verify docker service
redisor your host/port. - Bull worker not processing: confirm the processor class has
@Processor('extraction')and process method is decorated@Process('process-receipt'). - Queues missing in Bull Board: check AppModule import ordering (queues must be registered before BullBoard).
- Ollama timeouts: ensure Ollama service is healthy and model is pulled.
- Persist raw LLM responses for traceability
- Improve model configuration (prompt/params) and graceful shutdown of LLM connections
- Add Playwright/Cypress E2E tests for the full flow
- Optional: Support pluggable LLM backends and model choice
License
- MIT













