Giter Site home page Giter Site logo

weareunfolded / nx-serverless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sudokar/nx-serverless

0.0 0.0 0.0 7.65 MB

Modern Serverless framework starter template using Nrwl Nx monorepo dev toolkit

Home Page: https://github.com/sudokar/nx-serverless

License: MIT License

Shell 2.24% JavaScript 2.73% TypeScript 95.03%

nx-serverless's Introduction

nx-serverless-monorepo

serverless esbuild npm peer dependency version (scoped) code style: prettier GitHub license Percentage of issues still open PRs Welcome Maintained

TypeScript GitHub Actions

A monrepo style, modern boilerplate or template project for Serverless framework using Nx monorepo toolkit ๐Ÿ›  and aws-nodejs-typescript serverless template

Table of contents

Whats Included

  • A template project layout using latest version of Nx and Servrless framework
  • An easy to use workspace generator to generate a template/stack with Serverless framework files and related Nx configuration
  • Configured with AWS provider and it can be easily adopted to any cloud provider

Template Layout

.
โ”œโ”€โ”€ stacks/    # stack for each serverless configuration/template and its associated files
โ”œโ”€โ”€ libs/      # shared libraries
โ”œโ”€โ”€ tools/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ jest.config.js
โ”œโ”€โ”€ jest.preset.js
โ”œโ”€โ”€ nx.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ serverless.base.ts  # base configuration for serverless
โ”œโ”€โ”€ tsconfig.base.json
โ”œโ”€โ”€ workspace.json
โ”œโ”€โ”€ .editorconfig
โ”œโ”€โ”€ .eslintrc.json
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .husky              # git hooks
โ”œโ”€โ”€ .nvmrc
โ”œโ”€โ”€ .prettierignore
โ”œโ”€โ”€ .prettierrc

Prerequisites

  • Nodejs protip: use nvm

    โš ๏ธ Version: lts/hydrogen (v18). If you're using nvm, run nvm use to ensure you're using the same Node version in local and in your lambda's runtime.

  • ๐Ÿ“ฆ Package Manager

    • Yarn

      (or)

    • NPM Pre-installed with Nodejs

  • ๐Ÿ’… Code format plugins

    On your preferred code editor, Install plugins for the above list of tools

Usage

Depending on your prefrered package manager, follow the instructions below to build and deploy serverless stack(s).

  • Install project dependencies

    • Using NPM

      npm i
    • Using Yarn

      yarn
  • Generate a new stack

    nx workspace-generator serverless <STACK_NAME>

    Run with -d or --dry-run flag for dry run

  • Generate a new library

    nx g @nrwl/node:lib --skipBabelrc --tags lib <LIBRARY_NAME>

    Run with -d or --dry-run flag for dry run

  • Package stack

    • To package single stack

      nx run <STACK_NAME>:build --stage=<STAGE_NAME>
    • To package stack affected by a change

      nx affected:build --stage=<STAGE_NAME>
    • To package all stacks

      nx run-many --target=build --stage=<STAGE_NAME>
  • Deploy stack to cloud

    • To deploy single stack

      nx run <STACK_NAME>:deploy --stage=<STAGE_NAME>
    • To deploy stack affected by a change

      nx affected:deploy --stage=<STAGE_NAME>
    • To deploy all stacks

      nx run-many --target=deploy --all --stage=<STAGE_NAME>
  • Remove stack from cloud

    • To remove single stack

      nx run <STACK_NAME>:remove --stage=<STAGE_NAME>
    • To remove stack affected by a change

      nx affected:remove --stage=<STAGE_NAME>
    • To remove all stacks

      nx run-many --target=remove --all --stage=<STAGE_NAME>
  • Run tests

    • To run tests in single stack

      nx run <STACK_NAME>:test --stage=<STAGE_NAME>
    • To run tests affected by a change

      nx affected:test --stage=<STAGE_NAME>
    • To run tests in all stacks

      nx run-many --target=test --all --stage=<STAGE_NAME>
  • Run offline / locally

    • To run offlline, configure serverless-offline plugin as documented here and run below command

      nx run <STACK_NAME>:serve --stage=<STAGE_NAME>
  • Understand your workspace

    nx dep-graph
    

Further help

Nx Cloud

Computation Memoization in the Cloud

โ€‹ Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times.

โ€‹ Visit Nx Cloud to learn more and enable it

Contribution

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

Pull requests are welcome to improve.

Support

Like the template?

Click to Buy Me A Coffee

Or, Add a star โญ to the repository

Maintainer

This template is authored and maintained by sudokar

License

MIT

nx-serverless's People

Contributors

renovate[bot] avatar renovate-bot avatar sudokar avatar netanelbasal avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.