Skip to content

feat: align local API dev with Cloudflare storage#47

Merged
codemountains merged 3 commits into
mainfrom
feature/issue-35-cloudflare-local-dev
Jul 10, 2026
Merged

feat: align local API dev with Cloudflare storage#47
codemountains merged 3 commits into
mainfrom
feature/issue-35-cloudflare-local-dev

Conversation

@codemountains

Copy link
Copy Markdown
Owner

Summary

  • enable local D1/R2 bindings in apps/api/wrangler.toml while keeping Durable Objects configured for endpoint stream coordination
  • make just dev-api apply local D1 migrations and start wrangler dev --persist-to .wrangler/state
  • add a focused config regression test plus local Cloudflare development docs for D1/R2 inspection and reset workflows

Closes #35

Verification

  • TDD red: pnpm --filter @barestash/api test -- src/wrangler-config.test.ts failed before enabling persisted dev/bindings
  • TDD green: pnpm --filter @barestash/api test -- wrangler-config.test.ts
  • pnpm --filter @barestash/api run db:migrate:local
  • pnpm --filter @barestash/api run dev showed local D1, R2, and Durable Object bindings
  • local API smoke: create temporary endpoint, ingest request, list event, show event, fetch body
  • restart persistence smoke: restart pnpm --filter @barestash/api run dev, fetch the same persisted event/body again
  • local inspection smoke: wrangler d1 execute ... --local --persist-to .wrangler/state and wrangler r2 object get ... --local --persist-to .wrangler/state --pipe
  • git diff --check
  • just check

Review

  • requested a code-reviewer subagent review after changes
  • addressed low-severity feedback by narrowing Durable Object persistence wording and expanding the config test to assert local migration runs before dev with the same persisted state path

Risk

  • production D1 database_id remains a placeholder and must be replaced when deploying against real Cloudflare resources; this PR targets local development without requiring a Cloudflare account.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4eb4e0bd3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/api/wrangler.toml
@codemountains codemountains merged commit 806c060 into main Jul 10, 2026
2 checks passed
@codemountains codemountains deleted the feature/issue-35-cloudflare-local-dev branch July 10, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Align local development with Cloudflare D1/R2/DO behavior

1 participant