Papermark
CRUD SaaSmfts/papermark@ed19717ec02a
Pass, within 2 material
Expected
- one Next.js web service (app router AND pages router mixed), deploy hint vercel
- postgres store via prisma, connection = pool (global PrismaClient singleton in lib/prisma.ts)
- prisma schema is MULTI-FILE: prisma/schema/*.prisma, 78 models total across 15 files
- redis store via @upstash/redis (http-api) — used for rate limiting among other things
- object storage: S3 via @aws-sdk/client-s3 (+ presigned uploads, CloudFront signed URLs)
- hot route: public document viewer pages/view/[linkId] — this is the product's core traffic path
- document conversion work is cpu/long-running: pages/api/mupdf/* with 2048MB memory in vercel.json
- vercel.json has NO crons block — /api/cron/* routes are QStash-triggered receivers (signature-verified via @upstash/qstash Receiver in lib/cron/index.ts), so jobs trigger = queue (or cron via external scheduler), NOT vercel cron
- background jobs via trigger.dev: lib/trigger/ has ~15 tasks (convert-files, bulk-download, notifications, cleanup-expired-exports, automatic-unpause…)
- emails via resend (lib/emails/*), rate-limited through Bottleneck
- stripe payments incl. webhook route, kind=webhook
- auth: next-auth (+ hanko passkeys) — most /api/teams/ routes authenticated
- llm external: openai (@ai-sdk/openai + openai deps), used in AI chat routes (app/(ee)/api/ai/*)
- incoming webhooks route(s) exist (lib/incoming-webhooks, app/api/webhooks/*)
- Must not inventNo mongodb, NO drizzle, NO supabase (hallucination tripwires)
- Must not inventNo websockets/realtime channels expected
Re-verified at the pinned commit
- upstream drift: no Stripe webhook *route* any more —
ee/stripe/webhooks/*handlers exist but nothing imports them. Stripe external still expected; the "webhook route" bullet no longer applies. - AI chat lives under
app/(ee)/api/ai/chat/*; the model call is one import away inee/features/ai/lib/chat/send-message.ts(gpt-4o-mini, caps 220/420 + 200 + 20 for title). - inline jobs: email-change verification via waitUntil (
pages/api/account/index.ts:81-87) is the high-stakes one; the convert-page Slack log and signed-agreement mirror are low.
Found
33 routes with the public document viewer and its view-recording writes as hot, the mupdf conversion routes as CPU work, Postgres via Prisma (78 models), Redis, object storage, and 13 jobs across trigger.dev, QStash, cron and waitUntil.
- Run
- 2026-10-27T21-10-22Z
- Extraction cost
- $0.52
- Time
- 128s
- Retries
- 0
Discrepancies 1 open
Upstream driftnot a miss
No Stripe webhook route extracted.
At the pinned commit the handlers in ee/stripe/webhooks/ have no importer, so there is no route to find. The expectations file is annotated.
Selection gapfixed
The AI chat routes under app/(ee)/api/ai/chat were never sent to the model.
Route handlers that import a model-calling file now rank ahead of the budget cut. The published teardown is from a run after the fix.
Schema gapfixed
Cron-invoked HTTP routes were filed as webhooks, so the webhook-retry finding listed them.
Routes now have a "scheduled" kind.
Missopen
The AI chat route's auth comes back "authenticated" in one run and "public" in the next.
Truth: no login, access gated by chat and viewer ids. Both answers are defensible, so auth can't be graded for capability-id gates yet.