Deployment Guide
Relevant source files
The following files were used as context for generating this wiki page:
This guide provides technical instructions and architectural overviews for deploying OS Chat, a full-stack AI assistant platform. OS Chat is built using a modern TypeScript stack, leveraging TanStack Start for the frontend and Convex for a real-time, serverless backend.
The platform is designed to be self-hostable and privacy-first, featuring encrypted API key storage and integration with multiple AI providers and third-party services. The deployment process involves configuring environment variables, setting up the Convex backend, and deploying the frontend to a provider like Vercel.
Sources: README.md:10-23, CLAUDE.md:40-65
Infrastructure Architecture
The OS Chat architecture consists of a distributed system where the frontend, backend, and external integrations interact through secure protocols.
The diagram above illustrates the high-level data flow and component relationships within the OS Chat ecosystem.
Sources: CLAUDE.md:92-120, src/routes/security.tsx:55-75
Core Components
| Component | Technology | Role |
|---|---|---|
| Frontend Framework | TanStack Start (React 19) | Full-stack framework with SSR and file-based routing. |
| Backend | Convex | Real-time database, serverless functions, and file storage. |
| Server Engine | Nitro v3 | Universal server engine for SSR and API routes. |
| Object Storage | Cloudflare R2 | Used via @convex-dev/r2 for attachments and images. |
| Caching/Memory | Upstash Redis | Manages session state and background agent history. |
| Integrations | Composio | Provides connectivity to Gmail, Calendar, Notion, and GitHub. |
Sources: CLAUDE.md:44-65, AGENTS.md:44-65, convex/scheduled_ai.ts:25-45
Deployment Requirements
Environment Variables
Sensitive configurations must be managed through environment variables. The application distinguishes between client-side and server-side variables.
- Client-side (
VITE_prefix): Accessed viaimport.meta.env. - Server-side: Accessed via
process.env.
Sources: CLAUDE.md:60-61, src/routes/security.tsx:75-77
External Service Dependencies
Successful deployment requires active credentials for the following services:
- Google Cloud Console: For Google OAuth integration with Convex Auth.
- Upstash: For Redis REST URL and Token to support background agents.
- Composio: For enabling third-party tool integrations.
- Resend: For email notifications regarding background agent completions.
Sources: README.md:13-20, convex/scheduled_ai.ts:25-30, CLAUDE.md:104-106
Step-by-Step Deployment
1. Local Environment Setup
Before production deployment, ensure the local environment is correctly configured using the Bun package manager.
# Install dependencies
bun install
# Configure environment
cp .env.example .env
# Start Convex development server
bunx convex dev --once
Sources: README.md:144-152, CLAUDE.md:142-152
2. Backend Deployment (Convex)
The backend is deployed to the Convex cloud. This includes the database schema, internal/public functions, and authentication configuration.
Sources: CLAUDE.md:142-152, README.md:144-152
3. Frontend Deployment (Vercel)
The project is optimized for Vercel, utilizing Nitro for SSR. During the build process (bun build), the application generates a production-ready bundle.
Sources: CLAUDE.md:142-152, src/routes/security.tsx:64-65
Security Configuration
Security is a primary consideration in the deployment of OS Chat. The following measures are implemented at the architectural level:
- API Key Protection: User-provided keys are encrypted using AES-GCM 256-bit encryption with PBKDF2 (100,000 iterations).
- Data Isolation: User-specific encryption keys ensure isolation within the shared Convex database.
- Rate Limiting: Default limits are set to 5 messages/day for anonymous users and 20 messages/day for authenticated users.
- DDoS Protection: Vercel's infrastructure provides standard protection for the frontend.
Sources: src/routes/security.tsx:28-44, src/routes/security.tsx:65-66
Background Agent Execution Flow
If background agents are enabled, the deployment must have Upstash Redis correctly configured. The executeTask internal action handles the autonomous lifecycle of these agents.
The system uses ctx.scheduler.runAt for recurring tasks (daily/weekly) and runAfter for immediate tasks like sending summary emails.
Sources: convex/scheduled_ai.ts:25-230, CLAUDE.md:112-114
Summary
Deploying OS Chat requires a coordinated setup of the Bun runtime, Convex serverless backend, and Vercel hosting. The platform's reliance on external services like Upstash for agent memory and Composio for tool integrations necessitates thorough environment variable configuration to ensure high availability and security for background tasks.
Sources: README.md:10-23, CLAUDE.md:40-65