Skip to content

Skeleton For Spinning Up Backend Node.js Hapi Servers

Notifications You must be signed in to change notification settings

knledg/node-hapi-skeleton

Repository files navigation

Node Hapi Skeleton

Node Hapi Skeleton is a Node.js server running with the Hapi framework.

Interface

  • Utilizes a Swagger interface to easily test all HTTP endpoints. Swagger self-documents your HTTP endpoints to make it easy for your frontend developers to access data. Localhost Swagger
  • Structured to easily support versioning of endpoints

GraphQL w/ GraphiQL

  • Implements a GraphQL endpoint to fetch/search your records/collections Localhost Graphql

Validation

  • Utilizes Joi Validation to easily test that the users' payloads are what you expect them to be.

Processes

The framework is setup to run three processes: web, crons, and workers.

  • Web
    • Will boot up the Hapi server and Swagger interface
  • Crons
    • These are processes that run in the background at set intervals
  • Workers

Logging

  • Supports sending all server logs to Logentries if a LOGENTRIES_TOKEN is present.
  • Supports sending uncaught/unhandled errors to Rollbar if a ROLLBAR_TOKEN is present.

Database

  • Utilizes Mariner to easily create database migrations using raw SQL statements instead of from a module.
  • Utilizes Knex to handle your more robust queries
  • Pre-built Hapi Pre functions to handle the bulk of your standard REST database queries automatically.
    • Fetch
    • Search
    • Upsert
    • Delete

To Start The Web Server

  • npm install
  • cp dev.env .env
  • Get .env vars from another developer
  • docker-compose up -d
  • make web

Required Dependencies

  • Docker for Postgres and RabbitMQ

About

Skeleton For Spinning Up Backend Node.js Hapi Servers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published