Files
Simeon Griggs 70d357a3ea Update with-mysql example to Next.js 15, Tailwind 4, Prisma 7 (#88475)
## Summary

Updates the `with-mysql` example to use latest versions of all
dependencies.

### What

- Migrate from Pages Router to App Router
- Update to React 19 and Next.js latest
- Update to Tailwind CSS v4 with `@import "tailwindcss"` syntax
- Update to Prisma 7 with `@prisma/adapter-planetscale` driver adapter
- Convert all files to TypeScript
- Remove unused API route and `vercel.svg`
- Update README to clarify this is for PlanetScale MySQL and link to
[vercel/postgres-next-starter](https://github.com/vercel/postgres-next-starter)
for Postgres users

### Why

The example was significantly outdated:
- Prisma 3.10.0 → Prisma 7 (latest)
- Tailwind 3.0.23 → Tailwind 4
- React 18.2.0 → React 19
- Pages Router → App Router

### How

Followed the official migration guides:
- [Prisma 7 upgrade
guide](https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7)
- [PlanetScale quickstart with
Prisma](https://www.prisma.io/docs/getting-started/prisma-orm/quickstart/planetscale)
- Aligned configuration files with a fresh `create-next-app` output

## Related

N/A

## How to Test

```bash
cd examples/with-mysql
npm install
# Set up .env with your PlanetScale DATABASE_URL
npx prisma generate
npx prisma db push
npx prisma db seed
npm run dev
```

## Checklist

- [x] Tests and samples are included
- [x] Documentation is updated (README)

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2026-01-20 12:16:44 +01:00
..

Next.js + PlanetScale MySQL

This is a Next.js project that uses Prisma to connect to a PlanetScale MySQL database and Tailwind CSS for styling.

Using PlanetScale Postgres? Check out the Next.js and Postgres Starter Template for a PostgreSQL-based template.

Demo

https://next-mysql.vercel.app

Prerequisites

pscale auth login

Set Up the Database

Create a new database with the following command:

pscale database create <DATABASE_NAME> --engine mysql

A branch, main, was automatically created when you created your database, so you can use that for BRANCH_NAME in the steps below.

Set Up the Starter Next.js App

Run create-next-app with your preferred package manager to bootstrap the example:

npx create-next-app --example with-mysql nextjs-mysql
Or use yarn / pnpm / bun
yarn create next-app --example with-mysql nextjs-mysql
pnpm create next-app --example with-mysql nextjs-mysql
bunx create-next-app --example with-mysql nextjs-mysql

Next, you'll need to create a database username and password through the CLI to connect to your application. If you'd prefer to use the dashboard for this step, you can find those instructions in the Connection Strings documentation and then come back here to finish setup.

First, create your .env file by renaming the .env.example file to .env:

mv .env.example .env

Next, using the PlanetScale CLI, create a new username and password for the branch of your database:

pscale password create <DATABASE_NAME> <BRANCH_NAME> <PASSWORD_NAME>

The PASSWORD_NAME value represents the name of the username and password being generated. You can have multiple credentials for a branch, so this gives you a way to categorize them. To manage your passwords in the dashboard, go to your database overview page, click "Settings", and then click "Passwords".

Take note of the values returned to you, as you won't be able to see this password again.

Password <PASSWORD_NAME> was successfully created in <DIRECTORY_NAME>.
Please save the values below as they will not be shown again

  NAME              USERNAME        ACCESS HOST URL                ROLE               PLAIN TEXT
  ----------------  --------------  -----------------------------  -----------------  -----------------------------
  <PASSWORD_NAME>   xxxxxxxxxxxxx   xxxxxx.us-east-2.psdb.cloud    Can Read & Write   pscale_pw_xxxxxxx

You'll use these properties to construct your connection string, which will be the value for DATABASE_URL in your .env file. Update the DATABASE_URL property with your connection string in the following format:

mysql://<USERNAME>:<PLAIN_TEXT_PASSWORD>@<ACCESS_HOST_URL>/<DATABASE_NAME>?sslaccept=strict

Generate the Prisma Client:

npx prisma generate

Push the database schema to your PlanetScale database using Prisma:

npx prisma db push

Run the seed script to populate your database with Product and Category data:

npx prisma db seed

Run the App

Run the app with the following command:

npm run dev

Open your browser at localhost:3000 to see the running application.

Deploy Your Own

After you've got your application running locally, it's time to deploy it. To do so, you'll need to promote your database branch (main by default) to be the production branch (read the branching documentation for more information).

pscale branch promote <DATABASE_NAME> <BRANCH_NAME>

Now that your branch has been promoted to production, you can either use the existing password you generated earlier for running locally or create a new password. Regardless, you'll need a password in the deployment steps below.

Deploy with Vercel

Make sure to update the DATABASE_URL variable during this setup process.