gitmyhub

cloudflare-saas-stack

TypeScript ★ 3.7k updated 1y ago

Quickly make and deploy full-stack apps with database, auth, styling, storage etc. figured out for you. Add all primitives you want.

This is a starter kit for building and deploying web applications on Cloudflare's infrastructure. Rather than spending days wiring together a database, authentication, file storage, and hosting from scratch, this template has all of those pieces configured and ready to go. You clone the repository, run a setup command, and have a working app skeleton that you can extend with your own features.

The stack is built on Next.js for the frontend (a popular framework for building web apps with React), TailwindCSS for styling, and a component library called ShadcnUI for pre-built interface elements. For the backend, it uses Cloudflare's own services: D1 for the database (a serverless SQLite-compatible database), Pages for hosting, and R2 for file storage. Authentication is handled by NextAuth with Google login included out of the box. Database access goes through Drizzle, which is a TypeScript-friendly tool for writing and running database queries.

The project was created by the team behind Supermemory.ai, which is a personal knowledge management app that reportedly runs on roughly five dollars per month for over twenty thousand users. The stack is intentionally lean: Cloudflare handles scaling automatically, and there are no servers to manage. Costs scale with usage rather than being fixed whether your app gets traffic or not.

Setup involves creating a free Cloudflare account, installing the Wrangler command-line tool that Cloudflare provides for managing deployments, and running a few commands to create your database and configure authentication credentials. Deploying to production is a single command once that is done.

The README covers database migrations, file upload configuration with CORS policies, and a manual setup path for developers who prefer to wire things together step by step. The repository is written in TypeScript throughout.