rphlmr / supa-stripe-stack

A Remix & Stripe Stack, backed by Supabase (driven by Prisma), that integrates authentication, subscriptions (multi-currency, month and year intervals) and handling tier limit.
https://remix-supa-stripe-stack.fly.dev/
MIT License
130 stars 10 forks source link
remix-run remix-stack remix-starter stripe stripe-checkout supabase-js

Remix Supa Stripe Stack

TwitterLive Demo

A Remix & Stripe Stack, backed by Supabase (driven by Prisma), that integrates authentication, subscriptions (multi-currency, month and year intervals) and handling tier limit.

Remix deploy target: Fly.io

Disclaimer: This stack gives you a good starting point but it can't handle a specific business model. You'll need to adapt it to your needs and you must understand how Stripe works before going to production.

supa-stripe-stack

I want to thank and credit DevXO for its work on Stripe Stack which helped me a lot to build the webhook part of this stack.

Learn more about Remix Stacks.

npx create-remix --template rphlmr/supa-stripe-stack

What's in the stack

Features

Tools

What's not in the stack

Why Supabase?

I love it.

Requirements

1 Supabase project

2 Stripe project

You'll also need to install the Stripe CLI to test the webhook locally

This CLI gives you the ability to listen Stripe webhook events and forward them to your local server.

3 Fly project

TODO In the meantime, you can look at my other stack working with Fly

4 Environment variables

There are other environment variables you can set in your .env file.

How it works

TODO: explain the stack

TODO: explain the pricing plan

TODO: explain how to make this stack your own

Development

It's time to play with the stack 🎉

⚠️ This step only applies if you've opted out of having the Remix CLI install dependencies for you:

npx remix init

The default pricing plan included in this stack can be found in scripts/config/index.ts

Seed the database and Stripe

npm run setup

Start Stripe Webhook listener

It is mandatory to test the webhook locally.

Stripe sends webhook events to your server when a customer subscribes, cancels, or updates their subscription.

Stripe events are sent to the /api/webhook endpoint.

stripe listen --forward-to localhost:3000/api/webhook

Start the server

With the Stripe webhook listener running, open a new terminal and use the command to start a development server:

npm run dev

Both the listener and the development server must be running concurrently in separate terminals for the app to work.

Notes

Test credit card: 4242424242424242 Date 12/33 CVC 123

More cards: https://stripe.com/docs/testing?testing-method=card-numbers#cards