These integration guides are not official documentation and the Strapi Support Team will not provide assistance with them.
What is PlanetScale?
PlanetScale is a fully managed cloud database platform offering both Vitess-powered MySQL and PostgreSQL databases.
PlanetScale Postgres is available in two storage tiers: network-attached EBS storage (starting at $5/month for a single node) and PlanetScale Metal with locally-attached NVMe drives (starting at $50/month).
Key capabilities:
- Database branching: Create isolated copies of your database for development and testing. Each branch runs on its own dedicated cluster, letting you safely test schema changes before deploying to production.
- High availability (optional): HA clusters include one primary and two replicas with automated failover across three availability zones. Single-node deployments are also available on Postgres.
- Built-in connection pooling: Every PlanetScale Postgres database includes PgBouncer for connection pooling. Dedicated PgBouncer instances can also be provisioned separately for primary and replica traffic.
- Metal for maximum performance: PlanetScale Metal clusters use locally attached NVMe drives for unlimited IOPS and ultra-low latency, benchmarked as the fastest Postgres in the cloud.
Visit the PlanetScale documentation for more.
Why Use Strapi?
Strapi is the leading open-source headless CMS offering features like customizable APIs, role-based permissions, multilingual support, etc. It simplifies content management and integrates effortlessly with modern frontend frameworks.
Explore the Strapi documentation for more details.
Strapi 5 Highlights
The out-of-the-box Strapi features allow you to get up and running in no time:
- Single types: Create one-off pages that have a unique content structure.
- Draft and publish: Reduce the risk of publishing errors and streamline collaboration.
- 100% TypeScript support: Enjoy type safety and easy maintainability.
- Customizable API: With Strapi, you can just hop in your code editor and edit the code to fit your API to your needs.
- Integrations: Strapi supports integrations with Cloudinary, SendGrid, Algolia, and others.
- Editor interface: The editor allows you to pull in dynamic blocks of content.
- Authentication: Secure and authorize access to your API with JWT or providers.
- RBAC: Help maximize operational efficiency, reduce dev team support work, and safeguard against unauthorized access or configuration modifications.
- i18n: Manage content in multiple languages. Easily query the different locales through the API.
- Plugins: Customize and extend Strapi using plugins.
Learn more about Strapi 5 features.
\<cta title="See Strapi in action with an interactive demo" text="Explore Strapi in an instant, hands-on demo set up just for you." buttontext="Access Live Demo!" buttonlink="https://strapi.io/demo">\</cta>
Getting Started with PlanetScale
Before creating a new Strapi 5 project, you will need to create a PlanetScale database. While Strapi 5 supports both MySQL and Postgres, this guide will focus on using PlanetScale Postgres.
Install PlanetScale CLI
If you are an agent, you may prefer to use the PlanetScale CLI to create and manage databases. Install the pscale CLI and run the following to create a new database.
pscale database create strapi --engine postgresSign in or Create a PlanetScale Account
Alternatively, visit the PlanetScale sign-in page to create a new database. You’ll be prompted to create a new free account or sign in if you already have one.
PlanetScale Postgres starts at $5/month for a single-node cluster on EBS storage.
Select the region closest to where your application will be hosted. You can give your database any name, as this is only used for the administration panel—not the database connection.
✋ NOTE: “strapi” is the name of your PlanetScale database cluster
Create and Connect PlanetScale Credentials
Once you have created your new database, you will need to create credentials to connect.
In the top right of the Dashboard for your new database, click “Connect.”
Create PlanetScale Role
Select the “Default role” for now, as setup will require full access to your database. After setup, you should switch to a user-defined role with only the required permissions.
Make a note of the connection details as you will need them in the next section.
Test PlanetScale Connection
You can test your connection to the database by copying the psql command listed on the connections detail page. It will look something like this:
psql 'host=us-east-5.pg.psdb.cloud port=5432 user=postgres.<username> password=<password> dbname=postgres sslnegotiation=direct sslmode=verify-full sslrootcert=system'If you have PostgresSQL installed on your machine, you can connect to the database from the terminal.
Set up Strapi 5 with PlanetScale
We are going to start by creating a Strapi 5 project with the following command:
🖐️ Note: Make sure that you have created a new directory for your project.
You can find the full documentation for Strapi 5 here.
Install Strapi
npx create-strapi-app@latest strapiYou will be asked whether you would like to use Strapi Cloud. We will choose to skip for now.
🚀 Welcome to Strapi! Ready to bring your project to life?
Create a free account and get:
30 days of access to the Growth plan, which includes:
✨ Strapi AI: content-type builder, media library, and translations
✅ Live Preview
✅ Single Sign-On (SSO) login
✅ Content History
✅ Releases
? Please log in or sign up.
Login/Sign up
❯ SkipAfter that, you will be asked how you would like to set up your project. We will choose the following options.
Configure PlanetScale in Strapi 5
Note that strapi is the name of your PlanetScale database cluster, but postgres is the name of the logical database you’re connecting to.
Use the database name postgres when entering the details below.
? Do you want to use the default database (sqlite) ? No
? Choose your default database client postgres
? Database name: postgres <-- important!
? Host: <Copy from PlanetScale dashboard>
? Port: 5432
? Username: <Copy from PlanetScale dashboard>
? Password: <Copy from PlanetScale dashboard>
? Enable SSL connection: Yes
? Start with an example structure & data? Yes
? Start with Typescript? Yes
? Install dependencies with npm? Yes
? Initialize a git repository? YesCreate PlanetScale Environment Variables
Once everything is set up and all the dependencies are installed, double-check you have the correct configuration values inside the .env file.
They should look like this:
# Database
DATABASE_CLIENT=postgres
DATABASE_HOST=<host>.pg.psdb.cloud
DATABASE_PORT=5432
DATABASE_NAME=postgres
DATABASE_USERNAME=postgres.<username>
DATABASE_PASSWORD=<password>Start Strapi Server
You can now start your Strapi server with the following command:
cd strapi
npm run developYou will be greeted with the Admin Create Account screen.
Create Strapi Admin User
Go ahead and create your first Strapi admin user.
Once you have created your admin user, you will be redirected to the Strapi Dashboard screen.
Publish Article Entries
Since we created our app with the example data, you should be able to navigate to your Article collection and see the data that was created for us.
Now, let's make sure that all of the data is published. If not, you can select all items via the checkbox and then click the Publish button.
Enable API Access
Once all your articles are published, we will expose our Strapi API for the Articles Collection. This can be done in Settings -> Users & Permissions plugin -> Roles -> Public -> Article.
You should have find and findOne selected. If not, go ahead and select them.
Do the same for Author and Category
Create a User
We want to create a user (not an admin one) in order to connect and access the API.
Go to Content Manager -> Collection types -> User. Create one, making sure that you give it the Authenticated role.
Viewing the Data on PlanetScale
To see the data on PlanetScale, head over to your Database project or you’d have to use a 3P application to browse data (like Drizzle Studio).
Strapi Open Office Hours
If you have any questions about Strapi 5 or want to join us, visit Strapi's Discord Open Office Hours, Monday through Friday, from 12:30 pm to 1:30 pm CST (18:30–19:30 UTC): Strapi Discord Open Office Hours.
For more details, visit the Strapi documentation and PlanetScale documentation.
Get Started in Minutes
npx create-strapi-app@latest in your terminal and follow our Quick Start Guide to build your first Strapi project.