Giter Club home page Giter Club logo

fmf's Introduction

MakerKit - SaaS Starter for Next.js and Supabase

MakerKit is a SaaS starter project built with Next.js, Supabase and Tailwind CSS.

This is a Next.js project bootstrapped with create-next-app.

Getting Started

This is a quick guide to get you started with the project. For more details, please refer to the documentation.

Requirements

Ensure you have the following installed:

  • Node.js
  • Git
  • Docker

Cloning the Repository

Clone this repository and name it according to your preferences:

git clone https://github.com/makerkit/next-supabase-saas-kit.git your-saas --depth=1

Move to the folder just cloned:

cd your-saas

Reinitialize Git and set this repository as your upstream fork, so you can pull updates when needed:

rm -rf .git
git init
git add .
git commit -am "Inital Commit"
git remote add upstream https://github.com/makerkit/next-supabase-saas-kit

We recommend to watch to the repository, so you know when there's an update. To pull the latest updates, use:

git pull upstream main --allow-unrelated-histories

In case we change the same files, you will need to resolve the conflicts.

Alternatively, you can cherry-pick changes so to reduce the amount of conflicts across the files.

Installing the Node Modules

Install the Node modules with the following command:

npm i

Supabase

First, run the Supabase stack:

npm run supabase:start

NB: this does not run your remote Supabase project, but a local instance using Docker. This is useful for development and testing.

For production, you will need to copy your remote instance keys, and push the database migrations to your remote instance.

My recommendation is to use the local instance for development, and the production instance when you're ready to deploy. Please set up the local instance first before attempting to use the production instance.

If you are planning to deploy Supabase to production right away, please ensure you read this guide by Supabase first.

Adding the Supabase Keys to the Environment Variables

If this is the first time you run this command, we will need to get the Supabase keys and add them to our local environment variables configuration file .env.local. The file does not exist because it's not supposed to be pushed to the repository: please create it and add the environment variables below.

When running the command, we will see a message like this:

> supabase start

Applying migration 20221215192558_schema.sql...
Seeding data supabase/seed.sql...
Started supabase local development setup.

         API URL: http://localhost:54321
          DB URL: postgresql://postgres:postgres@localhost:54322/postgres
      Studio URL: http://localhost:54323
    Inbucket URL: http://localhost:54324
      JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
        anon key: ****************************************************
service_role key: ****************************************************

Now, we need to copy the anon key and service_role key values and add them to the .env.local file:

NEXT_PUBLIC_SUPABASE_ANON_KEY=****************************************************
SUPABASE_SERVICE_ROLE_KEY=****************************************************

Database types (optional)

Now, generate the DB types with:

npm run typegen

Next.js Server

Then, run the Next.js development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Running the Stripe CLI

If you're testing Stripe, also run the Stripe server (requires Docker running):

npm run stripe:listen

Then, copy the printed webhook key and add it to your environment files. This can also be used for running the E2E tests.

The environment variable name is STRIPE_WEBHOOK_SECRET.

STRIPE_WEBHOOK_SECRET=whsec_***********************

Open http://localhost:3000 with your browser to see the result.

After Creating your Supabase Project

Make sure to add the environment variables to the provider you're deploying.

Running Tests

Before running tests, add the required environment variables to your .env.test file:

SUPABASE_URL=http://localhost:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=

Retrieve the keys after starting the Supabase server and paste them in the .env.test file.

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

fmf's People

Contributors

bvanputten avatar gbuomprisco avatar kyh avatar

Watchers

 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.