InkVerse is a React + Vite app prepared for deployment on Cloudflare Pages.
- React 19 + React Router 7
- Vite 8
- Cloudflare Pages Functions
- Cloudflare D1 (relational data)
- Cloudflare R2 (image/text file objects)
The app now has working signup and login flow backed by D1.
POST /api/auth/signupPOST /api/auth/loginGET /api/auth/me(Bearer token)
Passwords are hashed with PBKDF2 via Web Crypto before storage.
Successful login/signup creates a session token in the Sessions table.
Frontend pages wired to this flow:
src/pages/Signup.jsxsrc/pages/Login.jsxsrc/pages/Bookmarks.jsx
schema.sql includes:
UsersStoriesSessionsStoryAssets(metadata for objects stored in R2)BookmarksLikesComments
Use D1 for structured relational data and R2 for binary/object content.
- Store image and chapter text files in R2.
- Store metadata and object keys in D1 (
StoryAssets.storage_key).
wrangler.toml bindings:
DBfor D1ASSETSfor R2 bucket
- Install dependencies:
npm install- Apply schema to local D1 database:
npx wrangler d1 execute inkverse-db --local --file=schema.sql- Start Cloudflare Pages dev (recommended when testing Functions + D1 + R2):
npx wrangler pages dev dist --d1=DB --r2=ASSETS- In another terminal, build and serve via Vite when needed:
npm run devFor full Pages-function parity, prefer wrangler pages dev for API testing.
- Build command:
npm run build - Output directory:
dist - Ensure D1 and R2 are configured in Cloudflare dashboard and match bindings.