Skip to content

About

ContextWeave AI — Production-ready orchestration platform for context-aware AI applications. SvelteKit + Express, ChromaDB vector search, Stripe billing, WebSocket collaboration.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

🧵 ContextWeave AI

Production-ready AI orchestration platform for building context-aware applications. SvelteKit frontend, Express/TypeScript backend, Prisma ORM, real-time WebSocket collaboration, ChromaDB vector search, and multi-LLM support (OpenAI + Anthropic).

TypeScript SvelteKit Node.js PostgreSQL Redis Docker License

SEO Description: Open-source AI orchestration platform for building context-aware applications with SvelteKit frontend, Node.js/Express backend, Prisma ORM, ChromaDB vector database, Redis caching, WebSocket real-time collaboration, Stripe billing, JWT/OAuth auth, and OpenAI/Anthropic LLM integration.

Overview

ContextWeave AI is a production-grade orchestration platform that provides the infrastructure layer for building context-aware AI applications. It weaves together multiple AI models, manages conversation context across sessions, provides real-time collaborative workspaces, and handles authentication, billing, and vector search out of the box — so you can focus on building AI features instead of infrastructure.

Features

  • 🧠 Context Weaving Engine — Core AI orchestration layer that maintains conversation context, manages prompt chains, and routes requests across multiple LLM providers (OpenAI, Anthropic)
  • 🔐 Authentication System — JWT-based auth with OAuth 2.0 support (Google + GitHub providers), bcrypt password hashing, and refresh token rotation
  • 💳 Subscription Management — Stripe-powered billing with usage tracking, webhook processing, and subscription lifecycle management
  • 👥 Real-Time Collaboration — WebSocket (Socket.IO) powered multi-user workspaces with live presence, shared AI sessions, and synchronized state
  • ⚡ WebGPU Acceleration — Client-side AI inference acceleration for embedding generation and on-device model execution
  • 🐳 Docker-Native Deployment — One-click deployment with docker-compose including PostgreSQL, Redis, and ChromaDB
  • 🔍 Vector Search — ChromaDB integration for semantic search, RAG pipelines, and embedding-based retrieval
  • 📦 Prisma ORM — Type-safe database access with Prisma, migrations, and schema management
  • 🚦 Rate Limiting & Security — Express rate limiting, Helmet security headers, CORS protection, and input validation with Zod
  • 🎨 Modern Frontend — SvelteKit with Tailwind CSS, Svelte-FA icons, Vite hot module replacement, and responsive design
  • 📡 Real-Time APIs — Socket.IO for bidirectional communication between frontend and backend
  • 💾 Redis Caching — Session caching, rate limiting data, and pub/sub for WebSocket scaling

Tech Stack

Frontend

Technology Purpose
SvelteKit 2 Full-stack frontend framework with SSR/SSG
Svelte 4 Reactive UI component framework
TypeScript 5.3 Type-safe development
Tailwind CSS 3 Utility-first CSS framework
Vite 5 Fast build tool and dev server
Socket.IO Client Real-time WebSocket communication
Svelte-FA Font Awesome icons for Svelte
@tailwindcss/forms Form styling plugin

Backend

Technology Purpose
Node.js JavaScript runtime (18+)
Express 4 HTTP API framework
TypeScript 5.3 Type-safe backend development
tsx TypeScript execution engine (dev)
Prisma 5 Type-safe ORM with migrations
PostgreSQL 15 Primary relational database
Redis 7 Caching, sessions, pub/sub
ChromaDB Vector database for embeddings/RAG
OpenAI SDK 4 GPT-4o, embeddings integration
Socket.IO 4 WebSocket server for real-time features
Stripe 14 Payment processing and subscriptions
Zod 3 Runtime type validation
jsonwebtoken 9 JWT authentication
bcryptjs 2 Password hashing
helmet 7 Security headers
express-rate-limit 7 API rate limiting
cors 2 Cross-origin resource sharing
morgan HTTP request logging
ioredis 5 Redis client for Node.js

DevOps & Tooling

Technology Purpose
Docker Compose Multi-container orchestration
Jest 29 Testing framework
ESLint 8 Code linting (TypeScript + Svelte)
concurrently 8 Run frontend/backend together

Architecture

