All Projects → vmasto → Express Babel

vmasto / Express Babel

Licence: mit
Express starter kit with ES2017+ support, testing, linting, and code coverage

Programming Languages

javascript
184084 projects - #8 most used programming language
es6
455 projects
es2015
71 projects
es2017
19 projects

Projects that are alternatives of or similar to Express Babel

Js Stack Boilerplate
Final boilerplate code of the JavaScript Stack from Scratch tutorial –
Stars: ✭ 145 (-76.65%)
Mutual labels:  eslint, babel, express, boilerplate, jest
Express React Boilerplate
🚀🚀🚀 This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (-94.85%)
Mutual labels:  eslint, babel, express, boilerplate, jest
Express Mongoose Es6 Rest Api
💥 A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication
Stars: ✭ 2,811 (+352.66%)
Mutual labels:  eslint, babel, express, boilerplate, coverage
Express Webpack React Redux Typescript Boilerplate
🎉 A full-stack boilerplate that using express with webpack, react and typescirpt!
Stars: ✭ 156 (-74.88%)
Mutual labels:  heroku, eslint, babel, express, jest
Mostly
They mostly come at night; mostly.
Stars: ✭ 78 (-87.44%)
Mutual labels:  eslint, babel, express, jest
React Native Navigation Redux Starter Kit
React Native Navigation(v2) Starter Kit with Redux, Saga, ESLint, Babel, Jest and Facebook SDK 😎
Stars: ✭ 271 (-56.36%)
Mutual labels:  eslint, babel, boilerplate, jest
React
Extremely simple boilerplate, easiest you can find, for React application including all the necessary tools: Flow | React 16 | redux | babel 6 | webpack 3 | css-modules | jest | enzyme | express + optional: sass/scss
Stars: ✭ 244 (-60.71%)
Mutual labels:  babel, express, boilerplate, jest
React Bolt
⚡ The most simple & robust boilerplate for your React projects.
Stars: ✭ 298 (-52.01%)
Mutual labels:  eslint, babel, boilerplate, jest
Node Typescript Boilerplate
Minimalistic project template to jump start a Node.js back-end application in TypeScript. ESLint, Jest and type definitions included.
Stars: ✭ 1,061 (+70.85%)
Mutual labels:  eslint, express, boilerplate, jest
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+2915.62%)
Mutual labels:  eslint, babel, boilerplate, jest
React Pages Boilerplate
Deliver react + react-router application to gh-pages
Stars: ✭ 134 (-78.42%)
Mutual labels:  eslint, babel, boilerplate, jest
Iceberg
Front-End Boilerplate built with React + Babel + Webpack + SASS
Stars: ✭ 144 (-76.81%)
Mutual labels:  eslint, babel, boilerplate, jest
React Redux Saucepan
A minimal and universal react redux starter project. With hot reloading, linting and server-side rendering
Stars: ✭ 86 (-86.15%)
Mutual labels:  eslint, babel, express, boilerplate
Nodebestpractices
✅ The Node.js best practices list (December 2021)
Stars: ✭ 72,734 (+11612.4%)
Mutual labels:  eslint, express, expressjs, jest
Pwa
An opinionated progressive web app boilerplate
Stars: ✭ 353 (-43.16%)
Mutual labels:  eslint, babel, boilerplate, jest
Fraternate
Fraternate is a standalone copy of the GitHub organization and user interaction framework. Built with Mongo dB | Node.js® | Express.js | Handlebars.js | Bootstrap.
Stars: ✭ 130 (-79.07%)
Mutual labels:  heroku, expressjs, boilerplate
Simple React App
Simple base app using react, react-router v4, hot-reload & sass.
Stars: ✭ 263 (-57.65%)
Mutual labels:  eslint, boilerplate, jest
Reactly Starter Kit
Deployable React + Webpack 2 starter kit
Stars: ✭ 122 (-80.35%)
Mutual labels:  heroku, babel, express
Rockpack
Rockpack is a simple solution for creating React Application with Server Side Rendering, bundling, linting, testing within 5 minutes
Stars: ✭ 265 (-57.33%)
Mutual labels:  eslint, boilerplate, jest
Threejs Webpack Es6 Boilerplate
A basic boilerplate for a Three.js project compiled with Webpack and transpiled via Babel to enable using ES6 syntax.
Stars: ✭ 267 (-57%)
Mutual labels:  eslint, babel, boilerplate

Express.js with Babel Boilerplate

Code Climate Dependencies Status Dev Dependencies Status

A mostly unopinionated starter project for using Babel and ES2017+ features in a Node.js server environment as well as providing linting and testing solutions. It provides the setup for compiling, linting and testing your code but doesn't make any further assumptions on how your project should be structured.

It's a small improvement over Babel's official approach and express-generator.

Make sure you read the FAQ for more details and info.

Features:

Getting started

# Clone the project
git clone [email protected]:vmasto/express-babel.git
cd express-babel

# Make it your own
rm -rf .git && git init && npm init

# Install dependencies
npm install

# or if you're using Yarn
yarn

Then you can begin development:

# yarn
yarn run dev

# npm
npm run dev

This will launch a nodemon process for automatic server restarts when your code changes.

Testing

Testing is powered by Jest. This project also uses supertest for demonstrating a simple routing smoke test suite. Feel free to remove supertest entirely if you don't wish to use it.

Start the test runner in watch mode with:

# yarn
yarn test

# npm
npm test

You can also generate coverage with:

# yarn
yarn test --coverage

# npm
npm test -- --coverage

Linting

Linting is set up using ESLint. It uses ESLint's default eslint:recommended rules. Feel free to use your own rules and/or extend another popular linting config (e.g. airbnb's or standard).

Begin linting in watch mode with:

# yarn
yarn run lint

# npm
npm run lint

To begin linting and start the server simultaneously, edit the package.json like this:

"dev": "nodemon src/index.js --exec \"node -r dotenv/config -r babel-register\" | npm run lint"

Environmental variables in development

The project uses dotenv for setting environmental variables during development. Simply copy .env.example, rename it to .env and add your env vars as you see fit.

It is strongly recommended never to check in your .env file to version control. It should only include environment-specific values such as database passwords or API keys used in development. Your production env variables should be different and be set differently depending on your hosting solution. dotenv is only for development.

Deployment

Deployment is specific to hosting platform/provider but generally:

# yarn
yarn run build

# npm
npm run build

will compile your src into /dist, and

# yarn
yarn start

# npm
npm start

will run build (via the prestart hook) and start the compiled application from the /dist folder.

The last command is generally what most hosting providers use to start your application when deployed, so it should take care of everything.

You can find small guides for Heroku, App Engine and AWS in the deployment document.

Tips / Debugging

FAQ

Where is all the configuration for ESLint, Jest and Babel?

In package.json. Feel free to extract them in separate respective config files if you like.

Why are you using babel-register instead of babel-node?

babel-node contains a small "trap", it loads Babel's polyfill by default. This means that if you use something that needs to be polyfilled, it'll work just fine in development (because babel-node polyfills it automatically) but it'll break in production because it needs to be explicitely included in Babel's CLI which handles the final build.

In order to avoid such confusions, babel-register is a more sensible approach in keeping the development and production runtimes equal. By using babel-preset-env only code that's not supported by the running environment is transpiled and any polyfills required are automatically inserted.

Should I use this?

Full disclosure: If you have to ask perhaps you should reconsider. There is some debate on whether to use Babel-transpiled code on the server or not. Personally, I think it's fine and I've found this setup to be a sensible approach in doing so. That said, I'd suggest to take anything you read online with a grain of salt and refrain from blindly using boilerplates without first investigating personally.

Node is very rapidly converging with the latest ECMAScript specification, and there's mostly full native support for ES2015 and ES2016. The need to transpile on the server is way smaller nowadays, albeit the language is constantly improving and transpiling will probably always be a part of our workflow. At the time of this writing the main benefits are mainly ES6 module syntax and async/await without flags.

In any case, you can simply remove transpilation and keep everything else that this kit has to offer.

If you see anything that needs improvement feel free to open an issue for discussion!

You can also find me on twitter at @vmasto.

License

MIT License. See the LICENSE file.

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].