Skip to content

feat: Configure Cloudflare Workers environment #16

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 3 commits into from
Jun 5, 2025

Conversation

nullcoder
Copy link
Owner

Summary

  • Set up complete Cloudflare Workers deployment infrastructure
  • Configure Next.js for Edge Runtime compatibility
  • Add R2 bucket bindings for encrypted storage

Changes

  • Installed and configured wrangler CLI with @cloudflare/next-on-pages
  • Created wrangler.toml with R2 bucket bindings and environment variables
  • Set up Edge Runtime compatibility for all routes
  • Added health check API endpoint for testing
  • Generated TypeScript definitions for Cloudflare bindings
  • Created .dev.vars for local development secrets
  • Updated build scripts for Cloudflare Pages deployment

Test plan

  • Run npm run typecheck - TypeScript passes
  • Run npm run build - Next.js builds successfully
  • Run npm run preview - Cloudflare Pages preview works
  • Visit http://localhost:8788 - Main page loads
  • Visit http://localhost:8788/api/health - API route responds
  • Verify wrangler types generation works

Next Steps

  • Create R2 bucket in Cloudflare dashboard
  • Deploy to Cloudflare Pages
  • Test R2 bindings with actual storage operations

Closes #6

🤖 Generated with Claude Code

- Add Wrangler configuration for Cloudflare Pages deployment
- Configure R2 bucket binding for encrypted gist storage
- Set up Edge Runtime compatibility with nodejs_compat flag
- Add @cloudflare/next-on-pages for Next.js deployment
- Create health check endpoint using Edge Runtime
- Configure Next.js for Edge Runtime (disable image optimization)
- Update TypeScript config to include worker type definitions
- Add .dev.vars to gitignore for local Cloudflare development

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

Co-Authored-By: Claude <noreply@anthropic.com>
@nullcoder nullcoder added cloudflare Cloudflare-specific edge-runtime Edge runtime compatibility setup Initial project setup and configuration priority: high Should be done soon needs review Ready for code review labels Jun 5, 2025
nullcoder added 2 commits June 5, 2025 01:15
Since wrangler.toml contains no sensitive data and all values are standard for the project, maintaining a separate .example file is redundant.
The .wrangler/ directory contains temporary build files that should not be tracked in version control.
@nullcoder nullcoder merged commit 0ef9cef into main Jun 5, 2025
@nullcoder nullcoder deleted the feat/cloudflare-workers-setup branch June 5, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloudflare Cloudflare-specific edge-runtime Edge runtime compatibility needs review Ready for code review priority: high Should be done soon setup Initial project setup and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure Cloudflare Workers environment
1 participant