# fullstack-next-cloudflare | Muhammad Arifin | Knowledge Base | Instagit

🚀 Full-stack Next.js 15 + Cloudflare Workers template with D1 database, R2 storage, Better Auth, and Server Actions. Production-ready with automated CI/CD and generous free tiers.

GitHub Stars: 1.2k

Repository: https://github.com/ifindev/fullstack-next-cloudflare

---

## Articles

### [How to Set Up Preview Deployments with GitHub Actions for Cloudflare](/ifindev/fullstack-next-cloudflare/how-to-set-up-preview-deployments-with-github-actions-for-cloudflare)

Learn to set up preview deployments with GitHub Actions for Cloudflare. Build, migrate, deploy your Next.js app, and get PR URLs automatically.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Manage Database Schema Changes and Migrations in Production with Drizzle ORM and Cloudflare D1](/ifindev/fullstack-next-cloudflare/how-to-manage-database-schema-changes-and-migrations-in-production)

Safely manage database schema changes and migrations in production using Drizzle ORM and Cloudflare D1. Automate SQL file generation and application in your CI/CD for seamless updates.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Optimize React Server Components for Edge Runtime in Next.js](/ifindev/fullstack-next-cloudflare/how-to-optimize-react-server-components-for-edge-runtime)

Learn to optimize React Server Components for the edge runtime in Nextjs. Keep bundles small, use async functions, and query edge data sources directly for faster performance.

- Tags: performance
- Published: 2026-03-04

### [How to Switch Between Local Development and Remote Cloudflare Resources in Next.js](/ifindev/fullstack-next-cloudflare/how-to-switch-between-local-development-and-remote-cloudflare-resources)

Seamlessly switch between local dev and remote Cloudflare resources in Next.js. Learn to use NODE_ENV to manage R2, D1, and secrets across environments with the same API.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Implement Protected Routes with Middleware in Next.js on Cloudflare](/ifindev/fullstack-next-cloudflare/how-to-implement-protected-routes-with-middleware-in-nextjs-on-cloudflare)

Implement protected routes in Next.js on Cloudflare using middleware. Validate Better-Auth sessions at the edge and redirect unauthenticated users efficiently before page loads.

- Tags: tutorial
- Published: 2026-03-04

### [How to Handle Hot Module Replacement with the Wrangler Dev Server in Next.js](/ifindev/fullstack-next-cloudflare/how-to-handle-hot-module-replacement-with-wrangler-dev-server)

Learn how to handle hot module replacement with Wrangler dev server in Next.js. Run both servers concurrently for seamless UI hot-reloading and Cloudflare Workers runtime.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Configure Observability and Logging in Cloudflare Workers: A Complete Guide](/ifindev/fullstack-next-cloudflare/how-to-configure-observability-and-logging-in-cloudflare-workers)

Learn to configure observability and logging in Cloudflare Workers by enabling the observability flag and using console methods. Monitor traces and logs in the Cloudflare Dashboard with this complete guide.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Use Drizzle ORM with SQLite for Edge Database Queries: A Complete Cloudflare D1 Guide](/ifindev/fullstack-next-cloudflare/how-to-use-drizzle-orm-with-sqlite-for-edge-database-queries)

Learn to use Drizzle ORM with SQLite for edge database queries on Cloudflare D1. Execute type-safe SQLite queries with the d1-http driver and @opennextjs/cloudflare.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Implement CORS Policies for R2 Storage Buckets in Next.js Cloudflare Workers](/ifindev/fullstack-next-cloudflare/how-to-implement-cors-policies-for-r2-storage-buckets)

Learn to implement CORS policies for R2 storage buckets in Next.js Cloudflare Workers. Manually add headers to your Worker response to enable cross origin resource sharing.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Generate TypeScript Types from wrangler.jsonc Bindings in Cloudflare Workers](/ifindev/fullstack-next-cloudflare/how-to-generate-typescript-types-from-wranglerjsonc-bindings)

Automatically generate TypeScript types from wrangler.jsonc bindings with the wrangler types CLI command. Get a strongly-typed Env interface for D1, R2, Vectorize, and AI bindings.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Debug Next.js Applications Running on Cloudflare Workers: Local and Production Techniques](/ifindev/fullstack-next-cloudflare/how-to-debug-nextjs-applications-running-on-cloudflare-workers)

Debug Next.js on Cloudflare Workers with `wrangler dev` for local debugging and `wrangler tail` for production log streaming. Master edge application troubleshooting.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Configure a Cloudflare R2 Bucket: Public Development URLs vs Custom Domains](/ifindev/fullstack-next-cloudflare/how-to-set-up-r2-bucket-with-public-development-urls-versus-custom-domains)

