- Overview
- Features
- Structure
- Technologies Used
- Installation Setup
- API Documentation
- Future Enhancements
EmoBridge is a privacy-conscious emotional AI companion. It utilizes a microservices architecture composed of a modern React frontend, a Node.js Express API gateway, and a Python-based FastAPI service that runs local AI models through Ollama.
- User Authentication: Secure JWT-based stateless authentication with password hashing (bcrypt).
- Contact Management: Keep track of user contacts, including communication channels (SMS, Email) and their respective consent preferences.
- Conversations & Chat History: Create and manage multiple chat sessions, retrieve historical messages.
- Privacy-First AI Inference: Messages are processed locally using Ollama, ensuring data privacy.
- Real-Time Streaming: AI responses stream directly to the client using Server-Sent Events (SSE).
The project is organized into multiple packages:
frontend/: The frontend application built with React, TypeScript, and Vite.backend/gateway/: The Express API gateway that handles authentication, database operations, and user management.backend/ai-service/: The AI reasoning service written in Python, using FastAPI and Ollama.
- Frontend: React, TypeScript, Vite
- Gateway: Node.js, Express 5, TypeScript, PostgreSQL, Prisma ORM, Zod, Pino (Logging)
- AI Service: Python 3.13+, FastAPI, Uvicorn,
uv(Package Manager), Ollama - Infrastructure: Docker, Docker Compose
- Docker & Docker Compose
- Node.js (for local development)
- Python 3.13+ and
uv(for local AI service development)
- Set up your environment variables:
- Copy
backend/gateway/.env.exampletobackend/gateway/.env - Copy
backend/ai-service/.env.exampletobackend/ai-service/.env - (Optional) Set
JWT_SECRETin a root.envfile or export it (defaults to a dev placeholder).
- Copy
- Start the services:
docker compose up --build
- Run database migrations:
cd backend/gateway DATABASE_URL=postgresql://postgres:postgres@localhost:5432/emobridge npx prisma migrate deploy
- Install dependencies:
- Frontend:
cd frontend && npm install - Gateway:
cd backend/gateway && npm install - AI Service:
cd backend/ai-service && uv sync
- Frontend:
- Start PostgreSQL locally and update
.envfiles accordingly. - Apply migrations:
cd backend/gateway && npx prisma migrate dev - Start Ollama and AI service:
docker compose up ollama ai-service - Start Gateway:
cd backend/gateway && npm run dev - Start Frontend:
cd frontend && npm run dev
POST /register: Register a new user (email,password,name).POST /login: Authenticate and receive a JWT (email,password).POST /logout: Stateless logout.GET /me: Get current authenticated user details.
GET /: Retrieve all contacts for the authenticated user.POST /: Create a new contact.PUT /:id: Update an existing contact.DELETE /:id: Remove a contact.
GET /: List all conversations for the user.POST /: Create a new conversation session.GET /:id/messages: Retrieve chat history for a specific conversation.PATCH /:id: Rename a conversation.DELETE /:id: Delete a conversation and its messages.
POST /inference/chat(AI Service directly): Accepts chat inference requests and returns responses as Server-Sent Events (SSE).
- Gateway to AI Service Wiring: Forward requests through the gateway instead of calling the AI service directly.
- Continuous Integration/Deployment (CI/CD): Set up
.github/workflows/for automated testing and deployment. - Testing Suite: Integration of test frameworks (Vitest, Jest, Pytest).
- Proactive Contact Alerting: Trigger real-time notifications to emergency contacts via Email or SMS based on emotional AI analysis.
- Linting & Formatting: Standardize codebase rules via ESLint and Prettier.
- Agentic Workflow: Vector database + Agentic workflow to seek support from contact.