AppForge is an AI website builder: you describe a site in plain English, an LLM classifies the project and generates a working React + TypeScript codebase, and the resulting app runs live in your browser via WebContainer — with a split-pane editor, file tree, and running preview — no third-party hosting needed for the generated site.
- Frontend —
apps/fe: Vite 5 + React 19 + TypeScript, Tailwind, shadcn/ui, Monaco editor,@webcontainer/apifor in-browser runtime,react-router-dom. Cross-origin isolation (COOP/COEP) is required for WebContainer and is set in both dev (vite.config.ts) and prod (apps/fe/serve.ts). - Backend —
apps/api: Express 5 on Bun. Endpoints:POST /template— classifies a prompt and returns a project template (non-streamed).POST /chat— streams a full multi-file project generated from the prompt.GET /projects,POST /projects,GET /projects/:id,PUT /projects/:id,DELETE /projects/:id— saved projects CRUD (Prisma + Neon).GET /— health ({"status":"ok"}).POST /template,POST /chat, and the/projectsrouter all requireAuthorization: Bearer <Clerk JWT>.- OpenRouter-backed LLM calls (secret injected at deploy time, never committed).
- Monorepo — Turborepo + Bun workspaces; shared
packages/ui,packages/db,packages/typescript-config,packages/eslint-config. - Auth + Storage — Clerk (Google/GitHub OAuth, hosted pages) for user authentication;
Neon Postgres (free tier) via Prisma 7 (
packages/db) for saved projects.
apps/
api/ Express + Bun backend (Dockerfile, PORT-aware)
fe/ React SPA + bun static server (Dockerfile, serve.ts)
packages/
ui/ shared UI components
db/ Prisma 7 schema + types (Neon Postgres)
typescript-config/ eslint-config/
cloudbuild/
api.yaml Cloud Build steps: build+push image, gcloud run deploy appforge-api
fe.yaml same for appforge-fe (bakes VITE_BACKEND_URL)
deployment.md GCP deployment plan + gotchas (gitignored, not in git)
Requirements: Node >= 18, bun 1.x.
- Set env files (copy from
.env.example):apps/api/.env:OPENROUTER_API_KEY=...,CLERK_SECRET_KEY=...,DATABASE_URL=postgres://...(Neon)apps/fe/.env:VITE_BACKEND_URL=http://localhost:3000,VITE_CLERK_PUBLISHABLE_KEY=pk_...
- Install + run:
bun install bun run dev # api on :3000, fe on :8080
bun run build # turbo run build
bun run dev # turbo run dev
bun run lint # turbo run lint
bun run check-types # turbo run check-types
bunx turbo run test # vitest suite (apps/fe)- Both services run on Cloud Run in
asia-south1(scale-to-zero, memory/cpu sized to fit the free tier), images in Artifact Registry. - Continuous deployment: a push to
mainfires Cloud Build triggersapi-deployandfe-deploy, which rebuild + redeploy both services automatically. (Cloud Build SA must be a user-managed SA; seedeployment.mdgotchas.) - Secrets:
OPENROUTER_API_KEY,CLERK_SECRET_KEYand the NeonDATABASE_URLlive in Secret Manager (openrouter_api_key,clerk_secret_key,neon_database_url, asia-south1) and are injected via--set-secrets. - Custom domain: Cloudflare DNS + a Cloudflare Worker reverse-proxy forwards
the branded subdomains to the Cloud Run services (see
deployment.mdPhase 3.6). - Auth: the FE bakes the public
VITE_CLERK_PUBLISHABLE_KEYat build time (build arg incloudbuild/fe.yaml); users sign in on Clerk hosted pages and the API verifies each request's session JWT with@clerk/backend.
| Component | URL |
|---|---|
| Frontend | https://appforge.byaniket.site |
| Backend | https://appforge-api.byaniket.site |
| FE origin (Cloud Run) | https://appforge-fe-500273261728.asia-south1.run.app |
| API origin (Cloud Run) | https://appforge-api-500273261728.asia-south1.run.app |
The one-time GCP + Cloudflare infra (zone, SSL, Search Console verification, worker
appforge-proxy, wildcard route *byaniket.site/*) is shared and already done. To put a
new project N at N.byaniket.site + api-N.byaniket.site: deploy its FE/API to Cloud Run
in asia-south1, add 2 proxied CNAMEs in the Cloudflare dashboard, and add 2 lines to the
worker's ORIGINS map. The full, self-contained runbook is deployment.md (gitignored):
copy it into the new project's local repo and point your opencode terminal at it
(see its "How to use this file" and Phase 3.7).
Identical services at scale-to-zero + Cloud Build free tier + Cloudflare free plan + OpenRouter (cents per call on DeepSeek models) → effectively ~$0/month.
- Do not run
POST /templateorPOST /chatcasually — each OpenRouter call consumes credits. Ask before hitting them. - Region policy: all GCP resources stay in
asia-south1unless explicitly documented otherwise indeployment.md.