contextweave-ai/
├── frontend/                     # SvelteKit web application
│   ├── src/                      # Frontend source (routes, components, lib)
│   ├── svelte.config.js          # SvelteKit configuration
│   ├── tailwind.config.js        # Tailwind CSS configuration
│   ├── vite.config.ts            # Vite build configuration
│   └── package.json              # Frontend dependencies
├── backend/                      # Express/TypeScript API server
│   ├── src/                      # Backend source (routes, controllers, services)
│   │   └── index.ts              # Backend entry point (Express app + Socket.IO)
│   ├── tsconfig.json             # TypeScript config for backend
│   └── package.json              # Backend dependencies
├── prisma/                       # Database schema and migrations
│   └── schema.prisma             # Prisma schema (models, relations)
├── docker/                       # Docker configuration files
├── docker-compose.yml            # Multi-service orchestration (Postgres, Redis, ChromaDB)
├── .env.example                  # Environment variable template
└── package.json                  # Root workspace package.json

System Architecture Diagram

┌─────────────────────────────────────────────────────────┐
│                    SvelteKit Frontend                    │
│  (Tailwind CSS, Socket.IO Client, WebGPU Acceleration)  │
└─────────────────────────┬───────────────────────────────┘
                          │ HTTP + WebSocket
┌─────────────────────────▼───────────────────────────────┐
│                  Express Backend (Node.js)               │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐ │
│  │   Auth    │ │  AI/LLM  │ │  Stripe  │ │ WebSocket  │ │
│  │  (JWT+   │ │ (OpenAI/ │ │ Billing  │ │  (Socket   │ │
│  │  OAuth)   │ │Anthropic)│ │          │ │    .IO)    │ │
│  └──────────┘ └──────────┘ └──────────┘ └────────────┘ │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐                │
│  │  Rate    │ │  Zod     │ │  Helmet  │                │
│  │ Limiting │ │Validation│ │ Security │                │
│  └──────────┘ └──────────┘ └──────────┘                │
└──────────┬───────────┬──────────────┬───────────────────┘
           │           │              │
    ┌──────▼───┐ ┌─────▼─────┐ ┌─────▼──────┐
    │PostgreSQL│ │   Redis   │ │ ChromaDB   │
    │ (Prisma) │ │ (Cache/   │ │ (Vector    │
    │  + Auth  │ │ Sessions) │ │  Search)   │
    └──────────┘ └───────────┘ └────────────┘

Quick Start

Prerequisites

  • Node.js 18+ (install)
  • Docker & Docker Compose (install)
  • npm or pnpm (Node package manager)

Installation

# Clone the repository
git clone https://github.com/yethikrishna/contextweave-ai.git
cd contextweave-ai

# Install dependencies (root + frontend + backend)
npm install

Environment Setup

# Copy environment template
cp .env.example .env

Edit .env with your configuration (see Environment Variables below for details).

Start Infrastructure Services

# Start PostgreSQL, Redis, and ChromaDB using Docker
docker-compose up -d postgres redis chromadb

Database Setup

# Generate Prisma client
npm run db:generate

# Run database migrations
npm run db:migrate

Start Development

# Start both frontend and backend in development mode
npm run dev

# Or start them separately:
npm run dev:backend   # Backend API (Express + tsx watch)
npm run dev:frontend  # Frontend (SvelteKit + Vite)

The application will be available at:

Production Build

# Build both frontend and backend
npm run build

# Start production server
npm start

Full Docker Deployment

# Start all services including the app
docker-compose up -d

Environment Variables

Variable Description Required Default
DATABASE_URL PostgreSQL connection string Yes postgresql://postgres:postgres@localhost:5432/contextweave
REDIS_URL Redis connection URL Yes redis://localhost:6379
JWT_SECRET JWT signing secret (use strong random value) Yes Change in production
ENCRYPTION_KEY Encryption key (32+ characters) Yes Change in production
GOOGLE_CLIENT_ID Google OAuth client ID No (OAuth) —
GOOGLE_CLIENT_SECRET Google OAuth client secret No (OAuth) —
GITHUB_CLIENT_ID GitHub OAuth client ID No (OAuth) —
GITHUB_CLIENT_SECRET GitHub OAuth client secret No (OAuth) —
OPENAI_API_KEY OpenAI API key (GPT-4o, embeddings) Yes* —
ANTHROPIC_API_KEY Anthropic API key (Claude) Yes* —
CHROMA_URL ChromaDB vector database URL Yes http://localhost:8000
STRIPE_SECRET_KEY Stripe secret key (billing) No (billing) —
STRIPE_WEBHOOK_SECRET Stripe webhook signing secret No (billing) —
APP_URL Frontend application URL No http://localhost:5173
API_URL Backend API URL No http://localhost:3000
NODE_ENV Node environment mode No development

*At least one AI provider API key (OpenAI or Anthropic) is required for AI features.

Project Structure