Configure your Cloudflare R2 bucket for development with public URLs and for production using custom domains. Learn how to set CLOUDFLARE_R2_URL in your Next.js app.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Configure Custom Domains for Cloudflare Workers Deployment in Next.js 15](/ifindev/fullstack-next-cloudflare/how-to-configure-custom-domains-for-cloudflare-workers-deployment)

Configure custom domains for Cloudflare Workers deployment in Next.js. Register your domain, bind routes in wrangler.jsonc, and set R2 URL secrets for branded asset serving.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Implement Feature-Based Module Architecture in Next.js: A Complete Guide](/ifindev/fullstack-next-cloudflare/how-to-implement-the-feature-based-module-architecture-used-in-the-template)

Learn to implement feature-based module architecture in Next.js by organizing domain logic into self-contained packages. Streamline your project structure for better scalability.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Handle Authentication Session Cookies Between Next.js and Cloudflare Workers](/ifindev/fullstack-next-cloudflare/how-to-handle-authentication-session-cookies-between-nextjs-and-workers)

Learn to handle authentication session cookies between Next.js and Cloudflare Workers seamlessly. Utilize better-auth and nextCookies for secure, shared session tokens without custom headers.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Create API Routes That Use Server Actions on Edge Runtime in Next.js](/ifindev/fullstack-next-cloudflare/how-to-create-api-routes-that-use-server-actions-on-edge-runtime)

Learn to create Next.js API routes using Server Actions on the Edge Runtime for Cloudflare Workers. Execute Server Actions with Edge bindings like R2, KV, and AI.

- Tags: how-to-guide
- Published: 2026-03-04

### [How to Manage Environment Variables and Secrets in Cloudflare Workers: A Complete Guide](/ifindev/fullstack-next-cloudflare/how-to-manage-environment-variables-and-secrets-in-cloudflare-workers)

Master Cloudflare Workers environment variables and secrets. Learn to use .dev.vars, wrangler secret put, and type-safe access for secure and efficient applications.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Configure Google OAuth Credentials for Production Deployment](/ifindev/fullstack-next-cloudflare/how-to-configure-google-oauth-credentials-for-production-deployment)

Securely configure Google OAuth credentials for production deployment with Cloudflare Workers. Learn to store secrets, set redirect URIs, and access credentials at runtime for seamless authentication.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Run Database Migrations with Drizzle ORM for Cloudflare D1](/ifindev/fullstack-next-cloudflare/how-to-run-database-migrations-with-drizzle-orm-for-d1)

Easily run database migrations with Drizzle ORM for Cloudflare D1. Generate SQL with drizzle-kit and apply using Wrangler CLI for seamless schema updates.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Deploy Next.js 15 App to Cloudflare Workers with GitHub Actions: Complete CI/CD Guide](/ifindev/fullstack-next-cloudflare/how-to-deploy-nextjs-15-app-to-cloudflare-workers-with-github-actions)

Deploy your Next.js 15 app to Cloudflare Workers with GitHub Actions. Automate tests, migrations, and deployments to preview, staging, or production with this comprehensive CI/CD guide.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Use Cloudflare Workers AI for Text Summarization in Next.js API Routes](/ifindev/fullstack-next-cloudflare/how-to-use-cloudflare-workers-ai-for-text-summarization-in-api-routes)

Learn to use Cloudflare Workers AI for text summarization in Next.js API routes. Implement secure summarization with Llama 3.2 and Zod validation from the ifindev/fullstack-next-cloudflare repo.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Implement Authentication with Better Auth on Cloudflare Workers](/ifindev/fullstack-next-cloudflare/how-to-implement-authentication-with-better-auth-on-cloudflare-workers)

Implement authentication on Cloudflare Workers using Better Auth, Drizzle, and Next.js. Learn to lazily initialize Better Auth and manage sessions with React for a secure application.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Set Up R2 Object Storage for File Uploads in a Next.js Cloudflare Project](/ifindev/fullstack-next-cloudflare/how-to-set-up-r2-object-storage-for-file-uploads-in-a-nextjs-cloudflare-project)

Learn to set up R2 object storage for file uploads in Next.js with Cloudflare. This guide details bucket creation, wrangler binding, and using helper functions for seamless integration.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Configure Cloudflare D1 Database Bindings with Next.js on Workers](/ifindev/fullstack-next-cloudflare/how-to-configure-cloudflare-d1-database-bindings-with-nextjs-on-workers)

Learn to configure Cloudflare D1 database bindings with Next.js on Workers. Declare your database, generate TypeScript types, and access it at runtime for seamless data integration.

- Tags: how-to-guide
- Published: 2026-03-03

