Upload documents and ask questions — DocuMind uses RAG (Retrieval-Augmented Generation) to provide accurate, context-aware answers from your files.
A demo MVP showcasing Java, TypeScript, AWS CDK, LangChain4j, Spring Boot, and React.
Why? To demonstrate a production-ready AI application with modern infrastructure. Useful for teams needing quick answers from documentation, research papers, or internal knowledge bases.
Built in Boston, USA — January 2026
- Live Demo
- Screenshot
- Features
- Architecture
- Project Structure
- Local Development
- Environment Variables
- AWS Deployment
- Author
- Documentation
- License
| Resource | URL |
|---|---|
| Frontend | https://d3py6xai9gspab.cloudfront.net |
| API | http://DocuMi-Backe-Mnku72pk6qQ2-534965933.us-east-1.elb.amazonaws.com |
Upload a document, ask questions, and get AI-powered answers with source citations.
- PDF/Text document upload
- Automatic text extraction and chunking
- Vector embeddings with pgvector
- RAG-based Q&A with LangChain4j
- Conversation history
- Modern React UI
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ React Frontend │────▶│ Spring Boot API │────▶│ LangChain4j │
│ (TypeScript) │ │ (Java 21) │ │ + OpenAI/Local │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
┌──────────┴──────────┐
▼ ▼
┌──────────┐ ┌──────────────┐
│ S3 │ │ PostgreSQL │
│ (Docs) │ │ (pgvector) │
└──────────┘ └──────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ DOCUMENT INGESTION │
│ │
│ ┌──────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────────────────┐ │
│ │ Upload │───▶│ Parse PDF/ │───▶│ Chunk │───▶│ Generate Embeddings │ │
│ │ Document│ │ Text Files │ │ (1500 char)│ │ (AllMiniLmL6V2) │ │
│ └──────────┘ └──────────────┘ └──────────────┘ └───────────┬───────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ Store in pgvector │ │
│ │ (PostgreSQL) │ │
│ └───────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ QUESTION ANSWERING │
│ │
│ ┌──────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────────────────┐ │
│ │ User │───▶│ Embed │───▶│ Vector │───▶│ Retrieve Top 5 │ │
│ │ Question│ │ Question │ │ Similarity │ │ Relevant Chunks │ │
│ └──────────┘ └──────────────┘ └──────────────┘ └───────────┬───────────┘ │
│ │ │
│ ▼ │
│ ┌──────────┐ ┌──────────────────────────────────────────────────────────────┐ │
│ │ Answer │◀───│ OpenAI GPT-4o-mini generates answer with context + sources │ │
│ └──────────┘ └──────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ USERS │
└─────────────────────────────────────┬───────────────────────────────────────────────┘
│ HTTPS
▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ CLOUDFRONT CDN │
│ https://d3py6xai9gspab.cloudfront.net │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Static Assets │◄─────────────────────────────┤ API Routes │ │
│ │ (/, /*, etc.) │ │ (/api/*) │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────┬───────────────────────────────────────────────┬───────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────┐ ┌─────────────────────────────────────────┐
│ S3 BUCKET │ │ APPLICATION LOAD BALANCER │
│ documind-frontend-884710187119 │ │ (Port 80) │
│ (Frontend Assets) │ └─────────────┬───────────────────────────┘
└─────────────────────────────────────┘ │ HTTP
▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ VPC │
│ (us-east-1a & us-east-1b) │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────────┐ │
│ │ PUBLIC SUBNETS │ │
│ │ ┌─────────────────┐ ┌─────────────────┐ │ │
│ │ │ Internet Gateway│ │ NAT Gateway │ │ │
│ │ └─────────────────┘ └─────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────────────┘ │
│ │ Outbound Internet │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────────┐ │
│ │ PRIVATE SUBNETS │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ ECS FARGATE CLUSTER │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │
│ │ │ │ ECS Task │ │ ECS Task │ │ ECS Task │ │ │ │
│ │ │ │documind-api │ │documind-api │ │documind-api │ │ │ │
│ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │
│ │ │ Auto Scaling: 50% - 200% capacity │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ Database Connection │ │
│ │ ▼ │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ RDS POSTGRESQL │ │ │
│ │ │ Instance: db.t3.micro | Storage: 20GB (auto-scale to 100GB) │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────────┘
│ Document Storage
▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ S3 DOCUMENTS BUCKET: documind-documents-884710187119 (Encrypted, CORS enabled) │
└─────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ SECURITY: Security Groups │ IAM Roles │ Secrets Manager (DB creds, OpenAI key) │
└─────────────────────────────────────────────────────────────────────────────────────┘
Key Features:
- High Availability: Multi-AZ deployment across two availability zones
- Scalability: Auto-scaling ECS service and RDS storage
- Security: Private subnets for application and database tiers
- Performance: CloudFront CDN for global content delivery
- AI Integration: OpenAI API for intelligent document processing
├── backend/ # Spring Boot + LangChain4j API
├── frontend/ # React + TypeScript UI
└── infra/ # AWS CDK Infrastructure
Run everything locally using Docker for PostgreSQL.
- Java 21+
- Node.js 20+
- Docker
cd backend
docker compose up -dCreate backend/.env with your OpenAI API key (see Environment Variables).
cd backend
mvn spring-boot:runcd frontend
npm install
npm run devAccess the app at http://localhost:5173
| Variable | Description | Required | Default |
|---|---|---|---|
OPENAI_API_KEY |
OpenAI API key for GPT-4o-mini | Yes | - |
SPRING_DATASOURCE_URL |
PostgreSQL connection URL | No | jdbc:postgresql://localhost:5432/documind |
SPRING_DATASOURCE_USERNAME |
Database username | No | documind |
SPRING_DATASOURCE_PASSWORD |
Database password | No | documind |
Local Development: Create backend/.env:
OPENAI_API_KEY=sk-your-key-here
AWS Deployment: Store in Secrets Manager (see Post-Deploy).
The app is currently deployed on AWS. To deploy your own instance:
- AWS CLI configured (
aws configure) - AWS CDK installed (
npm install -g aws-cdk)
cd infra
npm install
npx cdk bootstrap # First time only
npx cdk deployaws secretsmanager put-secret-value \
--secret-id documind/openai-api-key \
--secret-string '{"apiKey":"sk-your-actual-key"}'cd frontend
npm run build
aws s3 sync dist/ s3://documind-frontend-<ACCOUNT_ID>-<REGION>/ --delete
aws cloudfront create-invalidation --distribution-id <DIST_ID> --paths "/*"Amir Olyaei
MIT License - see LICENSE for details.

