Skip to content

alshoja/posta-cloud-web-application

Repository files navigation

Posta Cloud

Posta Cloud is a full-stack, Docker-managed record collection platform built with Vue 3, Vuetify, NestJS, PostgreSQL/pgvector, optional Elasticsearch BM25 search, Redis, OCR processing, and a local Ollama-powered AI assistant.

I built this as a practical sample project for field-data workflows: users can store structured records for people in a local area, manage address and personal details, upload documents, use OCR support to reduce manual typing, and ask a local AI assistant to find records using natural language.

Posta Cloud records screen

image image

Highlights

  • Full-stack TypeScript-style architecture with a Vue frontend and NestJS backend.
  • Docker Compose orchestration for frontend, backend, database, Elasticsearch, Redis, OCR worker, and pgAdmin.
  • PostgreSQL persistence with TypeORM, pgvector, and a migration workflow.
  • Redis-backed background processing for OCR tasks.
  • Document upload support with PDF text extraction and OCR for images and scanned PDFs.
  • Optional Elasticsearch BM25 indexing for uploaded document chunks.
  • Posta Mitra, a floating AI assistant for natural-language record search, summaries, and document RAG.
  • Local Ollama integration where the backend validates intents, performs authorized retrieval, and sends only controlled context to the model.
  • Environment-driven configuration for local and production deployments.
  • Security-focused documentation for secrets, personal data, and production setup.

Tech Stack

Area Tools
Frontend Vue 3, Vite, Vuetify, Pinia
Backend NestJS, TypeORM, class-validator
Database PostgreSQL with pgvector
Queue / Worker Redis, OCR worker service
Search pgvector, optional Elasticsearch BM25
AI Ollama, local chat and embedding models
Infrastructure Docker, Docker Compose, pgAdmin

What The App Includes

  • Record workflow: multi-step record creation for personal, identity, occupation, family, policy, and document details.
  • Document support: upload files, extract embedded PDF text, and OCR images or scanned PDFs.
  • OCR auto-fill: send supported identity documents to the OCR worker and use extracted details to reduce manual entry.
  • Posta Mitra AI assistant: search and summarize records or ask questions about accessible uploaded documents.
  • Document RAG: redact and embed document chunks, retrieve them with pgvector plus optional BM25 hybrid search, and return document and page citations.
  • Role-aware access: regular users see their own records; admins follow the backend’s broader record visibility rules.
  • Docker-first operation: frontend, backend, PostgreSQL, Elasticsearch, Redis, OCR worker, Ollama, and pgAdmin run through Compose.

Architecture

The app keeps browser concerns in Vue, business and security rules in NestJS, background OCR in its worker, and local AI calls behind the backend. See Architecture for service and data flows.

User
 |
 v
Frontend (`frontend`, Vue)
 |
 v
Backend API (`backend`, NestJS)
 |
 +-- AuthModule / UsersModule
 |     -> validate JWT, roles, and active user
 |     -> PostgreSQL/pgvector (`postgres_db`)
 |
 +-- RecordsModule
 |     -> enforce record access and run the six-step workflow
 |     -> save records and uploaded document metadata
 |     -> PostgreSQL/pgvector (`postgres_db`)
 |     -> queue document embedding in Redis (`redis`)
 |
 +-- AI Module
       |
       +-- Document indexing
       |     -> parse text PDFs in the backend
       |     -> send images and scanned PDF pages through Redis (`redis`)
       |     -> OCR worker (`ocr-worker`) downloads private MinIO objects and returns text
       |     -> redact and chunk text
       |     -> Ollama (`ollama`) creates embeddings
       |     -> PostgreSQL/pgvector (`postgres_db`) stores searchable chunks
       |     -> Elasticsearch (`elasticsearch`) optionally stores BM25 text index
       |
       +-- Posta Mitra chat
             -> Ollama classifies the user intent
             -> backend validates the intent
             -> authorized record query
                OR authorized vector/BM25 hybrid document retrieval
             -> Ollama writes summaries or document-grounded answers
             -> frontend receives records and optional citations

pgAdmin (`pgadmin`) -> PostgreSQL/pgvector (`postgres_db`)
                     development database administration only

Quick Start

Copy .env.example to .env if needed, then start the full project:

./setup.sh

Useful Docker commands:

docker compose up -d
docker compose up --build -d
docker compose logs -f backend
docker compose down

Open:

  • Frontend: http://localhost:3000
  • Backend API: http://localhost:5001
  • Ollama: http://localhost:11434
  • pgAdmin: http://localhost:8080

AI Assistant

Posta Mitra supports natural-language record search, safe record summaries, and questions grounded in uploaded documents. Document answers use pgvector semantic retrieval and can optionally add Elasticsearch BM25 keyword retrieval. The backend owns permissions and database queries; Ollama never receives direct database access. See the AI module when changing AI behavior.

Documentation

About

Posta Cloud is a full-stack, Docker-managed record collection platform built with Vue 3, Vuetify, NestJS, PostgreSQL/pgvector, optional Elasticsearch BM25 search, Redis, OCR processing, and a local Ollama-powered AI assistant.

Topics

Resources

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors