apps/docs/content/docs/orm/prisma-client/deployment/traditional/deploy-to-flyio.mdx
This guide explains how to deploy a Node.js server that uses Prisma ORM and PostgreSQL to Fly.io.
The Prisma Render deployment example contains an Express.js application with REST endpoints and a simple frontend. This app uses Prisma Client to fetch, create, and delete records from its database. This guide will show you how to deploy the same application, without modification, on Fly.io.
fly.io is a cloud application platform that lets developers easily deploy and scale full-stack applications that start on request near on machines near to users. For this example, it's helpful to know:
fly launch will automatically configure applications hosted on GitHub to deploy on push.Download the example code to your local machine.
curl https://codeload.github.com/prisma/prisma-examples/tar.gz/latest | tar -xz --strip=2 prisma-examples-latest/deployment-platforms/render
cd render
Before we deploy the app, let's take a look at the example code.
The logic for the Express app is in two files:
src/index.js: The API. The endpoints use Prisma Client to fetch, create, and delete data from the database.public/index.html: The web frontend. The frontend calls a few of the API endpoints.The Prisma components of this app are in three files:
prisma/schema.prisma: The data model of this app. This example defines two models, User and Post. The format of this file follows the Prisma schema.prisma/migrations/<migration name>/migration.sql: The SQL commands that construct this schema in a PostgreSQL database. You can auto-generate migration files like this one by running prisma migrate dev.prisma/seed.js: defines some test users and postsPrisma, used to seed the database with starter data.fly launch and accept the defaultsThat’s it. Your web service will be live at its fly.dev URL as soon as the deploy completes. Optionally scale the size, number, and placement of machines as desired. fly console can be used to ssh into a new or existing machine.
More information can be found on in the fly.io documentation.