AI Workspace
A self-hosted AI platform: multi-model chat with tools, long-term memory, automations, messaging channels and a desktop app — all running on your own infrastructure.
3 min read
Stack
- FastAPI
- Postgres 16 + pgvector
- Next.js 14
- Docker Compose
- Tauri
- SIFT
Under active development. The repository is private for now, so there's no public link — what's described here is the project's current state.
The problem
Every hosted AI chat platform charges the same hidden price: your context. The conversations, the documents you upload, the integration keys and the memory the model builds up about you all live on someone else's infrastructure.
AI Workspace inverts that. It runs entirely in Docker Compose on your machine or your VPS, and the only outbound traffic is the call to the model provider and whatever you tell the tools to reach. Secrets are stored encrypted at rest in the database.
It isn't a chat wrapper. It's the whole stack.
What's inside
Chat and models
Multi-model through OpenRouter — any OpenAI-compatible model — plus local models via Ollama. Streaming is resumable: closing the tab or hitting F5 doesn't cancel the generation.
Each custom model carries its own prompt, parameters, tools, capabilities, filters, voice, memory and sub-agents. In practice, it's building your own "GPT".
Two modes step outside linear chat: the round table, with several models talking to each other while you steer, and sub-agents, where an orchestrator delegates to worker models sequentially or in parallel.
Tools
Tool-calling runs on SIFT — the other project of mine in this list. Web search, page reading, an AI-driven headless browser, charts, diagrams, quotes, video and audio transcription, and Python code written by the AI itself, executed in an isolated sandbox with CPU and memory limits.
Memory and knowledge
Long-term memory through mem0, scoped globally, per model or per chat, with shareable stores. Alongside it, a knowledge base with RAG over pgvector, answering with source citations.
The second brain keeps interlinked notes in a graph, and a background review proposes new memories and skills — always going through your approval first.
Automation and channels
Schedules and monitors for price, page, search and RSS, notifying you in the app, via Web Push or through the channels. You talk to your models over WhatsApp, Telegram and Discord, and each conversation becomes a chat in the sidebar.
Platform
An OpenAI-compatible public API at /v1/chat/completions, with per-user keys, limits,
quotas, cost control and per-key memory. Every request becomes a trace carrying latency,
database time, reads and writes and LLM calls, in a waterfall panel.
Architecture
A monorepo with four pieces:
| Directory | What it is |
|---|---|
apps/server | FastAPI — auth, turn orchestrator, SIFT, mem0, RAG, integrations, /v1 API |
apps/web | Next.js App Router — chat, workspace, settings |
desktop | Tauri shell — native window, tray icon, autostart |
infra/ | Configuration for the optional services |
Postgres 16 with pgvector holds data and vectors in the same place — a deliberate call, to avoid keeping a separate vector database alive.
Heavy features come up on demand through Compose profiles: self-hosted search with SearXNG, local voice with Kokoro, WhatsApp through Evolution, headless browsing with browserless. If you don't use them, you don't pay for having them running.
Security
The whole point is trusting it with sensitive data, so this couldn't be deferred:
- Passwords with Argon2; sessions as a JWT in an httpOnly cookie, with a rotating
refresh and a
token_versionto revoke every session at once; optional 2FA (TOTP). - Per-user secrets encrypted with Fernet, keyed from
APP_SECRET, plus a rotation tool that re-encrypts the entire database. - Restricted CORS, security headers on every response, HSTS under HTTPS, and rate limiting on login, registration and the public API.
- Under
APP_ENV=production, the server refuses to start with a weakAPP_SECRET.
Current state
Working end to end, with a Windows desktop app built by CI on every release. Migrations run automatically when the server starts. What's left is the decision I haven't made yet: which license to adopt before opening the repository.