npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hapi-boilerplate

v0.0.1

Published

Hapi.js boilerplate

Downloads

5

Readme

hapi-boilerplate

Hapi.js boilerplate

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install hapi-boilerplate --save

Tests

npm install
npm test

Build (production)

npm build

Start (production)

npm start --production

Development

npm run watch # run build and continously watch files for changed and rebuild
npm run server # run server and auto reload when file change
npm run mocha # run all test cases (lighter than "npm test")

Project structure

└ project
  ├ src/                    # <-- Directory contains all source code
  | |
  | ├ components/           # <-- Directory contains all helpers/utilities
  | |                       #     which don't depend on hapi.js
  | | |
  | | ├ config.js           # <-- Helper to load config from config.js file and
  | | |                     #     parse base on NODE_ENV environment variable.
  | | |                     #     Using confidence.
  | | |
  | | ├ knex.js             # <-- Return an instance of knex.
  | | |
  | | ├ orm.js              # <-- Simple module to wrap bookshelf Model to
  | | |                     #     provide some utilities functions like
  | | |                     #     validation.
  | | |
  | | ├ redis.js            # <-- Return an instance of redis. Also provide
  | | |                     #     promise interface.
  | | |
  | | ├ resolveAllOf.js     # <-- Helper to resolve "allOf" in json schema.
  | | |
  | | └ ...
  | |
  | ├ controllers/          # <-- Directory contains all controllers (hapi
  | |                       #     handler functions)
  | |
  | ├ db/                   # <-- Directory contains db configuration,
  | | |                     #     migrations, seed files to work with both
  | | |                     #     application and knex command line.
  | | |
  | | ├ migrations/         # <-- Directory contains migration files. Read
  | | |                     #     knex.js docs for more information.
  | | |
  | | ├ seeds/              # <-- Directory contains seed files. Read knex.js
  | | |                     #     docs for more information.
  | | |
  | | └ knexfile.js         # <-- knex configuration file. Read knex.js docs
  | |                       #     for more information.
  | |
  | ├ models/               # <-- Directory contains all models.
  | |
  | ├ modules/              # <-- Directory contains all modules which work
  | | |                     #     as hapi.js plugin
  | | |
  | | ├ apiLoader.js        # <-- Loader swagger config and generate hapi.js
  | | |                     #     route config.
  | | |
  | | ├ asyncHandler.js     # <-- Hapi.js plugin to help write route handlers
  | | |                     #     using async/await more naturally.
  | | |
  | | └ ...
  | |
  | ├ schemas/              # <-- Directory contains schemas of api & models.
  | | |
  | | ├ api.swagger.yaml    # <-- Root api file, defines all routes here.
  | | |
  | | ├ common.yaml         # <-- Include common parameters for api.
  | | |
  | | └ models/             # <-- Directory contains all models definitions.
  | |   |
  | |   ├ common.yaml       # <-- Include common properties for all models.
  | |   |
  | |   └ ...
  | |
  | ├ config.js             # <-- Application config file, using "confidence".
  | |
  | ├ index.js              # <-- Application entry, contains "main" function,
  | |                       #     load hapi.js server(with plugins) and start.
  | |
  | └ routes.js             # <-- Mapping from swagger operationId to handler
  |                         #     method in controllers.
  |
  ├ test/                   # <-- Directory contains all test files. (Files
  | |                       #     with name "*.spec.js" will be run when test)
  | |
  | ├ common/               # <-- Directory contains some helpers included
  | |                       #     in many test cases.
  | |
  | └ ...
  |
  ├ scripts/                # <-- Directory contains webpack build scripts.
  | |                       #     (Some advanced & confusing shit.)
  | |
  | └ ...
  |
  ├ lib/                    # <-- Auto generated directory contains compiled
  |                         #     library to use in production.
  |
  ├ build/                  # <-- Auto generated directory contains compiled
  |                         #     artifacts for test & dev.
  |
  ├ coverage/               # <-- Auto generated directory contains code
  |                         #     coverage information.
  |
  ├ .babelrc                # <-- Babel configuration file.
  |
  ├ .eslintignore           # <-- ESLint ignore file.
  |
  ├ .eslintrc               # <-- ESLint configuration file.
  |
  ├ index.js                # <-- Entry file. Load in build if NODE_ENV is
  |                         #     "development" or lib if NODE_ENV is "production"
  |
  ├ package.json            # <-- npm configuration file. Contains magic.
  |
  ├ README.md               # <-- This stupid file.
  |
  └  ...

Dependencies

  • bluebird: Full featured Promises/A+ implementation with exceptionally good performance
  • bookshelf: A lightweight ORM for PostgreSQL, MySQL, and SQLite3
  • boom: HTTP-friendly error objects
  • confidence: Configuration API
  • good: Server and process monitoring plugin
  • good-console: Console broadcasting for Good process monitor
  • hapi: HTTP Server framework
  • hapi-swaggered-ui: Easy swagger-ui drop-in plugin for hapi to be used with hapi-swaggered.
  • inert: Static file and directory handlers plugin for hapi.js
  • joi: Object schema validation
  • knex: A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser
  • lodash: Lodash modular utilities.
  • mysql: A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.
  • redis: Redis client library
  • source-map-support: Fixes stack traces for files with source maps
  • sqlite3: Asynchronous, non-blocking SQLite3 bindings
  • swagger-parser: Swagger 2.0 parser and validator for Node and browsers
  • uuid: Rigorous implementation of RFC4122 (v1 and v4) UUIDs.
  • vision: Templates rendering plugin support for hapi.js

Dev Dependencies

License

MIT

Generated by package-json-to-readme