A lean, fully-local Single-Page App that lets you:
- Chat with either OpenAI or Anthropic (token-streamed).
- Upload reference files the back-end can later vectorise.
- Persist chat history in the browser (no server DB).
Why local? Zero cloud services, zero build tools β perfect for rapid prototyping or an internal proof-of-concept before you wire up Auth0, Entra ID, or Azure Functions.
workspaces/
ββ spa/ # static front-end (vanilla JS)
β ββ index.html
β ββ styles.css
β ββ app.js
ββ api/ # FastAPI back-end
β ββ main.py
β ββ models.py
β ββ provider.py
β ββ requirements.txt
β ββ uploads/ # receives files (in .gitignore)
ββ .env.example # β copy β api/.env
ββ README.md
# 1 β clone
git clone https://github.com/<your-org>/workspaces.git
cd workspaces
# 2 β back-end
cd api
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp ../.env.example .env # paste your provider keys here
uvicorn main:app --reload --port 8080 &
cd ..
# 3 β front-end (static)
cd spa
python -m http.server 3000 & xdg-open http://localhost:3000 # macOS: open# Replace these commands for Windows:
# 1. Replace source .venv/bin/activate with .venv\Scripts\Activate.ps1
# 2. Replace xdg-open with Start-Process| Key | Example | Notes |
|---|---|---|
| OPENAI_API_KEY | sk-β¦ | Any valid OpenAI or Azure OpenAI key |
| OPENAI_API_BASE | https://api.openai.com/v1 | For Azure: https:///openai/deployments/ |
| ANTHROPIC_API_KEY | anthropic-β¦ | Sign up at console.anthropic.com |
| SPA_ORIGIN | http://localhost:3000 | Front-end origin allowed by CORS |
Copy .env.example β api/.env, then paste real keys.
| Feature | How |
|---|---|
| Auth0 / Entra ID | Add MSAL/Auth0 to spa/app.js; verify JWT in api/main.py with python-jose. |
| Vector search | Pipe files in uploads/ through LangChain β FAISS or Azure AI Search. |
| Docker dev | See docker-compose.yml snippet below. |
| Model selection | Front-end passes "provider":"anthropic" (default is OpenAI). |
π³ Minimal docker-compose.yml
version: "3.9"
services:
api:
build: ./api
env_file: ./api/.env
ports: ["8080:8080"]
spa:
image: nginx:alpine
volumes: ["./spa:/usr/share/nginx/html:ro"]
ports: ["3000:80"]| Symptom | Fix |
|---|---|
| 401 Invalid API key | Double-check you pasted keys into api/.env and restarted Uvicorn. |
| Browser blocks SSE | Confirm both servers run on localhost ports 3000 & 8080; CORS header comes from SPA_ORIGIN. |
| Upload >1 MB stalls | FastAPI default body limit is inherited from Uvicorn (no hard cap); likely a proxy/browser issue. |
MIT. See LICENSE file.
Β© 2025 Workspaces team β Making meetings productive again.