All Projects → AnomalyInnovations → Serverless Nodejs Starter

AnomalyInnovations / Serverless Nodejs Starter

Licence: mit
A Node.js starter for Serverless Framework with ES6 and TypeScript support

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
es6
455 projects

Projects that are alternatives of or similar to Serverless Nodejs Starter

Serverless Plugin Typescript
Serverless plugin for zero-config Typescript support
Stars: ✭ 611 (-10.54%)
Mutual labels:  serverless, serverless-framework
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+524.45%)
Mutual labels:  serverless, serverless-framework
Swim
Distributed software platform for building stateful, massively real-time streaming applications.
Stars: ✭ 368 (-46.12%)
Mutual labels:  serverless, serverless-framework
Express
⚡ Take existing Express.js apps and host them easily on cheap, auto-scaling, serverless infrastructure (AWS Lambda and AWS HTTP API).
Stars: ✭ 337 (-50.66%)
Mutual labels:  serverless, serverless-framework
Webiny Js
Enterprise open-source serverless CMS. Includes a headless CMS, page builder, form builder and file manager. Easy to customize and expand. Deploys to AWS.
Stars: ✭ 4,869 (+612.88%)
Mutual labels:  serverless, serverless-framework
Midway Faas
🔱 A simple and lightweight serverless framework
Stars: ✭ 363 (-46.85%)
Mutual labels:  serverless, serverless-framework
Skygear Server
Skygear - an open source serverless platform for modern secure app development
Stars: ✭ 380 (-44.36%)
Mutual labels:  serverless, serverless-framework
Hands On Serverless Guide
A hands-on guide for building Serverless applications
Stars: ✭ 288 (-57.83%)
Mutual labels:  serverless, serverless-framework
Guide
Serverless Guide - An open-source definitive guide to serverless architectures.
Stars: ✭ 421 (-38.36%)
Mutual labels:  serverless, serverless-framework
Serverless Plugin Aws Alerts
A Serverless Framework plugin that creates CloudWatch alarms for functions.
Stars: ✭ 419 (-38.65%)
Mutual labels:  serverless, serverless-framework
Github Action
⚡️ A Github Action for deploying with the Serverless Framework
Stars: ✭ 323 (-52.71%)
Mutual labels:  serverless, serverless-framework
Puppeteer Lambda Starter Kit
Starter Kit for running Headless-Chrome by Puppeteer on AWS Lambda.
Stars: ✭ 563 (-17.57%)
Mutual labels:  serverless, serverless-framework
Serverless Iam Roles Per Function
Serverless Plugin for easily defining IAM roles per function via the use of iamRoleStatements at the function level.
Stars: ✭ 311 (-54.47%)
Mutual labels:  serverless, serverless-framework
Serverless Typescript Starter
🗄🙅‍♀️ Deploy your next serverless JavaScript function in seconds
Stars: ✭ 653 (-4.39%)
Mutual labels:  serverless, jest
Serverless Golang
AWS Lambda Go functions using Serverless Framework and Python shim
Stars: ✭ 292 (-57.25%)
Mutual labels:  serverless, serverless-framework
Serverless Wsgi
Serverless plugin to deploy WSGI applications (Flask/Django/Pyramid etc.) and bundle Python packages
Stars: ✭ 377 (-44.8%)
Mutual labels:  serverless, serverless-framework
Aws Auto Cleanup
Open-source application to programmatically clean your AWS resources based on a whitelist and time to live (TTL) settings
Stars: ✭ 276 (-59.59%)
Mutual labels:  serverless, serverless-framework
Serverless Plugin Canary Deployments
Canary deployments for your Serverless application
Stars: ✭ 283 (-58.57%)
Mutual labels:  serverless, serverless-framework
Midway
🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈
Stars: ✭ 5,080 (+643.78%)
Mutual labels:  serverless, serverless-framework
Serverless Devs
🔥🔥🔥 Serverless Devs developer tool ( Serverless Devs 开发者工具 )
Stars: ✭ 545 (-20.2%)
Mutual labels:  serverless, serverless-framework

Serverless Node.js Starter

A Serverless starter that adds ES6, TypeScript, serverless-offline, linting, environment variables, and unit test support. Part of the Serverless Stack guide.

Serverless Node.js Starter uses the serverless-bundle plugin and the serverless-offline plugin. It supports:

  • Generating optimized Lambda packages with Webpack
  • Using ES6 or TypeScript in your handler functions
  • Run API Gateway locally
    • Use serverless offline start
  • Support for unit tests
    • Run npm test to run your tests
  • Sourcemaps for proper error messages
    • Error message show the correct line numbers
    • Works in production with CloudWatch
  • Lint your code with ESLint
  • Add environment variables for your stages
  • No need to manage Webpack or Babel configs

Demo

A demo version of this service is hosted on AWS - https://z6pv80ao4l.execute-api.us-east-1.amazonaws.com/dev/hello

And here is the ES6 source behind it

export const hello = async (event, context) => {
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: `Go Serverless v1.0! ${(await message({ time: 1, copy: 'Your function executed successfully!'}))}`,
      input: event,
    }),
  };
};

const message = ({ time, ...rest }) => new Promise((resolve, reject) =>
  setTimeout(() => {
    resolve(`${rest.copy} (with a delay)`);
  }, time * 1000)
);

Upgrading from v1.x

We have detailed instructions on how to upgrade your app to the v2.0 of the starter if you were using v1.x before. Read about it here.

Requirements

Installation

To create a new Serverless project.

$ serverless install --url https://github.com/AnomalyInnovations/serverless-nodejs-starter --name my-project

Enter the new directory

$ cd my-project

Install the Node.js packages

$ npm install

Usage

To run a function on your local

$ serverless invoke local --function hello

To simulate API Gateway locally using serverless-offline

$ serverless offline start

Deploy your project

$ serverless deploy

Deploy a single function

$ serverless deploy function --function hello

Running Tests

Run your tests using

$ npm test

We use Jest to run our tests. You can read more about setting up your tests here.

Environment Variables

To add environment variables to your project

  1. Rename env.example to .env.
  2. Add environment variables for your local stage to .env.
  3. Uncomment environment: block in the serverless.yml and reference the environment variable as ${env:MY_ENV_VAR}. Where MY_ENV_VAR is added to your .env file.
  4. Make sure to not commit your .env.

TypeScript

If serverless-bundle detects a tsconfig.json in your service root, it'll compile it using TypeScript. We have a separate starter for TypeScript here, Serverless TypeScript Starter.

Linting

We use ESLint to lint your code via serverless-bundle.

You can turn this off by adding the following to your serverless.yml.

custom:
  bundle:
    linting: false

To override the default config, add a .eslintrc.json file. To ignore ESLint for specific files, add it to a .eslintignore file.

Support

  • Open a new issue if you've found a bug or have some suggestions.
  • Or submit a pull request!

This repo is maintained by Anomaly Innovations; makers of Seed and Serverless Stack.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].