Skip to content

Jamstack App | TypeScript | NextJs | API Routes | Next-Auth | FaunaDB | Stripe

Notifications You must be signed in to change notification settings

thiagovasconcellos/tcv-news

Repository files navigation

tcv-news

Tcv Image

Fictional newsletter with subscription to improve knowledge about online payments.

Getting Started

This project has a lot of third party dependencies. Follow instructions carefully!

Installing

yarn install
  • Install stripe-cli to attach webhooks to your local enviroment.

  • Create a new database in faunaDB.

    • Create 2 collections: [users, subscriptions] (no schema needed)
  • Configure some github account to OAuth

Enviroment variables

  • Clone .env.example as .env.local

Most of variables are pretty straightforward, except "STRIPE_WEBHOOK_SECRET"

Stripe webhooks forwarding to localhost

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

After that you should see something like that in your terminal:

webhook

This is your "STRIPE_WEBHOOK_SECRET"

FaunaDB Indexes

FaunaDB is a NoSQL Database, but you have to create some indexes to get things working:

User

  • user_by_email
  • user_by_stripe_customer_id

Subscriptions

  • subscription_by_id
  • subscription_by_status
  • subscription_by_user_ref

Now you're good to go!

yarn dev

Built With

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Jamstack App | TypeScript | NextJs | API Routes | Next-Auth | FaunaDB | Stripe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages