Secure, single‑service application for Chat, Notes, and Files on Google Cloud. Toolkits combines a FastAPI backend and a React + Tailwind frontend with end‑to‑end encryption (AES‑GCM) and JWT (HS256) authentication. Deploys as a single App Engine service.
- JWT auth (HS256) with access/refresh tokens.
- AES‑GCM request/response encryption using
encrypted_datapayloads. - Chat with streaming responses (SSE responses are not encrypted).
- Encrypted Notes: create, edit, list with server‑side encryption.
- Files on GCS: upload (file/URL), list, rename, delete, download, toggle public/private.
- Single App Engine deployment serving both API and static frontend.
backend/FastAPI app, middleware, routers, services.frontend/React + Tailwind app (Create React App).app.yamlApp Engine service config (servesfrontend/buildand proxies API).PRD.md,DESIGN.md,PLAN.mdproduct and technical docs.
Prerequisites
- Python 3.13 (local 3.11+ works), Node.js 18+, npm
- gcloud CLI configured for your project
- A GCS bucket for file storage
- Backend
- Create and populate
backend/.env(seebackend/.env.example). Add/confirm:GOOGLE_API_KEY,GOOGLE_CLOUD_PROJECT,GCS_BUCKETJWT_SECRET_KEY,USERNAME,PASSWORD_HASH,JWT_ACCESS_EXPIRE_MINUTES,JWT_REFRESH_EXPIRE_DAYSAES_KEY_HASH(required for encryption)
- Install deps and run the API:
python -m venv .venv && . .venv/bin/activate(PowerShell:.venv\Scripts\Activate)pip install -r requirements.txtuvicorn backend.main:app --reload
- Frontend
- In
frontend/, set the API base URL (Create React App):- Create
frontend/.envwithREACT_APP_API_URL=http://localhost:8000
- Create
- Install deps and start dev server:
npm cinpm start
- Sign In and Encryption
- Sign in with
USERNAMEand the password that matchesPASSWORD_HASH. - Open the Settings page to configure the AES key hash (
localStorage.aes_key_hash) used for encrypting/decrypting payloads.
Environment variables
- Auth:
JWT_SECRET_KEY,USERNAME,PASSWORD_HASH,JWT_ACCESS_EXPIRE_MINUTES,JWT_REFRESH_EXPIRE_DAYS - Encryption:
AES_KEY_HASH - GCP:
GOOGLE_CLOUD_PROJECT,GCS_BUCKET,GOOGLE_API_KEY - Optional:
AUTH_RATE_LIMIT,CHAT_RATE_LIMIT,DEBUG
Frontend
REACT_APP_API_URLpoints the UI at your backend (e.g.,http://localhost:8000).- The frontend stores the AES key hash in
localStorage.aes_key_hash.
- Auth:
POST /auth/login,POST /auth/refresh,POST /auth/logout,GET /auth/me - Chat:
/api/chat,/api/conversations(SSE is unencrypted by design) - Notes:
/api/notes(CRUD; payloads useencrypted_data) - Files:
/api/filesoperations plusupload,download,toggle-share - Encryption wire format: JSON
{ "encrypted_data": "..." }
See PRD.md:1, DESIGN.md:1, PLAN.md:1 for details.
- Backend unit tests: from repo root run
pytest -q - Keep tests fast and focused; see
backend/tests.
- Build the frontend so
frontend/buildexists:cd frontend && npm ci && npm run build
- Deploy the service from repo root:
gcloud app deploy
- Ensure required env vars are set in App Engine (see
app.yamland the variables above).
- Do not log secrets; configure through environment variables only.
- SSE responses (chat streaming) must remain unencrypted.
- AES‑GCM server key is derived from
AES_KEY_HASH; the frontend key hash lives inlocalStorage.aes_key_hash.
- Use clear, typed API contracts and keep changes minimal.
- Follow existing Python and React/Tailwind patterns.
- Update or add adjacent unit tests when modifying routers/services.
- Before significant changes, coordinate via
DESIGN.mdandPLAN.md.
No license file is included. If you intend to open‑source this project, add a license (e.g., MIT or Apache‑2.0).
- Product Requirements:
PRD.md:1 - Technical Design:
DESIGN.md:1 - Implementation Plan:
PLAN.md:1 - App Engine Config:
app.yaml:1