contextweave-ai/
├── frontend/                  # SvelteKit web application
│   ├── src/
│   │   ├── lib/              # Shared components, utilities, stores
│   │   ├── routes/           # SvelteKit file-based routing
│   │   ├── app.html          # HTML template
│   │   └── app.d.ts          # TypeScript declarations
│   ├── static/               # Static assets
│   ├── svelte.config.js
│   ├── tailwind.config.js
│   ├── vite.config.ts
│   └── tsconfig.json
├── backend/                   # Express/TypeScript API
│   ├── src/
│   │   ├── index.ts          # Express app setup + Socket.IO
│   │   ├── routes/           # API route handlers
│   │   ├── controllers/      # Request handlers
│   │   ├── services/         # Business logic (AI, auth, billing)
│   │   ├── middleware/        # Auth, validation, error handling
│   │   └── lib/              # Utilities, database clients
│   └── tsconfig.json
├── prisma/                    # Database layer
│   ├── schema.prisma         # Data models
│   └── migrations/           # Database migrations
├── docker/                    # Docker configs
│   ├── Dockerfile.backend
│   ├── Dockerfile.frontend
│   └── nginx.conf
├── docker-compose.yml         # Full stack orchestration
├── .env.example               # Environment template
└── package.json               # Root workspace config

API Endpoints

Category Method Endpoint Description
Auth POST /api/auth/register Register new user
POST /api/auth/login Login with email/password
POST /api/auth/oauth/google Google OAuth login
POST /api/auth/oauth/github GitHub OAuth login
GET /api/auth/me Get current user (JWT required)
AI POST /api/ai/chat Send chat completion request
POST /api/ai/embed Generate embeddings
POST /api/ai/context Context weaving operations
Vectors POST /api/vectors/search Semantic search (ChromaDB)
POST /api/vectors/upsert Add/update vectors
Billing POST /api/stripe/checkout Create checkout session
POST /api/stripe/webhook Stripe webhook handler
GET /api/subscription Get subscription status
Realtime WS /socket.io WebSocket connection (collaboration)

Key Scripts

npm run dev              # Start frontend + backend concurrently
npm run dev:frontend     # Start SvelteKit dev server (Vite)
npm run dev:backend      # Start Express with tsx watch (hot reload)
npm run build            # Build frontend + backend for production
npm run build:frontend   # Build SvelteKit frontend (Vite build)
npm run build:backend    # Build TypeScript backend (tsc)
npm start                # Start production server
npm run db:migrate       # Run Prisma database migrations
npm run db:generate      # Generate Prisma client
npm run lint             # Run ESLint
npm test                 # Run Jest tests

Deployment

Docker Compose (Recommended for Production)

# Clone and configure
git clone https://github.com/yethikrishna/contextweave-ai.git
cd contextweave-ai
cp .env.example .env
# Edit .env with production values

# Start all services
docker-compose up -d

# Run migrations
docker-compose exec app npx prisma migrate deploy

Vercel + Railway (Split Deployment)

  • Frontend: Deploy to Vercel (SvelteKit adapter-auto)
  • Backend: Deploy to Railway or Fly.io (Node.js environment)
  • Database: Use Railway PostgreSQL or Supabase
  • Redis: Use Upstash Redis
  • ChromaDB: Deploy to Railway or use Chroma Cloud

Self-Hosted

  • Use the provided docker-compose.yml as a starting point
  • Configure Nginx reverse proxy with SSL (Let's Encrypt)
  • Set up proper environment variable management
  • Enable backup for PostgreSQL and ChromaDB

Testing

# Run all tests
npm test

# Run backend tests only
cd backend && npm test

# Run with coverage
npm test -- --coverage

Contributing

We welcome contributions to ContextWeave AI!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Run linting and tests (npm run lint && npm test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Workflow

# Setup
git clone https://github.com/yethikrishna/contextweave-ai.git
cd contextweave-ai
npm install
cp .env.example .env
docker-compose up -d postgres redis chromadb
npm run db:migrate
npm run db:generate
npm run dev

License

This project is licensed under the MIT License — see the LICENSE file for details.

Related Projects

  • SvelteKit — The fastest way to build Svelte apps
  • Prisma — Next-generation Node.js and TypeScript ORM
  • ChromaDB — Open-source embedding database for AI
  • OpenAI — GPT-4o and embedding models
  • Anthropic — Claude AI models
  • Socket.IO — Real-time bidirectional event-based communication
  • Stripe — Payment infrastructure for the internet
  • Tailwind CSS — Utility-first CSS framework
  • Vite — Next-generation frontend tooling

About

ContextWeave AI — Production-ready orchestration platform for context-aware AI applications. SvelteKit + Express, ChromaDB vector search, Stripe billing, WebSocket collaboration.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages