cold-start: split Neon and pg database drivers#44
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR reduces Vercel cold-start latency by splitting the single database module into two lazily-loaded modules — one for the Neon HTTP driver (production) and one for
Confidence Score: 5/5Safe to merge — the refactor is a clean mechanical split with no behavioral changes on either the Vercel or local path. The top-level No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[index.ts module evaluation] --> B{isLocalDatabaseUrl?}
B -- yes --> C["await import('./local')"]
B -- no --> D["await import('./neon')"]
C --> E[createLocalDatabase\npg Pool + drizzle node-postgres]
D --> F[createNeonDatabase\nneon + drizzle neon-http]
E --> G[export const db: AppDatabase]
F --> G
Reviews (2): Last reviewed commit: "Load Neon and pg database drivers throug..." | Re-trigger Greptile |
Production bundles no longer parse the local pg driver when running against Neon on Vercel.
e3c51ae to
9b340e6
Compare

Stack Context
This stack reduces Vercel cold-start time by shrinking the shared SvelteKit server boot path and isolating heavy agent/GitHub dependencies.
Why?
The database module imported both Neon HTTP and
pgdrivers at startup. Production on Vercel only needs Neon, but still parsed the local Postgres stack on every cold boot.Test plan