A tech stack to build and scale full-stack applications on serverless environments.
The "Quantum stack" is a serverless web development stack made by Carlos focused on simplicity, modularity, and full-stack typesafety. It consists of:
-
Provision a new database. We recommend using Railway for this, as you get a free PostgreSQL database under their free tier.
If you plan on changing the database provider to something like MySQL remember to change it as well in the
schema.prisma
file:datasource db { provider = "mysql" url = env("DATABASE_URL") }
-
Create a new project at Prisma Data Platform to get a free Prisma Data Proxy.
-
Create a
.env
file in the root of the project and provision the Prisma data proxy connection string toDATABASE_URL
:DATABASE_URL=''
-
Create a
.env.migrations
file in the root of the project and provision the real database connection string toDATABASE_URL
:DATABASE_URL=''
-
Use
yarn prisma:migrate
to run migrations. The Prisma Data Proxy cannot run migrations on your database yet, so you must use your database connection string to do that. -
Use
yarn prisma:generate
to generate a Prisma Client compatible with the Prisma Data Proxy. -
Use
yarn prisma:studio
to launch a Prisma Data Studio in your browser.
The graphql-codegen client-preset provides typed GraphQL operations (Query, Mutation and Subscription).
import { graphql } from "../graphql/types/client";
const GetBooksDocument = graphql(`
query GetBooks { # Give your operation a name
books {
id
name
}
}
`);
Import your project from GitHub and add these 2 environment variables:
# Use your Prisma Data Proxy connection string for the DATABASE_URL
DATABASE_URL=''
# This ensures the Prisma Client for the Data Proxy is generated during the build step.
PRISMA_GENERATE_DATAPROXY=true