Part of #3
Question
Bring better-auth into apps/server so sign up, sign in, and invite work end to end, with organisations as workspaces.
- Install better-auth with the Drizzle adapter on D1 and the organisation plugin. Every sign in method that needs no password, as the research ticket found them.
- Sign up creates the user, the workspace, and the owner membership. Invite creates a membership from a link.
- Sessions per the glossary: thirty days, sliding, sign out everywhere.
- Waitlist match at sign up: an email on the waitlist is marked as early bird, so the Polar discount can be attached later.
- Polar plugin present but inert when its secrets are absent, which is what a self hosted instance is.
- Mount it at
/auth/* on the Worker, and fill rpc/base.ts's authed middleware so procedures can require a session; integration tests inside the Vitest pool against real D1.
- Record the better-auth decision and the self hosted instance definition as ADRs once it runs.
Part of #3
Question
Bring better-auth into
apps/serverso sign up, sign in, and invite work end to end, with organisations as workspaces./auth/*on the Worker, and fillrpc/base.ts'sauthedmiddleware so procedures can require a session; integration tests inside the Vitest pool against real D1.