Starting setup for a Serverless Prisma project in TypeScript running on AWS Lambda with the Serverless Framework at it's backbone.
- AWS Account
- AWS cli configured locally
- SQL or MongoDB database
src/lambas
holds all your lambda handlers related codesrc/libs
holds general code available to all lambda functions- imports from
src/libs
asimport {name} from @libs
- access to prisma client inside your code through
import {createPrismaClient} from @libs
- The build process creates three different lamba layers to keep your actual function code as small as possible
- Prisma -> holding your prisma-client related code
- NodeModules -> holding your prod node-modules
- Lib -> holding your shared assets
$ yarn install
- If you don't want to use your default aws profile configured on your local machine for deployment, update
config.js
- Update
PRISMA_DATABASE_URL
in.env
file - Update
prisma.schema
and run migrations if necessary
Creating resources on aws
$ yarn deploy
Compiling and building as if in production but execution happens locally
$ yarn offline