Git Product home page Git Product logo

ixartz / serverless-boilerplate-express-typescript Goto Github PK

View Code? Open in Web Editor NEW
528.0 8.0 78.0 6.11 MB

๐Ÿš€๐ŸŽ‰๐Ÿ“š Boilerplate and Starter for Serverless framework, ExpressJS, TypeScript, Prisma and MongoDB โšก๏ธ Made with developer experience first: Serverless framework + Live reload + Offline support + ExpressJS + TypeScript + ESLint + Prettier + Husky + Commitlint + Lint-Staged + Jest + Dotenv + esbuild + VSCode

Home Page: https://creativedesignsguru.com

License: MIT License

Shell 7.25% TypeScript 68.81% JavaScript 23.94%
serverless serverless-framework lambda aws typescript eslint prettier vscode offline expressjs

serverless-boilerplate-express-typescript's Introduction

Serverless Boilerplate with Serverless Framework 3, ExpressJS, TypeScript, Prisma and MongoDB Twitter

Serverless Boilerplate Banner

๐Ÿš€ Serverless Boilerplate is starter code for your backend and REST API based on Serverless framework with Express JS, TypeScript, Prisma and MongoDB. โšก๏ธ Made with Serverless framework, Live reload, Offline support, ExpressJS, TypeScript, ESLint, Prettier, Husky, Lint-Staged, Jest, Commitlint, Dotenv, VSCode.

Clone this project and use it to create your own backend.

Features

Developer experience first:

  • ๐Ÿ”ฅ Serverless framework
  • โšก๏ธ ExpressJS
  • โœ… Type checking TypeScript with strict mode
  • ๐Ÿ“š ORM with Prisma
  • ๐Ÿ’– Database with MongoDB with in-memory database for local development
  • ๐Ÿ“ Linter with ESLint with Airbnb configuration
  • ๐Ÿ’– Code Formatter with Prettier
  • ๐ŸฆŠ Husky for Git Hooks
  • ๐Ÿšซ Lint-staged for running linters on Git staged files
  • ๐Ÿš“ Lint git commit with Commitlint
  • ๐Ÿ““ Write standard compliant commit messages with Commitizen
  • ๐Ÿฆบ Unit testing with Jest and Supertest for integration testing
  • ๐Ÿ‘ท Run tests on pull request with GitHub Actions
  • ๐ŸŽ Automatic changelog generation with Semantic Release
  • ๐Ÿ’ก Absolute Imports using @ prefix
  • ๐Ÿ—‚ VSCode configuration: Debug, Settings, Tasks and extension for ESLint, Prettier, TypeScript, Jest
  • ๐Ÿ“– Local support with Serverless Offline
  • โš™๏ธ Environment variable with Serverless Dotenv
  • ๐ŸŽ‰ Fast bundler with esbuild
  • โœจ HTTP Api instead of API gateway for cost optimization
  • ๐Ÿ’จ Live reload

Philosophy

  • Minimal code
  • ๐Ÿš€ Production-ready

Node.js SaaS Boilerplate - MERN Stack with Serverless

Build your SaaS product faster with Node.js SaaS Boilerplate.

Node.js React SaaS Boilerplate

Premium Themes

Green Nextjs Landing Page Template Purple Saas Nextjs Theme
Green Nextjs Landing Page Template Blue Landing Page Nextjs Theme

Find more Nextjs Templates.

Requirements

  • Node.js 16+ and npm

Getting started

Run the following command on your local environment:

git clone --depth=1 https://github.com/ixartz/Serverless-Boilerplate-Express-TypeScript.git my-project-name
cd my-project-name
npm install

Then, you can run locally in development mode with live reload:

npm run dev

The local server is now listening at http://localhost:4000

Deploy to production

You can deploy to production with the following command:

npm run deploy-prod

VSCode information (optional)

If you are VSCode users, you can have a better integration with VSCode by installing the suggested extension in .vscode/extension.json. The starter code comes up with Settings for a seamless integration with VSCode. The Debug configuration is also provided for frontend and backend debugging experience.

