Replace Supabase with Auth0 + Heroku Postgres + S3
From the PR description
Summary
- Auth: Supabase Auth → Auth0 (
drizzling.auth0.com). Backend verifies JWTs via JWKS; an internalpublic.userstable is upserted on every request keyed byauth0_sub. - DB: Supabase Postgres → Heroku Postgres add-on. Drizzle ORM is the schema source of truth; route code keeps working through a thin
pg-backed Supabase-shape shim atbackend/src/lib/supabase.tsso the 11k-line route layer didn't need a rewrite. - Storage: Cloudflare R2 → AWS S3 (
rainylabs-mike-prod, us-east-1). IAM usermike-backendprovisioned with scoped policy; keys stored in Secrets Manager (mike/S3_*). - Runtime: New
backend/Dockerfile(multi-stage Node 20 + LibreOffice for DOC/DOCX → PDF) and rootheroku.ymlfor Heroku container deploys. - Frontend:
@supabase/*→@auth0/nextjs-auth0v4. Auth0 middleware mounts/auth/*; new/auth/profileand/auth/access-tokenbridge endpoints feed an Auth0-backed shim atfrontend/src/lib/supabase.tsso existingsupabase.auth.*call sites still work.
What's still needed before this deploys
These are user-driven steps that can't be automated from this PR:
- Heroku (
heroku auth:whoamiis currently unauthed). After logging in:heroku create rainylabs-mike-backend --team rain-developers --stack container --region usheroku addons:create heroku-postgresql:mini -a rainylabs-mike-backendheroku config:set ...with the env frombackend/.env.examplegit push heroku feat/rainylabs-deploy:main(or set up GitHub Actions)- Apply schema:
heroku pg:psql -a rainylabs-mike-backend < backend/schema.sql
- Auth0 (existing
drizzling.auth0.comtenant):- Create an API with identifier (audience)
https://api.mike.rainylabs(or chosen value) - Create an SPA application for the Next.js frontend; capture client id + secret
- Configure callbacks/CORS for the frontend URL
- Create an API with identifier (audience)
- AI provider keys - set
ANTHROPIC_API_KEY/OPENAI_API_KEY/GEMINI_API_KEYin Heroku config
Test plan
-
heroku create+ add-ons + config vars - Push deploy succeeds; container boots; logs show "listening on PORT"
-
curl -H "Authorization: Bearer <auth0-test-token>" https://rainylabs-mike-backend.herokuapp.com/projectsreturns 200 (after applying schema) - Frontend Auth0 login →
/auth/profilereturns user,/auth/access-tokenreturns access token - End-to-end: log in, create a project, upload a doc, run a chat
🤖 Generated with Claude Code
Our analysis
Migrate Mike stack to Auth0, Heroku Postgres, and S3 — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-1.md from
inside the repo you want the changes in.