POST /api/poststo create a postGET /api/public/poststo list published postsGET /api/posts/:idto read one postPOST /api/upload-urlto issue a presigned R2 upload URLPOST /api/webhooks/notifyto accept a signed webhook
Step 1: Define your schema
Editserver/src/defs/db_schema.ts:
server/src/defs/db_schema.ts
Step 2: Declare a storage bucket
Editserver/src/defs/storage_schema.ts:
server/src/defs/storage_schema.ts
Step 3: Declare and register a secret
First allow the key inserver/src/defs/runtime.ts:
server/src/defs/runtime.ts
Step 4: Write the server routes
Replaceserver/src/index.ts:
server/src/index.ts
Step 5: Deploy your project
New projects currently deploy to one default production environment. Public staging support is coming soon.
Step 6: Upload from the client
Use your frontend to request a presigned upload URL, then upload directly to R2:web/src/upload.ts
See also
Use the database
Define schema, generate migrations, and query D1 in the current scaffold.
Use storage
Declare buckets, apply them with the CLI, and use presigned upload URLs.