With the plugins installed on your VSCode, ESLint and Prettier can automatically fix the code and show you the errors. Same goes for testing, you can install VSCode Jest extension to automatically run your tests and it also show the code coverage in context.

Pro tips: if you need a project wide type checking with TypeScript, you can run a build with Cmd + Shift + B on Mac.

Contributions

Everyone is welcome to contribute to this project. Feel free to open an issue if you have question or found a bug.

License

Licensed under the MIT License, Copyright ยฉ 2022

See LICENSE for more information.


Made with โ™ฅ by CreativeDesignsGuru Twitter

Node.js React SaaS Boilerplate

serverless-boilerplate-express-typescript's People

Contributors

ixartz avatar kaveet avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-boilerplate-express-typescript's Issues

Repository as template?

Hey, love your work for the boilerplate. Wouldn't it be great if you enable the Template repository checkbox under repository settings. It would resolve all the hassle of cloning your repo and doing other changes. Just a suggestion.

image

Add Swagger Support

Issue Description:
Requesting the addition of Swagger support to the project. Swagger integration would enhance API documentation and streamline development by providing standardized endpoint information.

Expected Benefits:
Improved API understanding
Easier client integration
Reduced learning curve for newcomers

Proposed Implementation:
Integrate Swagger using libraries like swagger-jsdoc and swagger-ui-express. Include configuration options for customization.

Contributions:
I'm interested in contributing to the implementation.

Vscode Debugger is not working

Hello,

I cloned your repo and followed the installation steps. Trying to debug via vscode debugger but it's not stopping at the breakpoint. Can you please help me here?

Node version - 14.15.3

launch.json file

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Severless debug",
      "runtimeVersion": "14.15.3",
      "program": "${workspaceFolder}/node_modules/.bin/sls",
      "args": ["offline", "start", "--stage", "offline"],
      "env": { "NODE_ENV": "development" },
      "autoAttachChildProcesses": true,
      "sourceMaps": true,
      "skipFiles": ["<node_internals>/**"],
      "console": "integratedTerminal"
    }
  ]
}

No such option: -c

npm run deploy-prod

[email protected] deploy-prod
run-s deploy:*

[email protected] deploy:db
dotenv -e .env.production -c -- ts-node --esm scripts/deployDbProd.ts

Usage: dotenv [OPTIONS] COMMAND [ARGS]...
Try 'dotenv --help' for help.

Error: No such option: -c
ERROR: "deploy:db" exited with 2.

Access-Control headers missing from handler responses

Relates to #1

Any opinions on providing an example of Access-Control headers on responses coming from the handlers as part of this boilerplate?

Because Serverless is configured to respond to preflight requests, it's possible that a browser on a different origin will pass preflight requests but error when requesting to one of the handlers (especially with Content-Type: application/json):

This could be a hiccup if someone deploys the service without testing CORS locally.

Some ideas:

  • Use an Express middleware like cors
  • Provide an example sending back headers manually:
   app.get('/', (req, res) => {
     console.log(req.headers)
     res
       .set({
         'Access-Control-Allow-Origin': 'https://example.com', // '*'
       })
       .json({
         msg: 'Hello World',
       })
   });

Like #1, this might be out of scope for this boilerplate. Great project nonetheless!

`pnpm` out of the box?

pnpm gives drastically better performance than npm and would improve the developer experience, especially because of the large number of development dependencies this template uses. Thoughts?

Note that it doesn't currently work out of the box if you just try and use pnpm. Getting this error: pnpm/pnpm#3275

Workaround that I'm using:

Make a .czrc file:

{
  "path": "cz-conventional-changelog"
}

Remove relevant section from package.json:

"config": {
    "commitizen": {
      "path": "@commitlint/cz-commitlint"
    }
  },

Also set up a .npmrc like this, unsure if needed:

enable-pre-post-scripts=true
auto-install-peers=true
node-linker=hoisted

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.