A full-stack chat application built with FastAPI, Google ADK (Agent Development Kit), React, and DaisyUI.
Remembers User persona across various conversations and builds a timeline of user activities. This is achieved using context engineering techniques like entity extraction, llm as orchestrator & state resolver, tool calling
- A ChatGPT style chat UI that has Real-time streaming chat responses via SSE
- Conversation history with auto-generated titles
- Responsive UI with sidebar navigation
- Supabase Integration for persistent storage of users and chat sessions
- Mongodb Integration for storing user's persona and activity timeline
- JWT-based User authentication
The moat of this project can be found at https://github.com/AdityaSanthosh/UserMemory-Chat/blob/main/backend/agent/agent.py
- FastAPI - Modern Python web framework
- Google ADK - Agent Development Kit for managing AI agents
- Supabase - PostgreSQL database for users and sessions
- React 18 - UI framework
- React Router - Client-side routing
- DaisyUI 4 - Tailwind CSS component library
- Vite - Build tool
- Python 3.10+
- Node.js 18+
- Google Cloud API Key with Gemini API access
- Supabase Account and Project
Create the following tables in your Supabase project:
-
users
id(uuid, primary key)username(text, unique)hashed_password(text)created_at(timestamptz)
-
sessions
id(text, primary key)app_name(text)user_id(text)state(jsonb)last_update_time(timestamptz)
-
events
id(int8/uuid, primary key, auto-generated)session_id(text, foreign key to sessions.id)event_data(jsonb)created_at(timestamptz)
Copy .env.example to .env and fill in the values:
cp .env.example .envRequired variables:
GOOGLE_API_KEY- Your Google API key for GeminiSECRET_KEY- Secret key for JWT tokens (generate a random string)SUPABASE_URL- Your Supabase project URLSUPABASE_KEY- Your Supabaseanonpublic key
# Install Python dependencies
pip install -r requirements.txt
# Run the backend server
uvicorn backend.main:app --reload --port 8000# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Run development server
npm run devThe frontend will be available at http://localhost:5173 and will proxy API requests to the backend at http://localhost:8000.
POST /api/auth/register- Create new userPOST /api/auth/login- Login and get JWT tokenGET /api/auth/me- Get current user info
GET /api/sessions- List user's chat sessionsGET /api/sessions/{id}- Get session with messages
POST /api/chat- Send message and receive streaming response (SSE)
The chat endpoint streams responses using Server-Sent Events:
session-{session_id, is_new}- Session infodelta-{content}- Streamed text chunktitle-{title}- Auto-generated title (for new sessions)done-{}- Stream completeerror-{message}- Error occurred
In one terminal:
uvicorn backend.main:app --reload --port 8000In another terminal:
cd frontend && npm run dev# Build frontend
cd frontend && npm run build
# The built files will be in frontend/dist
# The FastAPI app can serve these static filesMIT