Skip to content

feat: improve local development setup with integrated Miniflare #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2025

Conversation

nullcoder
Copy link
Owner

Summary

Enhanced local development experience by leveraging Wrangler's integrated Miniflare v3 for Cloudflare Workers simulation.

Key Findings

After researching Miniflare and Wrangler in 2024:

  • Miniflare v3 is already integrated into Wrangler 4.x (which we use)
  • No separate Miniflare installation needed
  • Uses workerd runtime for production parity
  • 10x faster startup, 60x faster reload vs remote development

Changes Made

1. Enhanced Development Scripts (package.json)

  • npm run cf:dev - Direct wrangler dev access
  • npm run preview - Build + local Cloudflare simulation (with state persistence)
  • npm run preview:remote - Build + remote Cloudflare resources
  • npm run deploy:staging - Deploy to staging environment
  • npm run cf:tail - Tail production logs

2. Documentation

  • Created docs/LOCAL_DEVELOPMENT.md with comprehensive setup guide
  • Updated README.md with quick start instructions
  • Updated CLAUDE.md with new development commands
  • Created docs/MINIFLARE_DECISION.md documenting our research

3. Local Development Features

  • ✅ R2 bucket simulation (no charges)
  • ✅ KV namespace simulation (when enabled)
  • ✅ State persistence in .wrangler/state
  • ✅ Environment-specific configuration
  • ✅ Local secrets via .dev.vars

Development Workflows

# UI development with hot reload
npm run dev

# Full Cloudflare Workers simulation
npm run preview

# Test with production resources
npm run preview:remote

Testing

  • Verified wrangler dev works with R2 bindings
  • Confirmed state persistence between restarts
  • Tested both local and remote development modes
  • Documentation is clear and comprehensive

Closes #29

🤖 Generated with Claude Code

Enhanced local development experience by leveraging Wrangler's integrated
Miniflare v3 for Cloudflare Workers simulation:

- Updated package.json scripts for better development workflow
  - Added cf:dev for direct wrangler access
  - Added state persistence with --persist-to flag
  - Added preview:remote for production resource testing
  - Added staging deployment script
- Created comprehensive LOCAL_DEVELOPMENT.md guide
- Updated README.md with quick start instructions
- Documented Miniflare decision in MINIFLARE_DECISION.md

Key findings:
- Miniflare v3 is already integrated in Wrangler 4.x
- No separate installation needed
- Local simulation with workerd provides production parity
- 10x faster startup, 60x faster reload vs remote development

Closes #29

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <claude@ghostpaste.dev>
Copy link

cloudflare-workers-and-pages bot commented Jun 6, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ghostpaste 70fb1a7 Visit preview Jun 06 2025, 07:18 AM

- Marked all TypeScript interface tasks as completed (PR #26)
- Marked local development with Miniflare as completed (PR #29)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <claude@ghostpaste.dev>
@nullcoder nullcoder merged commit 70fc010 into main Jun 6, 2025
1 check was pending
@nullcoder nullcoder deleted the feat/local-development-setup branch June 6, 2025 07:18
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.

Configure Miniflare for local Cloudflare Workers development
1 participant