Files
userbase/examples/cloudflare-worker/README.md
T
shishantbiswas 0bfcb5ad71
Run Tests / test (pull_request) Successful in 4m57s
bknd is dead long live userbase
2026-09-27 19:34:06 +05:30

38 lines
1.2 KiB
Markdown

# userbase starter: Cloudflare Workers
A minimal Node.js project with userbase integration.
## Project Structure
Inside of your Node.js project, you'll see the following folders and files:
```text
/
├── src/
│ └── index.ts
├── package.json
└── wrangler.json
```
To update `userbase` config, check `src/index.ts`.
## Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
|:------------------|:---------------------------------------------------------|
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server with `watch` at `localhost:8787` |
| `npm run typegen` | Generates wrangler types |
## Before you deploy
If you're using a D1 database, make sure to create a database in your cloudflare account and replace the `database_id` accordingly in `wrangler.json`.
```sh
npx wrangler d1 create my-database
```
## Want to learn more?
Feel free to check [our documentation](https://docs.userbase.io/integration/cloudflare) or jump into our [Discord server](https://discord.gg/952SFk8Tb8).