🚀 The Ultimate Monorepo Starter for Node.js Serverless Applications

Overview

Nx Serverless

The Ultimate Monorepo Starter for Node.js Serverless Applications

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


serverless esbuild npm peer dependency version (scoped) code style: prettier GitHub license PRs Welcome Maintained

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": "[email protected]",
    "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 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
}'

DynamoDB GUI

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

Commands

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

Generators

// 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

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 of nx-serverless

Monster icons created by Smashicons - Flaticon

Comments
  • Dynamo

    Dynamo

    Issue with Table generation

    POST /dev/auth/sign-up (λ: sign-up) One of the tables was not found, verify table exists before retrying. Error: Cannot do operations on a non-existent table

    Run the create user curl and get the above

    NB// Also add docs about setting up AWS credentials and the defaults needed perhaps

    opened by iwarner 12
  • Serverless Compose?

    Serverless Compose?

    Hi, Serverless Framework maintainer here. I stumbled upon this repository and I'm wondering if Serverless Framework Compose could be useful here?

    Furthermore we're exploring possible integrations with Learn/Nx/Turborepo, looking to bounce ideas about that. So I thought I'd open an issue ^^

    question 
    opened by mnapoli 5
  • Frontend?

    Frontend?

    Hello,

    First off, as a long time Serverless Framework user, I love what has been done here!

    So much so, I am planning on using this as a PoC at my job. I have 2 quick question before I do though:

    1. Would I easily be able to integrate a React frontend into the repo? - I have looked over the Nx Documentation and believe it should be possible but I would like your opinion as you definitely have more experience in Nx than myself.

    2. If a frontend service is possible, would you be able to share types across both?

    Thanks, Connor

    opened by CMethoddata 2
  • NPM Error

    NPM Error

    Dependency error occurred using npm 8.11.0, with npm 8.5.0 it installs everything fine

    Steps to reproduce:

    • Use npm version = 8.11.0

    It got me this error over here:

    While resolving: @nrwl/[email protected]
    Found: @typescript-eslint/[email protected]
    node_modules/@typescript-eslint/parser
      dev @typescript-eslint/parser@"5.19.0" from the root project
      peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/[email protected]
      node_modules/@typescript-eslint/eslint-plugin
        dev @typescript-eslint/eslint-plugin@"5.19.0" from the root project
    
    Could not resolve dependency:
    peer @typescript-eslint/parser@"~5.18.0" from @nrwl/[email protected]
    node_modules/@nrwl/eslint-plugin-nx
      dev @nrwl/eslint-plugin-nx@"14.1.2" from the root project
    
    Conflicting peer dependency: @typescript-eslint/[email protected]
    node_modules/@typescript-eslint/parser
      peer @typescript-eslint/parser@"~5.18.0" from @nrwl/[email protected]
      node_modules/@nrwl/eslint-plugin-nx
        dev @nrwl/eslint-plugin-nx@"14.1.2" from the root project
    

    What we can do in this case?

    Usually I would just start to bump versions from those dependencies. I'm new to open source projects and I would love to know what approach we use in these dependency error cases.

    And I'm curious why this happens, all of the versions are set to the exact match in package.json

    opened by jhonpedro 2
  • ERESOLVE could not resolve

    ERESOLVE could not resolve

    After clone I was running npm install and I got this error:

    npm ERR! ERESOLVE could not resolve
    npm ERR!
    npm ERR! While resolving: @nrwl/[email protected]
    npm ERR! Found: @typescript-eslint/[email protected]
    npm ERR! node_modules/@typescript-eslint/parser
    npm ERR!   dev @typescript-eslint/parser@"5.19.0" from the root project
    npm ERR!   peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/[email protected]
    npm ERR!   node_modules/@typescript-eslint/eslint-plugin
    npm ERR!     dev @typescript-eslint/eslint-plugin@"5.19.0" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer @typescript-eslint/parser@"~5.18.0" from @nrwl/[email protected]
    npm ERR! node_modules/@nrwl/eslint-plugin-nx
    npm ERR!   dev @nrwl/eslint-plugin-nx@"14.1.2" from the root project
    npm ERR!
    npm ERR! Conflicting peer dependency: @typescript-eslint/[email protected]
    npm ERR! node_modules/@typescript-eslint/parser
    npm ERR!   peer @typescript-eslint/parser@"~5.18.0" from @nrwl/[email protected]
    npm ERR!   node_modules/@nrwl/eslint-plugin-nx
    npm ERR!     dev @nrwl/eslint-plugin-nx@"14.1.2" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    
    opened by jon9090 1
  • Dependency Injection?

    Dependency Injection?

    Hi

    Many thanks for putting this repo together, it is an excellent example.

    What are your thoughts on using a Dependency Injection library like tsyringe? Could 'newing up' several dependencies in your todo service lead to a lot of boilerplate setup for each handler when more abstractions are created around IO and Business Logic?

    I've forked your repo, created a branch and refactored the todo service with a few tests as a basic example - https://github.com/stottle-uk/nx-serverless/tree/dependency_injection.

    Any thoughts or ideas you have would be much appreciated.

    Kind regards

    question 
    opened by stottle-uk 1
