Cloudflare starter module
D1 and R2
Centralizes typed database queries, file storage helpers, and Cloudflare bindings.
- Files
- 7
- Lines
- 719
- Languages
- TypeScript
Included files
This page lists paths and purposes, not source contents.
src/lib/app-adapter.ts
Connects generic Cloudflare handlers to your app's identity and domain reactions.
TypeScript
88 lines
src/lib/bindings.ts
Centralizes access to Cloudflare bindings for every route and storage helper.
TypeScript
44 lines
src/lib/d1.ts
Implements typed, parameterized D1 queries over the shipped migration.
TypeScript
360 lines
src/lib/demo-identity.ts
Provides demo bearer-token identity for the first local end-to-end run.
TypeScript
37 lines
src/lib/env.ts
Reads Worker and setup-script settings and rejects missing or unsafe values.
TypeScript
49 lines
src/lib/r2.ts
Stores and streams customer files through customer-scoped R2 object keys.
TypeScript
69 lines
src/lib/types.ts
Defines the shared records and adapter operations used across the starter.
TypeScript
72 lines
Questions about d1 and r2
Does it include Cloudflare D1 and R2 examples?
Yes. It shows how trusted server routes read and write D1 records, store R2 files, and keep customer data separated.