This is an example of how to set up a Next.js and Prisma application to deploy on Kinsta’s Application Hosting and Database Hosting services from a GitHub repository.

Prisma is an open-source database toolkit that simplifies database access for developers by providing a type-safe and intuitive API. It supports multiple databases and generates efficient, optimized SQL queries for faster performance. More information is available on the website.

Kinsta automatically installs dependencies defined in your package.json file during the deployment process. This application requires a PostgreSQL database to work.

  1. In MyKinsta, add a database and choose PostgreSQL as the database type.
  2. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – Prisma. Make sure you choose the same Data center location for your application as you did for your database.
  3. In MyKinsta, add an application with the Hello World – Prisma repository.
  4. Once the database is ready for connections (a green check mark is shown next to it), add the internal connection between your application and database from either the application’s Settings page or the database’s Info page.
    1. Select the Add environment variables… checkbox.
    2. Select the Add environment variables to the application checkbox.
    3. Click Add connection.
  1. Go to the application’s Deployments page and click Deploy now > Deploy application.

The app is available as soon as the build finishes, and the Kinsta Welcome page loads at your application’s URL.

Kinsta Welcome page after successful installation of Next.js and Prisma.
Kinsta Welcome page after successful installation of Next.js and Prisma.

Web Server Setup


Kinsta automatically sets the PORT environment variable. You should not define it yourself, and you should not hard-code it into the application.

Start Command

Kinsta automatically creates a web process when deploying an application with npm start as the Start command. Make sure to use this command to run your server.

Deployment Lifecycle

Whenever a deployment is initiated (through creating an application or redeploying due to an incoming commit), the npm build command is run, followed by the npm start command.