Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🚀 The Ultimate Monorepo Starter for Node.js Serverless Applications

License

NotificationsYou must be signed in to change notification settings

ngneat/nx-serverless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Nx Serverless

The Ultimate Monorepo Starter for Node.js Serverless Applications

✅  First-Class Typescript Support
✅  DynamoDB Single Table Design
✅  Shared API Gateway
✅  Environments Configuration
✅  CORS
✅  JWT Auth Middleware
✅  Http Params Validation
✅  Typed Proxy Handlers
✅  Auto Generators
✅  Localstack
✅  ESLint
✅  Jest
✅  Github Actions


serverlessesbuildnpm peer dependency version (scoped)code style: prettierGitHub licensePRs WelcomeMaintained

Prerequisites

  • Docker
  • Node.js

Getting Started

About the App

The application contains three services:

Auth Service:

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.

Users Service:

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.

Todos Service:

The todos service is responsible for managing todos. A user has many todos. It exposes CRUD routes:

// Get user todoscurl'http://localhost:3005/dev/todos' --header'Authorization: token TOKEN'// Get a single todocurl'http://localhost:3005/dev/todos/:id' --header'Authorization: token TOKEN'// Create a todocurl --request POST'http://localhost:3005/dev/todos' \--header'Authorization: token TOKEN'--data-raw'{    "title": "Learn Serverless"}'// Update a todocurl  --request PUT'http://localhost:3005/dev/todos/:id' \--header'Authorization: token TOKEN' \--data-raw'{    "completed": true}'

DynamoDB GUI

Download NoSQL Workbench for DynamoDB and connect tohttp://localhost:4566.

Commands

nx serve<service-name>nx deploy<service-name>nx remove<service-name>nx build<service-name>nx lint<service-name>nxtest<service-name>// Use different enviromentNODE_ENV=prod nx deploy<service-name> NODE_ENV=stg nx deploy<service-name> // Run only affectednx affected:testnx affected:deploy

Generators

// Generate a serviceyarn g:service tags// Generate handleryarn g:handler handler-name// Generate http handleryarn g:http-handler create-tag// Generate a modelyarn g:model tag


CI/CD Pipeline with Github Actions

The pipeline has been configured to run everytime a push/pull_request is made to themain branch. You should uncomment theci.yml workflow.

Workflow Steps

  • Checkout: Thecheckout action is used to checkout the source code.

  • Node setup: Thesetup-node action is used to optionally download and cache distribution of the requested Node.js version.

  • lint and test: Thelint andtest runs only on affected projects.

  • Configure AWS credentials: The credentials needed areAWS_ACCESS_KEY_ID andAWS_SECRET_ACCESS_KEY and should be set as Githubsecrets.

  • Each branch should be prefixed with theenvironment name. For example, if we have astg-feature-name branch and open a pull request to themain branch, it will setNODE_ENV tostg and deploy to this environment.

By merging the pull request to themain branch,NODE_ENV is set toprod, and the deployment is done to production.

The workflow file can have as many environments as you need.

Further help

Contribution

Found an issue? feel free to raise an issue with information to reproduce.

Pull requests are welcome to improve.

License

MIT

This project is a fork ofnx-serverless

Monster icons created by Smashicons - Flaticon

About

🚀 The Ultimate Monorepo Starter for Node.js Serverless Applications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp