All Projects → Codigami → Hapi Starter Kit

Codigami / Hapi Starter Kit

Licence: mit
Hapi.js based REST boilerplate which uses latest ES7/ES8 features (async/await) with code coverage and follows best pratices

Programming Languages

javascript
184084 projects - #8 most used programming language
es7
32 projects

Projects that are alternatives of or similar to Hapi Starter Kit

Testing Hapi
Hapi style guide compliant boilerplate (updated to v17!)
Stars: ✭ 90 (-12.62%)
Mutual labels:  swagger, eslint, hapi, boilerplate, travis-ci
Iceberg
Front-End Boilerplate built with React + Babel + Webpack + SASS
Stars: ✭ 144 (+39.81%)
Mutual labels:  eslint, starter-kit, boilerplate, travis-ci
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 (+2629.13%)
Mutual labels:  eslint, yarn, boilerplate, mocha
Node Developer Boilerplate
🍭 Boilerplate for ES6+ Node.js and npm Developer
Stars: ✭ 82 (-20.39%)
Mutual labels:  yarn, boilerplate, travis-ci
nest-boilerplate
Nest.js boilerplate with CircleCI, Commitizen, Commitlint, Docker-Compose, ESLint, GitHub Actions, Husky, Lint-staged, OpenAPI, Prettier, PostGreSQL, Travis CI, TypeORM
Stars: ✭ 16 (-84.47%)
Mutual labels:  eslint, travis-ci, docker-compose
Simple React App
Simple base app using react, react-router v4, hot-reload & sass.
Stars: ✭ 263 (+155.34%)
Mutual labels:  eslint, yarn, boilerplate
React Starter Kit
React, Redux, Webpack, Material UI, Boostrap 4, Code Splitting, HMR
Stars: ✭ 229 (+122.33%)
Mutual labels:  eslint, starter-kit, boilerplate
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+18081.55%)
Mutual labels:  eslint, starter-kit, boilerplate
Flask Api Starter Kit
Start a Flask API in less than 5 minutes
Stars: ✭ 296 (+187.38%)
Mutual labels:  swagger, starter-kit, boilerplate
Cpp Project
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
Stars: ✭ 328 (+218.45%)
Mutual labels:  boilerplate, travis-ci, code-coverage
Node Express Mongodb Jwt Rest Api Skeleton
This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API). Demo of frontend in VueJS here: https://github.com/davellanedam/vue-skeleton-mvp
Stars: ✭ 603 (+485.44%)
Mutual labels:  eslint, async-await, mocha
Laravel Boilerplate
Laravel Boilerplate / Starter Kit with Gentelella Admin Theme
Stars: ✭ 704 (+583.5%)
Mutual labels:  starter-kit, boilerplate, docker-compose
react-simple-boilerplate
Simple React Boilerplate with Webpack, Github Actions, Scss, Lazy Loading etc....
Stars: ✭ 38 (-63.11%)
Mutual labels:  yarn, eslint, travis-ci
Go Micro Boilerplate
The boilerplate of the GoLang application with a clear microservices architecture.
Stars: ✭ 147 (+42.72%)
Mutual labels:  swagger, boilerplate, docker-compose
React Native Navigation Redux Starter Kit
React Native Navigation(v2) Starter Kit with Redux, Saga, ESLint, Babel, Jest and Facebook SDK 😎
Stars: ✭ 271 (+163.11%)
Mutual labels:  eslint, starter-kit, boilerplate
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+3178.64%)
Mutual labels:  starter-kit, yarn, boilerplate
Wordpress Starter
📦 A starter template for WordPress websites
Stars: ✭ 26 (-74.76%)
Mutual labels:  starter-kit, yarn, docker-compose
Js Stack Boilerplate
Final boilerplate code of the JavaScript Stack from Scratch tutorial –
Stars: ✭ 145 (+40.78%)
Mutual labels:  eslint, yarn, boilerplate
React Redux Universal Boilerplate
An Universal ReactJS/Redux Boilerplate
Stars: ✭ 165 (+60.19%)
Mutual labels:  eslint, boilerplate, mocha
Nodejs Api Boilerplate
A boilerplate for kickstart your nodejs api project with JWT Auth and some new Techs :)
Stars: ✭ 364 (+253.4%)
Mutual labels:  eslint, boilerplate, docker-compose

Hapi Starter Kit | Hapi based REST application boilerplate, uses async/await

Build Status Code Climate Test Coverage bitHound Overall Score bitHound Dependencies MIT License PRs Welcome

