{"id":26331490,"url":"https://github.com/iniva/hapi-api-base","last_synced_at":"2026-05-10T07:39:50.717Z","repository":{"id":54267522,"uuid":"128752200","full_name":"iniva/hapi-api-base","owner":"iniva","description":"Base code for APIs based on Hapi","archived":false,"fork":false,"pushed_at":"2021-02-28T09:46:46.000Z","size":1107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-02T01:06:30.271Z","etag":null,"topics":["api","docker","hapijs","rest-api","yarn"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iniva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-09T10:05:56.000Z","updated_at":"2021-02-28T09:46:48.000Z","dependencies_parsed_at":"2022-08-13T10:30:59.344Z","dependency_job_id":null,"html_url":"https://github.com/iniva/hapi-api-base","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fhapi-api-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fhapi-api-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fhapi-api-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fhapi-api-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iniva","download_url":"https://codeload.github.com/iniva/hapi-api-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801604,"owners_count":20350106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","docker","hapijs","rest-api","yarn"],"created_at":"2025-03-15T22:37:48.747Z","updated_at":"2025-10-29T23:02:21.281Z","avatar_url":"https://github.com/iniva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e :warning: This won't be updated anymore\n\n# Hapi API Base \u003c!-- omit in toc --\u003e\nBase code I found myself always using when starting an API based on [Hapi](https://hapijs.com/)\n\n- [Getting Started](#getting-started)\n  - [Running the project from your Host machine](#running-the-project-from-your-host-machine)\n  - [Running the project using Docker Compose](#running-the-project-using-docker-compose)\n- [Available commands](#available-commands)\n  - [yarn start:[environment]](#yarn-startenvironment)\n  - [yarn clean](#yarn-clean)\n  - [yarn build](#yarn-build)\n  - [yarn build:docs](#yarn-builddocs)\n  - [yarn test](#yarn-test)\n  - [yarn lint](#yarn-lint)\n  - [yarn bump:version](#yarn-bumpversion)\n  - [yarn commit](#yarn-commit)\n- [Databases](#databases)\n  - [MongoDB (NoSQL)](#mongodb-nosql)\n  - [ORM (SQL)](#orm-sql)\n- [Local Development with HTTPS](#local-development-with-https)\n- [Documentation](#documentation)\n# Getting Started\n**Clone this repo**\n```\n~$ git clone git@github.com:iniva/hapi-api-base.git\n```\n\n## Running the project from your Host machine\nTo use your machine to run everything you will need:\n* Node **LTS versions** like _Carbon_ or _Dubnium(**recommended**)_. Using [nvm](https://github.com/creationix/nvm) is easy and recommended\n* **Mac**\n    * Run `brew install nvm`\n* **Ubuntu**\n    * For the latest version check [nvm releases](https://github.com/creationix/nvm/releases)\n    *   ```\n        curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash\n        source ~/.profile\n        ```\n* **Both**\n    \u003e Using lts/dubnium\n\n    * Run `nvm install lts/dubnium --latest-npm` to install the current LTS version of Node. Also, attempt to install the latest npm version\n    * Run `nvm use lts/dubnium` to set Node to use this version\n    * Run `yarn install` to install the project dependencies\n    * Run `yarn start:development` to start the API [see below for more options](#available-commands)\n    * By default the API will listen to [http://0.0.0.0:8091](http://0.0.0.0:8091)\n\n## Running the project using Docker Compose\nTo use Docker Compose you will need:\n* **On Mac**: [Get Docker for Mac](https://docs.docker.com/docker-for-mac/install/)\n* **On Ubuntu**: You will need to install Docker and then Docker compose\n    * [Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce)\n    * [Compose](https://docs.docker.com/compose/install/#install-compose):\n    Follow the instructions on the **Linux** tab\n\n* On the terminal, go to project's folder:\n    * Duplicate the file `.env.example` and rename it to `.env`\n    * Fill the available environment variables to your needs or leave them with their defaults\n    * To avoid permission conflicts between the host machine and the node container you need to change the **_UID_** values in the `.env` file.\n        ```bash\n        ╰─$ id\n        # uid=1000(username) gid=1000(username)\n        ```\n    * Run `docker-compose build` to build the containers\n    * Run `docker-compose up -d` to keep the process on background\n    * Use `./run.sh server \"{{command}}\"` to start the server. e.g:\n        ```bash\n        ╰─$ ./run.sh server \"yarn start:development\"\n        ```\n\n\n# Available commands\n\n## yarn start:[environment]\nStart API server in _environment_ mode listening on port 8091\n* Environments:\n  * development\n  * production\n\n## yarn clean\nRemove build files\n\n## yarn build\nGenerate build files (**dist** folder)\n\n## yarn build:docs\nGenerate (or update) the `openapi.yaml` file.\n\n## yarn test\nRun the test suites\n\n## yarn lint\nRun lint tool\n\n## yarn bump:version\nGenerate a new version tag. Also runs the `build:docs` command to update the `openapi.yaml` file with the new API version.\n\n## yarn commit\nHelps you make commit messages using the project standardized format\n\n# Databases\n## MongoDB (NoSQL)\nUsing [hapi-nosql-mongoose](https://github.com/iniva/hapi-nosql-mongoose) plugin\n\n## ORM (SQL)\nFor ORM databases (MySQL, Postgres, etc) you can implement [hapi-sequelize-orm](https://github.com/iniva/hapi-sequelize-orm) plugin\n\n# Local Development with HTTPS\nYou can use HTTPS locally with the help of [mkcert](https://github.com/FiloSottile/mkcert). Follow the instructions to install **mkcert** on your OS. Then you can create your own certs like this:\n* (`optional`) if you didn't already, run\n  ```\n  mkcert -install\n  ```\n* Create certs for `localhost` and `0.0.0.0`\n  ```\n  mkcert localhost 0.0.0.0\n  ```\n  \u003e If you create certs for domains other than `localhost` you would need to update the name of the certs in `config/development.js`\n\n# Documentation\nI use this [implementation](https://github.com/iniva/modular-openapi-docs-boilerplate) to document the API based on the OpenAPI spec.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finiva%2Fhapi-api-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finiva%2Fhapi-api-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finiva%2Fhapi-api-base/lists"}