Add Teenybase to an Existing Project
You already have a frontend or app and want to add a teenybase backend.
Using a coding agent?
Create a backend folder
Run create inside your project root. This creates a self-contained backend directory with its own package.json, teenybase.ts, worker entry point, and dev secrets.
bash
npx teenybase create backend --yes
cd backend
npx teenybase deploy --local --yes
npx teenybase devYour backend API is at http://localhost:8787/api/v1.
Your project structure looks like this:
text
my-app/
src/ # your frontend
backend/ # teenybase backend (self-contained)
teenybase.ts
src/index.ts
wrangler.jsonc
.dev.vars
package.jsonWhy a separate folder
- The backend has its own dependencies (
teenybase,hono,wrangler). Keeping them separate avoids conflicts with your frontend'spackage.json. npx teenybase deployandnpx teenybase devrun from the backend directory. No config needed to tell them where to find things.- You can version, deploy, and test the backend independently.
- If you use a monorepo tool (npm workspaces, turborepo, etc.), the backend folder is just another workspace.
Deploy
Deploy the backend to your own Cloudflare account:
bash
cd backend
npx wrangler login # one-time
npx teenybase deploy --remote --yesNext steps
- Quickstart for a full walkthrough
- Connect Your Frontend for fetch examples, auth flow, CRUD
- Integrate into an existing Hono worker if you need teenybase mounted inside an existing Cloudflare Worker instead of a separate folder