Copy .dev.vars.example
to .dev.vars
and set the OpenAI API key.
Run the dev server, which runs both vite and wrangler servers in dev mode. You could use wrangler only but then you lose vite dev mode advantages like HMR etc, hence the duality. It's due to the fact that vite currently doesn't support websockets, nor cloudflare worker environment fully natively. TODO: Improve this as soon as vite supports it.
Note that the websocket proxy of vite is running on a fixed port 5174 (ie +1 of 5173, the vite default) so if there's something running on it, you'll get an error.
bun run dev
Generate types for your Cloudflare bindings in wrangler.toml
:
bun run typegen
You will need to rerun typegen whenever you make changes to wrangler.toml
.
bun test
First, build your app for production:
bun run build
Set the OpenAI API key secret for production:
bunx wrangler secret put OPENAI_API_KEY
Then, deploy your app to Cloudflare Pages:
bun run deploy
We use Tailwind CSS and schadcn/ui.