feat(phase3): Clerk auth + superadmin + email + polish#16
Merged
Conversation
…, polish, smoke tests
- Real Clerk auth wired to all API routes via requireAgencyAuth/requireCreatorAuth/requireBrandAuth
- lib/auth-helpers.ts deleted; lib/auth.ts is now canonical with superadmin passthrough
- proxy.ts: superadmin role bypasses all role-based routing
- Superadmin perspective switcher: cookie-based, visible only to superadmin users, invisible to real users
- Auth pages: /login, /signup (role picker), /signup/{agency,creator,brand}, /signup/complete
- ClerkProvider added to app/layout.tsx; lib/role-context.tsx deleted
- Email: 11 React Email templates (3 existing + 8 new) + Trigger.dev send-email job + hourly deadline cron
- Email triggers wired fire-and-forget to 10 API events
- Upload rate limiting: Upstash slidingWindow on POST /api/v1/deals/[id]/submissions
- Polish: empty states on 5 agency list pages; loading.tsx + error.tsx on all 3 route groups
- 3 Playwright smoke tests + auth helper for superadmin perspective cookie
- CI/CD: Clerk env vars restored to ci.yml + prod.yml quality job
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…hape
- proxy.ts: /api/v1/creators(.*) was missing from isPublicRoute, causing
server-side fetch in DiscoverPage to receive a redirect HTML response
instead of JSON (500 on /discover)
- discover/page.tsx: API returns { data: { creators, pagination } } not
{ data: [...] } — destructure correctly as data?.creators ?? []
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… crashes Redis.fromEnv() and new Resend() throw at module load when env vars are absent, crashing next build in CI before secrets are provisioned. Replaced top-level singletons with lazy getter functions in: - lib/rate-limit.ts: getAuthRateLimit() / getUploadRateLimit() - jobs/send-email.ts: getResend() (internal) Updated callers in set-role and submissions routes accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
requireAgencyAuth()/requireCreatorAuth()/requireBrandAuth()helpers fromlib/auth.ts.lib/auth-helpers.tsdeleted.nullfor real users — completely invisible./login,/signup(role picker), role-specific signup flows,/signup/completeJWT reloadsend-emailjob + hourly deadline-reminder cron. Email triggers wired fire-and-forget to 10 API events.slidingWindow(5, '1m')onPOST /api/v1/deals/[id]/submissionsloading.tsx+error.tsxon all 3 authenticated route groups;Skeletoncomponent addedci.yml+prod.ymlquality jobManual steps required before merging
{ "metadata": "{{user.public_metadata}}" }. Without this, all users loop to/signup/completeforever.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYCLERK_SECRET_KEYRESEND_API_KEYTRIGGER_SECRET_KEYUPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKENpublicMetadata.role = "superadmin"on your Clerk account via the Clerk dashboard Users page for dev/QA access.Test plan
npm run typecheckpasses (0 errors)npm run lintpasses (0 errors)npm run testpasses (119/119)npm run buildsucceeds/dashboard/creator/deals/brand/briefs/new🤖 Generated with Claude Code