Skip to content

feat: new auth & payment system #1617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: new auth & payment system #1617

wants to merge 4 commits into from

Conversation

nperez0111
Copy link
Contributor

For the auth system I chose to go with better-auth and for the payment system, I chose to go with polar.sh.

There is an already existing integration between the two, maintained by the polar team, as a better-auth plugin.
It's documented on both sides polar's docs and better-auth's docs.

Why Better-auth?

  • Framework agnostic
  • We control our users (can adapt to pretty much any DB)
  • Simple integration & flexible management

Why Polar?

  • MoR simplifies the accounting side
  • 20% less than other MoRs
  • EU-based (Sweden)
  • Open Source (Apache-2.0)

This PR implements an integration for our Next.js application, it uses the better-auth Next.js integration, and then uses the polar better-auth integration on top of that.

Things to sort out

  • What signin methods do we want to support? better-auth supports a number of them (see sidebar)
  • We will need to build a couple of pages
  • After payment page
  • Subscription status link (/api/auth/portal/)
  • Use the subscription status to decide when to show the code examples or not for pro stuff
  • Where to host the DB (I'm biased to self-host as this will be VERY low-traffic)

Demo

Screen.Recording.2025-04-18.at.17.55.34.mp4

Copy link

vercel bot commented Apr 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ❌ Failed (Inspect) Apr 22, 2025 5:47pm
blocknote-website ❌ Failed (Inspect) Apr 22, 2025 5:47pm

Copy link

pkg-pr-new bot commented Apr 18, 2025

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@1617

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@1617

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@1617

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@1617

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@1617

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@1617

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@1617

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@1617

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@1617

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@1617

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@1617

commit: 284d550

@YousefED
Copy link
Collaborator

What signin methods do we want to support?

imo

  • github
  • email + magic link
  • email + password (optional)

wdyt?

We also need to think about what to do with current sponsors. If we can easily detect sponsors when people sign in with github, that would be great. However, I wouldn't spend more than 2-3 hours on this. If we can't make it work we can hardcode a list of sponsors or sth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants