WIP - Boilerplate Node.js + TypeScript + Prisma + Serverless
- In
serverless.yml
, updateservice
field with the name of your project; - In
package.json
, updatename
field with the name of your project;
To use with Planet Scale (MySQL serverless DB), you can use this env config:
DB_USER=mysqluser
DB_ROOT_USER=root
DB_PASSWORD=mysqlpass
DB_HOST=0.0.0.0
DB_PORT=3306
DB_DATABASE=mydb
DATABASE_URL="mysql://${DB_ROOT_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}"
To use with Mongo Atlas serverless, use this env config:
DB_USER=mongodbuser
DB_PASSWORD=mongodbpass
DB_HOST=mongodbhost
DB_DATABASE=db
DATABASE_URL="mongodb+srv://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}?retryWrites=true&w=majority"
To use with MongoDB local (docker-compose), use this env config:
DB_USER=mongodbuser
DB_PASSWORD=mongodbpass
DB_HOST=0.0.0.0
DB_PORT=27017
DB_DATABASE=db
DATABASE_URL="mongodb://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}?authSource=admin&retryWrites=true&w=majority"
If you are using mongodb, you need to create TypeScript types to use with Prisma. Just run the command:
yarn generate
Get the docker up with the command:
DEBUG=1 yarn docker:up:logs
With this command, you can see if something is wrong by looking at the logs.
You can use Ctrl + C
any time to came back to your terminal prompt without
get the process down.
To get the docker down, you will have to use the command:
yarn docker:down
After the docker is up and running, just get your server up with the following command:
yarn dev
WIP
WIP