An API for a retroactive compensation system, built with Cloudflare Workers and Cloudflare D1.
Used template for Cosmos wallet authentication to authenticate requests via a Cosmos wallet signature.
Read through the design spec here.
npm run dev
# OR
wrangler dev --local --persist
-
Copy
wrangler.toml.example
towrangler.toml
. -
Create KV namespaces for production and development:
wrangler kv:namespace create NONCES
wrangler kv:namespace create NONCES --preview
- Update the binding IDs in
wrangler.toml
:
kv-namespaces = [
{ binding = "NONCES", id = "<INSERT NONCES_ID>", preview_id = "<INSERT NONCES_PREVIEW_ID>" }
]
- Create D1 database for production:
wrangler d1 create DB
- Update the binding ID in
wrangler.toml
:
[[ d1_databases ]]
binding = "DB"
database_name = "DB"
database_id = "<INSERT DB_ID>"
- Seed the database with:
npm run seed
# OR
wrangler d1 execute DB --file=./schema.sql
- Seed the local database with:
npm run seed:local
# OR
wrangler d1 execute DB --file=./schema.sql --local
wrangler publish
# OR
npm run deploy