Giter Site home page Giter Site logo

devpras22 / cloudflare-saas-stack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dhravya/cloudflare-saas-stack

0.0 0.0 0.0 99 KB

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

JavaScript 1.43% TypeScript 94.07% CSS 4.18% Handlebars 0.32%

cloudflare-saas-stack's Introduction

๐Ÿš€ Full-Stack Cloudflare SaaS kit

Build and deploy scalable products on Cloudflare with ease.

An opinionated, batteries-included starter kit for quickly building and deploying SaaS products on Cloudflare.

This is the same stack I used to build Supermemory.ai which is open source at git.new/memory

The stack includes:

... while still being minimal and composable.

Getting started

To use, simply clone this repo by running the following commands:

  1. Make sure that you have Wrangler installed. And also that you have logged in with wrangler login (You'll need a Cloudflare account)

  2. Run the following commands:

git clone https://github.com/Dhravya/cloudflare-saas-stack
cd cloudflare-saas-stack
npm i -g bun
bun install
bun run setup

That's it. You're ready to go! Next time, you can just run bun run dev and start developing.

When you're ready to deploy, run bun run deploy to deploy to Cloudflare.

If it fails, get your account id using these steps and set the CLOUDFLARE_ACCOUNT_ID environment variable to your account id. See this issue for details.

Manual setup

An automatic setup script is provided, but you can also manually set up the following:

  1. Create a Cloudflare account and install the Wrangler CLI.
  2. Create a D1 database under "Workers and Pages" in the Cloudflare dashboard, or run ``bunx wrangler d1 create ${dbName}`
  3. Create a .dev.vars file in apps/web with the following content (Get these from google developer console):
GOOGLE_CLIENT_ID=${your-google-client-id}
GOOGLE_CLIENT_SECRET=${your-google-client-secret}
NEXTAUTH_SECRET=${your-secret}
  1. In apps/web, run this command to make migrations to setup auth with database: bunx wrangler d1 execute ${dbName} --local --file=migrations/0000_setup.sql. This creates a local version of the database and creates the appropriate tables.
  2. Run remote migration for the production database - same command but replace --local with --remote: bunx wrangler d1 execute ${dbName} --remote --file=migrations/0000_setup.sql
  3. Bun bun run dev to start the development server.
  4. Run bun run deploy to deploy to Cloudflare.

The beauty of this stack

It's fully scalable and composable. Want to add a backend hono worker, or a python backend? sure! Just put it in the monorepo and deploy.

there's no environment variables. want to use database? just env.DB. Want a Key-value instance? env.KV. want a queue? env.Queue.

want AI? env. AI

tools are incredible. there's wrangler - you can use wrangler to create/delete databases run migrations and all sorts.

Getting a lot of traffic? me too. I pay $5/month, for all of my projects hosted at the same time. (see https://supermemory.ai, https://md.dhr.wtf and more)

cloudflare-saas-stack's People

Contributors

dhravya avatar abaudhuin avatar kcoopermiller avatar rajavijayach avatar aryasaatvik avatar vasnt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.