Skip to content

Gomah/prisma-serverless

Folders and files

NameName
Last commit message
Last commit date
Jul 4, 2019
Feb 19, 2019
Feb 19, 2019
Apr 18, 2019
Jan 10, 2020
Feb 19, 2019
Feb 19, 2019
Feb 19, 2019
Mar 4, 2019
Feb 19, 2019
Jul 1, 2019
Jun 11, 2019
Feb 19, 2019
Feb 19, 2019
May 27, 2019
Feb 19, 2019
Feb 19, 2019
Aug 26, 2019
Sep 16, 2019
Aug 2, 2021
Aug 26, 2019
Jan 10, 2020
Aug 11, 2020
Aug 2, 2021

Repository files navigation

Prisma Serverless

Template for Prisma (Nexus) + Typescript + AWS Serverless Lambda = πŸŽ†

This boilerplate includes:

There's more to come πŸ‘€

Table of contents

Project Structure

.
β”œβ”€β”€ config/                     # Serverless env
β”œβ”€β”€ prisma/                     # Prisma related config & Datamodel
β”œβ”€β”€ src/                        # The magic happens here
β”‚   β”œβ”€β”€ generated/              # Generated prisma schema & client
β”‚   β”œβ”€β”€ permissions/            # Resolvers permissions
β”‚   └── resolvers/              # App resolvers
β”‚       β”œβ”€β”€ Mutation/           # Resolvers mutations
β”‚       └── Query/              # Resolvers queries
β”œβ”€β”€ typings/                    # Typescript generic typings
β”œβ”€β”€ .babelrc                    # babel config
β”œβ”€β”€ .editorconfig               # editor config
β”œβ”€β”€ .eslintrc.js                # eslint config
β”œβ”€β”€ .gitignore                  # git ignore list
β”œβ”€β”€ .nvmrc                      # nvm config
β”œβ”€β”€ .prettierrc                 # Prettier configuration
β”œβ”€β”€ docker-compose.yml          # Docker compose file (for local server)
β”œβ”€β”€ package.json                # build scripts and dependencies
β”œβ”€β”€ README.md                   # This file ;)
β”œβ”€β”€ serverless.yml              # Serverless configuration
β”œβ”€β”€ tsconfig.json               # Typescript configuration
└── yarn.lock                   # yarn lock file

Quickstart

Prerequisites

You'll need a prisma server setup to use this template. You can either create a local prisma server using Docker:

docker-compose up -d

Or deploy to a new prisma demo server:

yarn prisma deploy

Then, create an .env referencing the prisma endpoint:

PRISMA_ENDPOINT="http://localhost:4469/app/dev"
PRISMA_SECRET="PRISMA_SECRET"
APP_SECRET="MY_APP_SECRET"
# install dependencies
yarn install

# Run local lambda http environment (API Gateway simulator)
yarn dev

# Run tests
yarn run test

Deploying

  1. Deploy & Generate the prisma schema based on the datamodel to the prisma server.
# Deploy the schema to the prisma server & generate prisma client & schema
yarn prisma deploy

# Resolvers deployment

# Deploy (development)
yarn deploy:dev

# Deploy (production)
yarn deploy:prod

Help