A modular AI-powered email productivity platform built as a full-stack JavaScript application.
This repository contains a React/Next.js frontend, an Express-based API backend, and two Node.js microservices for email processing and embedding generation. The data stack is powered by PostgreSQL, RabbitMQ, Weaviate, and Ollama for embedding/vectorization.
- Project Overview
- Architecture
- Tech Stack
- Directory Layout
- Requirements
- Environment Variables
- Setup
- Run Commands
- Development Workflow
- Service Details
- Troubleshooting
- Notes
This project is an AI email SaaS prototype that:
- Provides a Next.js user interface for email management
- Uses a Node.js/Express API service for authentication, email ingestion, AI summaries, and email actions
- Processes and stores incoming emails in PostgreSQL
- Queues email processing and embedding workloads through RabbitMQ
- Generates embeddings in Weaviate using Ollama vectorization
- Supports Google OAuth, email send/receive workflows, and AI-powered email summaries
- AI-powered email summaries and insights
- Secure JWT-based authentication and Google OAuth integration
- Scalable queue-driven processing with RabbitMQ
- Vector search and embedding storage using Weaviate and Ollama
- Modular microservices for ingestion, processing, and embedding
- AI powered email compose, drafts, and workflow UI with Next.js
- PostgreSQL-backed email storage and metadata tracking
- Responsive development setup with Docker Compose
The system is split into four main application layers:
frontend/- Next.js 16 React application serving the UI on
http://localhost:3000
- Next.js 16 React application serving the UI on
services/api-service/- Express API server exposing authentication, email, AI, send, calendar, ingestion and contact endpoints on
http://localhost:3001
- Express API server exposing authentication, email, AI, send, calendar, ingestion and contact endpoints on
services/processing-service/- RabbitMQ consumer that stores incoming email payloads in PostgreSQL and forwards content to the embedding queue
services/embedding-service/- RabbitMQ consumer that splits email content and inserts documents into Weaviate to create embeddings via Ollama
Infrastructure services are defined in docker-compose.yml:
- PostgreSQL (
postgres:15-alpine) - RabbitMQ (
rabbitmq:3.8-management-alpine) - Weaviate (
cr.weaviate.io/semitechnologies/weaviate:latest) - Ollama (
ollama/ollama)
- Frontend: Next.js 16, React 19, Tailwind CSS, Axios
- Backend: Node.js, Express 5, PostgreSQL, pg, weaviate-client
- Microservices: RabbitMQ queue consumers, LangChain text splitter, Weaviate embeddings
- AI: Google GenAI (
@google/genai), Ollama vectorization through Weaviate
/frontend— Next.js application/services/api-service— main HTTP API and worker startup/services/processing-service— email ingestion + queue forwarding service/services/embedding-service— email embedding generator service/docker-compose.yml— infrastructure orchestration/.env— project environment variables
- Node.js 18+ (recommended)
- npm
- Docker and Docker Compose
- Git
The project uses a root .env file. The following variables are currently configured in .env:
POSTGRES_USERNAMEPOSTGRES_PWDPOSTGRES_DATABASEGEMINI_API_KEYJWT_SECRETGOOGLE_REFRESH_TOKENGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_REDIRECT_URI
Warning: The repository currently contains real-looking values in
.env. Replace these values for your own deployment and never commit secrets to source control.
- Clone the repository:
git clone <repository-url> ai-email-saas
cd ai-email-saas-
Verify the root
.envfile exists and is configured. -
Start infrastructure services:
docker compose up -d- Install dependencies for each package:
cd frontend && npm install
cd ../services/api-service && npm install
cd ../services/processing-service && npm install
cd ../services/embedding-service && npm install- Start frontend:
cd frontend
npm run dev- Start API service:
cd services/api-service
npm run dev- Start processing microservice:
cd services/processing-service
npm run dev- Start embedding microservice:
cd services/embedding-service
npm run devThe workspace includes VS Code tasks for convenience:
Start DockerStart FrontendStart API ServiceStart Processing ServiceStart Embedding ServiceStart All Node AppsStart All Services
- Run Docker infrastructure with
docker compose up -d. - Start the API service and both microservices.
- Run the frontend.
- Open the browser at
http://localhost:3000. - Use the UI and inspect logs for the API and queue consumers.
- Folder:
frontend - Runs on:
http://localhost:3000 - Uses
frontend/src/lib/api.jsto call the backend athttp://localhost:3001 - Scripts:
npm run devnpm run buildnpm run startnpm run lint
- Folder:
services/api-service - Runs on:
http://localhost:3001 - Loads environment from root
../../.env - Connects to PostgreSQL and Weaviate
- Mounted route groups:
/auth/ingestion/ai/send/calendar/emails/contacts
- Uses
@google/genaifor AI operations andweaviate-clientfor vector database access
- Folder:
services/processing-service - Connects to RabbitMQ and PostgreSQL
- Consumes from
email_processing_queue - Stores emails in PostgreSQL and forwards payloads to
embedding_required_queue
- Folder:
services/embedding-service - Connects to RabbitMQ and Weaviate
- Sets up a Weaviate class named
EmailChunks - Uses Ollama via Weaviate to vectorize email text
- Consumes from
embedding_required_queue
The repo provides the following Docker services:
postgres_db— PostgreSQL database on5432rabbitmq_broker— RabbitMQ broker on5672and management UI on15672weaviate_db— Weaviate on8080ollama_service— Ollama on11434
The res/ folder contains visual references for the application UI and workflow.
res/overall preview.png— Full app workflow previewres/ai compose.png— AI-assisted email compose screenres/ai summary.png— AI-generated summary viewres/compose & draft.png— Compose and draft managementres/settings.png— Settings and configuration screen
Below are the visual assets for quick reference:
- If the frontend cannot reach the backend, confirm
services/api-serviceis running andfrontend/src/lib/api.jspoints tohttp://localhost:3001. - If RabbitMQ is not reachable, confirm
docker compose psand check port5672. - If Weaviate fails to start, inspect container logs and ensure
ollamais available before the model endpoint is called. - If the API fails to connect to PostgreSQL, verify
.envcredentials andpostgres_dbcontainer status.
- The project is designed for local development and experimentation.
- The root service configuration assumes
localhostfor PostgreSQL, RabbitMQ, and Weaviate. - For production deployment, externalize
.envsecrets and update service hostnames accordingly. - The current app uses Google OAuth/GenAI credentials and may require valid Google API access.
docker compose up -d
cd frontend && npm install
cd ../services/api-service && npm install
cd ../services/processing-service && npm install
cd ../services/embedding-service && npm install
cd frontend && npm run dev
cd ../services/api-service && npm run dev
cd ../services/processing-service && npm run dev
cd ../services/embedding-service && npm run devOpen http://localhost:3000 in your browser.




