SShortSingh.
Back to feed

How to Deploy SvelteKit on Cloudflare Pages With D1 or Postgres Databases

0
·2 views

Cloudflare Pages offers free global edge hosting for SvelteKit apps with zero cold starts, but connecting a real database introduces several undocumented pitfalls. Developers can use Cloudflare's managed SQLite service D1 or connect to Postgres databases via Hyperdrive, a pooled connection layer for Workers. A key gotcha is that standard Node.js globals like process.env and built-in modules such as fs and node:crypto are unavailable by default in the Workers runtime, requiring use of platform.env and Web Crypto APIs instead. Postgres connections routed through poolers like Supabase or Neon must also disable prepared statements to avoid runtime errors. The article outlines configuration steps and five common mistakes developers encounter when moving beyond static deployments on Cloudflare Pages.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Why Backend Engineers Should Prioritize Clarity Over Clever Code

A backend engineer reflects on how writing overly clever, abstract code often creates more problems than it solves, particularly during production incidents. While advanced techniques like lock-free structures or custom memory handling are justified under extreme performance constraints, most teams build everyday services where readability matters far more than elegance. The author argues that well-intentioned goals like flexibility and reusability frequently lead to over-engineered architectures that obscure simple business logic. Debugging such systems under pressure reveals the hidden cost of abstraction: poor log clarity, deep indirection, and steep learning curves for new team members. The core message is that in backend engineering, clarity is a feature, and simplicity should be a deliberate, strategic choice rather than a sign of limited skill.

0
ProgrammingDEV Community ·

Engineer flags five key security warnings for Meta Muse AI agent ahead of 2026 rollout

Software engineer Adnan Obuz has published a cautionary analysis of Meta Muse, an AI personal agent designed to manage emails, calendars, payments, and documents on a user's behalf. Obuz highlights that users are enrolled by default under Meta's data controls, arguing that opt-out mechanisms rely on user fatigue rather than genuine informed consent. He also notes that the promised Confidential VM security feature, which would cryptographically isolate user data, has not yet shipped and remains a 2026 roadmap item. A key concern is that opting out of AI model training does not prevent the agent from accessing connected mailboxes, representing a separate and distinct data boundary. Obuz recommends withholding sensitive access until the feature ships, starting with low-stakes tasks, and logging all agent activity before granting broader permissions.

0
ProgrammingDEV Community ·

TVS Motor Modernizes 15-Year-Old Dealer Management System Across 4,000+ Outlets

TVS Motor has undertaken a major overhaul of its legacy Dealer Management System, which had supported over 4,000 dealerships across India for more than 15 years. The original platform was a .NET desktop application burdened with slow load times, no mobile or web access, and deeply embedded business logic built up through years of customization. Rather than replacing the system all at once, TVS adopted the Strangler Fig pattern, which allows new functionality to gradually replace legacy components while the existing system keeps running. The legacy application is being progressively broken down into independent microservices, enabling more targeted scalability and easier maintenance. This incremental approach was chosen to minimize operational risk across a large, mission-critical dealer network where a sudden full migration could have caused significant disruption.

0
ProgrammingDEV Community ·

Developer improves 20k-star ML repo by measuring a bias, not fixing it

A developer building a Japanese decision model tested the open-source laya multilingual checkpoint against 300 label-conditioned Japanese business emails. The evaluation revealed that laya's ordinal scoring head almost never selected the first-listed option, regardless of wording or order, pointing to a positional bias in the model weights. Rather than attempting a code fix, the contributor opened an issue with reproducible measurements and an A/B test that a third party helped trace to the checkpoint weights. Within four days, the maintainer documented the limitation in a new release and merged a regression-check tool the contributor had written. The underlying fix requires retraining the model, which has not yet occurred, but the contributor's benchmarking work established a clear, verifiable baseline for evaluating future improvements.