Overview

A lean boilerplate application for building RESTful APIs (Microservice) in Node.js using hapi.js. Follows industry standard best practices, and uses latest async/await ES8 feature. Bring your own front-end. Plug-in your own Database.

Features

Feature Summary
Uses latest ES8/ES2017 features (async/await) Uses latest ES7 and ES8 features including async/await
Application Configuration via config Node-config organizes hierarchical configurations for your app deployments. It lets you define a set of default parameters, and extend them for different deployment environments (development, qa, staging, production, etc.).
Auto Documentation via hapi-swagger This will self document the API interface. You can also tests your APIs using the Swagger interface.
Unit and Integration Tests via Mocha with async/await Demo unit and integration tests using latest ES7/ES8 features.
Code Coverage via istanbul Supports code coverage of ES8 code using istanbul and mocha. Code coverage reports are saved in coverage/ directory post yarn test execution. Open coverage/lcov-report/index.html to view coverage report. yarn test also displays code coverage summary on console. Code coverage can also be enforced overall and per file as well, configured via .istanbul.yml
Logging via bunyan Bunyan is simple and fast JSON logging library. Logs timestamp, machine name and process ID and most importantly makes it really easy to parse logs as it logs in JSON format. You can selectively turn on/off logs by setting log level via LOG_LEVEL env variable.
Code Linting via Standard JavaScript code linting is done using ESLint - a pluggable linter tool for identifying and reporting on patterns in JavaScript.
API parameter validation via joi Validate body, params, query, headers and cookies of a request (via middleware) and return a response with errors; if any of the configured validation rules fail. You won't anymore need to make your route handler dirty with such validations.
Application monitoring via New Relic Set NEW_RELIC_APP_NAME and NEW_RELIC_LICENSE_KEY environment variables in production environment to get metrics in New Relic Dashboard
Pre-commit hooks via husky Runs lint and tests before any commit is made locally, making sure that only tested and quality code goes through
Uses Sinon for spies, stubs and mocks Standalone and test framework agnostic JavaScript test spies, stubs and mocks
Uses nock for mocking http requests in integration tests Nock is an HTTP mocking and expectations library. It can be used to test modules that perform HTTP requests in isolation.
Uses yarn over npm Uses new released yarn package manager by facebook. You can read more about it here
Docker compatible Docker and Docker Compose files to develop and deploy via Docker
Uses EditorConfig EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs

Requirements

  • node.js >= 8.4.0
  • yarn >= 0.27.5
  • docker
    • Docker is optional and is required only if you want to develop and deploy using Docker

Getting Started

# Install dependencies
$ yarn

yarn

# Start Server
# Set environment variables defined in `config/custom-environment-variables.json` like `OPEN_WEATHER_API_KEY=xxx`
$ yarn start

yarn start

# Try GET /ping to make sure server is up
$ curl http://localhost:3030/ping
# Run Tests
$ yarn test

yarn test

Docker

Development

# copy sample.dev.env to dev.env
$ cp bin/sample.dev.env bin/dev.env
# Start Server
$ bash bin/development.sh

Docker Development

Tests

# copy sample.test.env to test.env
$ cp bin/sample.test.env bin/test.env
# Run Tests
$ bash bin/test.sh

docker test

Environment Configuration

config is used to configure application.

  • Default values of environment variables, which are common across all environments can be configured via config/default.json
  • Values specific to a particular environment can be set by creating a file with same name in config directory. Like config/test/json for test environment.
  • config/custom-environment-variables is used to read values from environment variables. For ex. if APP_PORT env var is set it can be accessed as config.get('app.port'). You can read more on custom environment variables here.

More Tasks

# Run lint
yarn lint

yarn lint

Deployment

  • Simply set environment variables defined in bin/sample.dev.env in your own environment (AWS, Heroku etc) and yarn start

Docker

  • Build the docker image
    • docker build -t hapi-starter-kit-oss .
  • Start Docker Container
    • docker run -d -p 3030:3030 --name hapi-starter-kit-oss hapi-starter-kit-oss

Documentation

  • hapi-swagger self documents all the APIs.
  • Visit http://localhost:3030/documentation to access the documentation after starting the server. Documentation

Miscellaneous

  • To turn off logs getting logged via good-console in development environment, remove it from plugins.js

Issues

Please feel free to open an issue if you can have any questions or trouble using this starter kit.

Contributions

Contributions are all welcome and encouraged. For code contributions submit a pull request with unit test.

License

This project is licensed under the MIT License

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