Contact Us
Webflow Premium Partner Ehab Fayez
Back to Agent Skills
Data & Analytics

PlanetScale MySQL Serverless

Use PlanetScale for serverless MySQL with branching workflows, non-blocking schema changes, and horizontal scaling.

Claude Code Cursor Copilot Windsurf

Overview

PlanetScale is a serverless MySQL platform built on Vitess, the database clustering system that powers YouTube. It provides a unique git-like branching workflow for database schema changes, where you create branches, make schema modifications, and merge them through deploy requests with automated schema diff review.

The @planetscale/database JavaScript driver uses HTTP-based connections instead of traditional MySQL TCP connections, making it compatible with serverless environments like Vercel Edge Functions, Cloudflare Workers, and AWS Lambda. It supports connection pooling, automatic retries, and edge-optimized routing. The driver works with ORMs like Prisma and Drizzle through their PlanetScale adapters.

PlanetScale handles online schema changes using Vitess's VReplication, allowing you to add columns, create indexes, and modify tables without locking or downtime. The platform provides built-in connection pooling, query analytics, read replicas, and automatic horizontal sharding. The free tier includes generous limits for development, while paid plans offer production-grade SLAs and compliance certifications.

Who Is This For?

  • Deploy MySQL databases for serverless and edge environments
  • Implement git-like branching for database schema changes
  • Run non-blocking schema migrations without downtime
  • Scale MySQL horizontally with automatic sharding

Installation

Setup for Claude Code
npm install @planetscale/database

Configuration

import { connect } from "@planetscale/database"

const conn = connect({
  host: process.env.DATABASE_HOST,
  username: process.env.DATABASE_USERNAME,
  password: process.env.DATABASE_PASSWORD,
})

const results = await conn.execute(
  "SELECT * FROM users WHERE email = ?",
  [email]
)