https://github.com/ryands17/serverless-prisma
Deploying a Prisma 2 app with apollo-server on AWS Lambda using the Serverless framework
https://github.com/ryands17/serverless-prisma
aws-lambda nexus-schema prisma2 serverless-framework typescript
Last synced: 6 months ago
JSON representation
Deploying a Prisma 2 app with apollo-server on AWS Lambda using the Serverless framework
- Host: GitHub
- URL: https://github.com/ryands17/serverless-prisma
- Owner: ryands17
- Created: 2020-05-08T15:37:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-01T17:24:26.000Z (almost 4 years ago)
- Last Synced: 2024-05-18T07:45:49.747Z (over 1 year ago)
- Topics: aws-lambda, nexus-schema, prisma2, serverless-framework, typescript
- Language: TypeScript
- Size: 3.11 MB
- Stars: 19
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serverless Prisma
### A GraphQL API created using the [Serverless](https://serverless.com) framework using the following tools
- [Prisma 2](http://prisma.io/)
- [@nexus/schema](https://www.nexusjs.org/#/components/schema/about)
- [Apollo Server Lambda](https://www.apollographql.com/docs/apollo-server/deployment/lambda/)### Prerequisites
- node >= 12
- yarn (recommended) or npm### Commands
- `yarn db:save`: Run this command at the start of the project to generate the migrations for your Prisma model located in `prisma/schema.prisma`
- `yarn db:migrate`: Run this command to add your migrations to the database.
- `yarn dev`: Runs the server in development mode via the `sls offline` command and simulates the entire API on [http://localhost:3000/dev/graphql](http://localhost:3000/dev/graphql) by default.
- Copy/Rename the `.env.example` to `.env` and replace the `DATABASE_URL` with the database URL.
- `yarn deploy`: Deploy your application via `sls deploy` on AWS Lambda.
- Copy/Rename the `.env.example` to `.env.production` and replace the `DATABASE_URL` with the database URL and set `NODE_ENV` to **production** (this is required for Nexus to not generate artifacts).**_Note_**: AWS Access and Secret keys must be configured via `aws configure` using the [aws-cli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html). The setup uses the `prisma_demo` profile but you can pass a custom one using `yarn deploy --profile profileName`.