perf: route API Postgres through Hyperdrive to cut per-request latency - #35
Merged
Conversation
Connect the DB via the Hyperdrive binding (edge-pooled connections) so requests skip the per-invocation TCP, TLS, and auth handshake that added ~1-2s to every DB-backed route. Falls back to INFISCAL_DATABASE_URL when the binding is absent. Also add a non-prod Drizzle query logger for visibility into how many queries each endpoint fires. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
coderscreen-api | 2a08a62 | Jul 28 2026, 03:28 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
coderscreen-web | 2a08a62 | Jul 28 2026, 03:29 AM |
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.
Loading pages were slow because every DB-backed request opened a brand-new Postgres connection, paying the full TCP, TLS, and auth handshake on each invocation (~1-2s floor, even for trivial queries and the auth routes). This routes
useDb()through a Cloudflare Hyperdrive binding so connections are pooled at the edge, with a fallback toINFISCAL_DATABASE_URLwhen the binding is absent (safe to deploy before/without the resource). It also adds a non-prod Drizzle query logger (params redacted) so we can see how many queries each endpoint fires, plus theHYPERDRIVEbinding inwrangler.jsoncand the optional type inworker-configuration.d.ts. After deploy, the existing Cloudflare request logs should show DB-backed routes drop from ~2s to a few hundred ms.🤖 Generated with Claude Code