railway login
and initialize a new Railway project railway init
Starting Point: Empty Project
✔ Enter project name: project-name
✔ Environment: production
https://railway.app/project/[project-id]/setup and link your project through the CLI
railway link [project-id]`Connect
tab, and copy the Postgres Connection URL (to be used in the Prisma config section)railway run <cmd>
(run commnds in the railway environments) or railway up
(to deploy your app)For running on the edge, you'd be required to use the Prisma Data Platform (Data Proxy URLs) to interact with your cloud DB instance(no local connections allowed). Get connection string of the form prisma://aws-us-east-1.prisma-data.com/?api_key=...
from the data platform, by connecting your cloud DB instance.
postgresql
(for us). There are other configs we're not using like mysql
, sqlite
, sqlserver
(Preview) or mongodb
(Preview).npx prisma db pull
to turn your database schema into a Prisma schema.env
file and place the connecting string(Postgres Connection URL) against DATABASE_URL
. Prisma is smart enough to use this by its special annotation in the /prisma/schema.prisma
file env("DATABASE_URL")
. Keep postgresql
as the DB typenpm run generate
to generate the Prisma Client (with Data Proxy enabled) . You can then start querying your database.npm run migrate:dev
and npm run migrate:deploy
npm run seed
npm run migrate:reset
schema.prisma
before running your local migrations. Once done, revert back to the original Data Proxy URLs to allow for Prisma client callsTo open studio use npx prisma studio
You will be running several processes during development:
# in one tab, start the remix dev server
$ npm run dev
If you'd like to change any aspects of this behavior, see how the commands are configured in your
package.json
file
Open up http://127.0.0.1:8787 and you should be ready to go!
Use wrangler to build and deploy your application to Cloudflare Workers. If you don't have it yet, follow the installation guide to get it setup. Be sure to authenticate the CLI as well.
If you don't already have an account, then create a cloudflare account here and after verifying your email address with Cloudflare, go to your dashboard and set up your free custom Cloudflare Workers subdomain.
Once that's done, you should be able to deploy your app:
npm run deploy