Thanks to visit codestin.com
Credit goes to docs.b3-cf-stack.bbyb.dev

Skip to content

Usage

Commands

CommandDescription
bun run devRun all workspaces in dev mode (Turbo)
bun run buildBuild all workspaces
bun run typecheckTypeScript check across all workspaces
bun run lintBiome lint
bun run formatBiome format
bun run testRun all tests
bun run knipDead code analysis
bun run cf:devStart the Worker locally
bun run cf:deployBuild SPA + deploy Worker
bun run db:generateGenerate Drizzle migrations
bun run db:migrateApply migrations locally
bun run db:migrate:remoteApply migrations to remote D1

Adding a new API route

  1. Create a route file in apps/api/src/routes/:
ts
import { Hono } from 'hono'
import { superjson } from 'superjson'
import type { Env } from '../lib/types'

const items = new Hono<Env>()

items.get('/', (c) => {
  return c.json(superjson.serialize({ items: ['a', 'b', 'c'] }))
})

export { items as itemsRoutes }
  1. Register it in apps/api/src/app.ts:
ts
.route('/items', itemsRoutes)
  1. Use it from the frontend:
ts
import { client, unwrap } from '../../lib/rpc'
const data = await unwrap(client.items.$get())

Adding a new page

  1. Create a route directory and page:
bash
mkdir apps/web/src/routes/about
  1. Create page.tsx:
tsx
export function AboutPage() {
  return <div><h1>About</h1></div>
}
  1. Add to apps/web/src/app.tsx:
tsx
<Route path="/about" element={<AboutPage />} />