ThinkSpace is a full-stack project with:
- a React + Vite frontend in
frontend/ - a FastAPI backend in
backend/ - optional infrastructure and deployment automation in
infra/and.github/workflows/
This README is focused on helping you run the project locally first, then optionally enable CI/CD later.
For the most complete system overview, read docs/thinkspace-end-to-end-technical-architecture.md.
If you want to understand how the full ThinkSpace platform fits together end to end, this is the primary architecture document and should be read before the infrastructure and deployment details below.
ThinkSpace/
|- frontend/ # React + Vite app
|- backend/ # FastAPI app
|- infra/ # Terraform for GCP infrastructure
`- .github/ # GitHub Actions workflows
ThinkSpace uses tldraw as a third-party dependency for the canvas experience.
Important notes:
tldrawis not custom code owned by this repository; it is third-party code integrated into the frontend.- for the GCP deployed application, we are using a
tldrawtrial license with a validity of 100 days - for local development, no separate
tldrawlicense is needed
Cloudflare deployment is required only for the production application when you want the hosted /stream endpoint for the canvas agent.
For local testing:
- Cloudflare deployment is not required
- you can run the frontend and backend locally without deploying the Cloudflare worker
- local testing of the main frontend and backend flows does not depend on production Cloudflare infrastructure
Install these before you begin:
- Node.js 20 or newer
- npm
- Python 3.10 or newer
uvfor Python dependency management
Install uv if needed:
curl -LsSf https://astral.sh/uv/install.sh | shgit clone https://github.com/trishulam/ThinkSpace
cd ThinkSpaceThe backend runs on http://localhost:8000 by default.
- Create
backend/app/.envwith at least:
GOOGLE_GENAI_USE_VERTEXAI=FALSE
GOOGLE_API_KEY=your_google_api_key_here
DEMO_AGENT_MODEL=gemini-2.5-flash-native-audio-preview-12-2025- Install backend dependencies and run the server:
cd backend
./start_backend.shThat script will:
- install locked dependencies with
uv - start FastAPI with auto-reload
- serve the backend on port
8000
If you prefer the manual command:
cd backend
uv sync --locked
PYTHONPATH=app uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Open a second terminal:
cd frontend
npm ciCreate frontend/.env.local:
VITE_AGENT_BACKEND_URL=ws://localhost:8000
VITE_SESSION_API_BASE_URL=http://localhost:8000
# Optional: enable session recording inside the canvas flow
VITE_ENABLE_SESSION_RECORDING=falseIf you want to use the canvas agent, also create frontend/.dev.vars:
GOOGLE_API_KEY=your_google_api_key_hereOptional:
VITE_TLDRAW_AGENT_STREAM_URL=https://your-worker-url/streamSet VITE_ENABLE_SESSION_RECORDING=true only if you want the canvas session flow to capture a recording. By default this flag is false.
Then run the frontend:
npm run devThe frontend will be available at http://localhost:5173.
For the frontend:
VITE_AGENT_BACKEND_URL: WebSocket URL for live backend sessionsVITE_SESSION_API_BASE_URL: REST API base URL for dashboard and session APIsVITE_TLDRAW_AGENT_STREAM_URL: canvas agent stream endpointVITE_ENABLE_SESSION_RECORDING: enables recording during the session canvas flow; default isfalsefrontend/.dev.vars: required for the canvas agent worker locally; at minimum setGOOGLE_API_KEY
If VITE_ENABLE_SESSION_RECORDING=true, the canvas session waits for recording to start and captures the session recording flow. If it is false, the live session can continue without recording.
For the backend:
GOOGLE_API_KEY: required for Gemini featuresGOOGLE_GENAI_USE_VERTEXAI: set toFALSEfor API key usage,TRUEfor Vertex AIDEMO_AGENT_MODEL: optional model override
Not for basic frontend + backend local development.
Cloudflare deployment is only required for the production application.
For local testing, you do not need to deploy the Cloudflare worker. If you want to use the canvas agent locally, make sure frontend/.dev.vars exists. If you also want canvas session recording, set VITE_ENABLE_SESSION_RECORDING=true in frontend/.env.local. You only need VITE_TLDRAW_AGENT_STREAM_URL when you specifically want the /canvas flow to use a deployed /stream endpoint.
- Frontend:
http://localhost:5173 - Backend HTTP:
http://localhost:8000 - Backend WebSocket base:
ws://localhost:8000
Once both services are running:
- Open
http://localhost:5173 - Confirm the frontend loads
- Confirm backend-backed pages can create or fetch session data
- If using live sessions, verify the frontend can connect to
ws://localhost:8000
Frontend:
cd frontend
npm run dev
npm run build
npm run typecheckBackend:
cd backend
uv sync --locked
./start_backend.shCI/CD is optional. You can keep this project as local-only, or enable GitHub Actions for automated checks and deployments.
Choose this if you only want local development.
No extra setup is required for local work.
If this repository is hosted on GitHub and you want to stop workflows from running:
- disable GitHub Actions for the repository in GitHub settings, or
- disable individual workflows from the GitHub Actions tab
In this mode, you can still build and run everything locally using the steps above.
This repository already includes these workflows:
.github/workflows/ci.yml.github/workflows/deploy-gcp.yml.github/workflows/deploy-cloudflare-worker.yml
ci.yml
- installs frontend dependencies
- typechecks and builds the frontend
- syncs backend dependencies
- compiles backend Python sources
- validates Terraform formatting and configuration
deploy-gcp.yml
- builds backend and frontend container images with Cloud Build
- deploys backend and frontend to Cloud Run
- runs smoke checks after deployment
deploy-cloudflare-worker.yml
- syncs the worker secret from Google Secret Manager
- deploys the Cloudflare Worker used for the production
/streamendpoint
Make sure the code is in a GitHub repository where Actions are enabled.
Before enabling deployment workflows, make sure the infrastructure is ready.
Use the Terraform setup in infra/README.md to provision:
- Artifact Registry
- Cloud Run
- Firestore
- Cloud Storage
- Secret Manager
- Cloud SQL
Add these repository variables in GitHub:
GCP_WORKLOAD_IDENTITY_PROVIDERGCP_SERVICE_ACCOUNT_EMAILCLOUDFLARE_ACCOUNT_ID
Add this repository secret in GitHub:
CLOUDFLARE_API_TOKEN
The Google service account referenced by GCP_SERVICE_ACCOUNT_EMAIL must be allowed to:
- run Cloud Build
- deploy to Cloud Run
- access Secret Manager
- use Artifact Registry
- run Terraform against the target project
You also need a Workload Identity Provider that trusts your GitHub repository.
At minimum, make sure the Google API key secret exists in Secret Manager.
Example:
printf '%s' 'YOUR_GOOGLE_API_KEY' | gcloud secrets versions add thinkspace-google-api-key --data-file=-Recommended rollout:
- Enable
ci.ymlfirst - Confirm pull requests and pushes pass basic checks
- Enable
deploy-gcp.ymlafter infrastructure is ready - Enable
deploy-cloudflare-worker.ymlwhen the worker deployment is needed
For most teams, this is the simplest approach:
- Use local setup for development
- Enable
ci.ymlfirst for validation on pull requests - Keep deploy workflows disabled until cloud credentials and infra are ready
- Enable deployment workflows only after a successful manual infrastructure setup
Check:
- backend is running on port
8000 frontend/.env.localpoints tows://localhost:8000andhttp://localhost:8000- you restarted the frontend dev server after changing environment variables
Check:
- Python version is
3.10+ uvis installedbackend/app/.envexistsGOOGLE_API_KEYis set if Gemini features are used
Check:
- GitHub Actions variables and secrets are configured
- GCP Workload Identity is set up correctly
- required GCP resources already exist
- Cloudflare account and token are valid
frontend/README.mdfor frontend-specific detailsbackend/README.mdfor backend-specific detailsinfra/README.mdfor GCP and Terraform setup