Owner
ngneat
Powerful open sources for JS & Angular Applications
ngneat
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Panacloud Multi-Cloud Internet-Scale Modern Global Apps 89 Jan 3, 2023
A Serverless GraphQL Sample project using Apollo and Serverless Framework with TypeScript and Webpack.

Serverless GraphQL Boilerplate This is a base project with a structure that includes Serverless Framework, Apollo, TypeScript and Webpack. It can be d

Ravi Souza 5 Aug 23, 2022
AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository -> https://www

awsrun 35 Dec 17, 2022
Run REST APIs in Node.js applications frameworks (Express, Koa, Hapi and Fastify) on top of any Serverless Cloud.

?? Serverless Adapter Install | Usage | Support | Architecture | Credits Run REST APIs and other web applications using your existing Node.js applicat

Vinicius Lourenço 45 Jan 1, 2023
A Weather API project inspired by The Ultimate API Challenge / Weather API.

Weather API Project A Weather API project inspired by The Ultimate API Challenge / Weather API. Tech Stack: React.js Tailwind Axios Inspiration The Pr

Franziska 1 Dec 29, 2021
The *New* Ultimate Bookmarklet: Coming August 17th...

Vengeance The New Ultimate Bookmarklet: Coming August 17th... An addon to Avo and the successor to avo-ultimate A new favlet featuring unblocked dev t

Chadrick J Brown 11 Dec 15, 2022
The ultimate parity checking as-a-service platform.

Astro Starter Kit: Minimal npm create astro@latest -- --template minimal ??‍?? Seasoned astronaut? Delete this file. Have fun! ?? Project Structure I

Ben Holmes 6 Nov 28, 2022
Follow along with blog posts, code samples, and practical exercises to learn how to build serverless applications from your local Integrated development environment (IDE).

Getting started with serverless This getting started series is written by the serverless developer advocate team @AWSCloud. It has been designed for d

AWS Samples 55 Dec 28, 2022
An affordable and easy-to-use monitoring tool for your AWS serverless applications.

AWS Serverless Applications Monitoring Tool Table of Contents Motivation for Project Getting Started AWS End Users Installation and Setup Lambda Metri

OSLabs Beta 54 Sep 21, 2022
A technology stack solution using the AWS Serverless architecture.Atlas stack for building applications focused on generating value.

Atlas A technology stack solution using the AWS Serverless architecture.Atlas stack for building applications focused on generating value. Description

Atlas 9 Dec 15, 2022
NFT Game Starter Project: https://github.com/buildspace/buildspace-nft-game-starter

Running React on Repl.it React is a popular JavaScript library for building user interfaces. Vite is a blazing fast frontend build tool that includes

Zahuis 2 Feb 11, 2022
Starter-gatsby-blog - Gatsby starter for a Contentful project from the community.

Contentful Gatsby Starter Blog Create a Gatsby blog powered by Contentful. Static sites are scalable, secure and have very little required maintenance

Priya Chakraborty 0 Jan 29, 2022
GitHub starter project link: https://github.com/buildspace/waveportal-starter-project

Running React on Repl.it React is a popular JavaScript library for building user interfaces. Vite is a blazing fast frontend build tool that includes

MD Rafi Uddin 0 Jun 5, 2022
Projen project type for Turborepo monorepo setup.

?? projen-turborepo Projen project type for Turborepo monorepo setup. Getting Started To create a new project, run the following command and follow th

Roman 23 Oct 4, 2022
A demo for E2E build piplelines in Design Systems using monorepo's and automation :zap:.

Design System Pipelines demo What is it? A working demonstration for end-to-end build piplelines in Design Systems using Primer Primitives, Primer CSS

Rez 7 Oct 20, 2022
A template application for setting up a mobile app video game with IONIC, PHASER, ANGULAR and a Monorepo strategy

OpenForge Ionic Monorepo Example This is a template project for all you aspiring video game developers out there! Want to use your web application ski

OpenForge 67 Dec 22, 2022