Heavily inspired on this repo: https://github.com/tommedema/serverless-mono-example . This example showcases a monorepo setup for Serverless applications in Typescript using Yarn Workspaces and Webpack. The Lambda integrates with Prisma to demonstrate forcefully including packages that cannot be bundled by Webpack. It works by preventing these dependencies to be hoisted to the root folder, by adding them to Yarn's nohoist
(see package.json
).
- Typescript (with references)
- Lerna
- Yarn Workspaces
- Serverless Framework
- Webpack
- Prisma (database)
Everything from the root folder.
yarn install
yarn build
- Testing from the root folder and in individual packages.
- Deployments from the root folder and in individual packages.
- Webpack bundling. Example showcases forcefully including packages that are not compatible with Webpack, such as
Prisma
orknex.js
. - Automatic prettier and linting via Husky.
Run tests for all packages by simply running yarn test
, or run them individually by navigating to a package.
yarn test
Deploy all Lambda's from the root folder or individually by navigating to a package.
yarn deploy
Prisma generates Typescript definitions and a Prisma engine. This Prisma engine is a direct interface to the database. These files cannot be bundled by Webpack and should therefore be excluded. Other dependencies can be added or removed by adding them to the nohoist
option in the package.json
file.