The Ultimate Monorepo Starter for Node.js Serverless Applications
✅  First-Class Typescript Support
✅  DynamoDB Single Table Design
✅  Shared API Gateway
✅  Enviroments Configuration
✅  JWT Auth Middleware
✅  Http Params Validation
✅  Typed Proxy Handlers
✅  Auto Generators
✅  Localstack
✅  ESLint
✅  Jest
- Docker
- Node.js
- Run git clone https://github.com/ngneat/nx-serverless.git your-app-name
- Run
npm install - Run
npm run localstack - Update the
environmentfiles based on your configuration - Run
npm run serve
The application contains three services:
The auth service is responsible for authentication. It exposes one route for signing up:
curl --request POST 'http://localhost:3001/dev/auth/sign-up' \
--data-raw '{
"email": "netanel@gmail.com",
"name": "Netanel Basal"
}'The request returns a JWT, which is used for accessing protected routes.
The users service is responsible for managing users. It exposes one route:
curl 'http://localhost:3003/dev/user' --header 'Authorization: token TOKEN'The request returns the logged-in user.
The todos service is responsible for managing todos. A user has many todos. It exposes CRUD routes:
// Get user todos
curl 'http://localhost:3005/dev/todos' --header 'Authorization: token TOKEN'
// Get a single todo
curl 'http://localhost:3005/dev/todos/:id' --header 'Authorization: token TOKEN'
// Create a todo
curl --request POST 'http://localhost:3005/dev/todos' \
--header 'Authorization: token TOKEN'
--data-raw '{
"title": "Learn Serverless"
}'
// Update a todo
curl --request PUT 'http://localhost:3005/dev/todos/:id' \
--header 'Authorization: token TOKEN' \
--data-raw '{
"completed": true
}'Download NoSQL Workbench for DynamoDB and connect to http://localhost:4566.
nx serve <service-name>
nx deploy <service-name>
nx remove <service-name>
nx build <service-name>
nx lint <service-name>
nx test <service-name>
// Use different enviroment
NODE_ENV=prod nx deploy <service-name>
NODE_ENV=stg nx deploy <service-name>
// Run only affected
nx affected:test
nx affected:deploy// Generate a service
npx nx workspace-generator service tags
// Generate handler
npx nx workspace-generator handler --name=create-tag --project=tags
// Generate http handler
npx nx workspace-generator http-handler --name=create-tag --project=tags
// Generate a model
npx nx workspace-generator model --name=tag --project=tags- Visit Serverless Documentation to learn more about Serverless framework
- Visit Nx Documentation to learn more about Nx dev toolkit
- Visit LocalStack to learn more about it
Found an issue? feel free to raise an issue with information to reproduce.
Pull requests are welcome to improve.
MIT
This project is a fork of nx-serverless

