{"id":25615199,"url":"https://github.com/wednesday-solutions/nodejs-hapi-template","last_synced_at":"2025-08-01T23:10:16.206Z","repository":{"id":40290980,"uuid":"227324688","full_name":"wednesday-solutions/nodejs-hapi-template","owner":"wednesday-solutions","description":"A Nodejs hapi boilerplate application with out of the box support for Docker, Redis cache, DB migrations and seeders, rate limiting, and paginated endpoints.","archived":false,"fork":false,"pushed_at":"2024-10-08T11:00:52.000Z","size":2439,"stargazers_count":30,"open_issues_count":7,"forks_count":20,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-13T21:13:07.656Z","etag":null,"topics":["authentication","database","dockerization","hapi","mysql","sequelize","swagger","swaggerui","wurst"],"latest_commit_sha":null,"homepage":"https://wednesday.is/building-products/?utm_source=github\u0026utm_medium=nodejs-hapi-template","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/wednesday-solutions.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-12-11T09:20:43.000Z","updated_at":"2024-08-25T07:50:28.000Z","dependencies_parsed_at":"2025-04-13T21:13:09.053Z","dependency_job_id":"1a9b62ba-9905-43a0-915a-5e303f2adde8","html_url":"https://github.com/wednesday-solutions/nodejs-hapi-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/wednesday-solutions/nodejs-hapi-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wednesday-solutions%2Fnodejs-hapi-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wednesday-solutions%2Fnodejs-hapi-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wednesday-solutions%2Fnodejs-hapi-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wednesday-solutions%2Fnodejs-hapi-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wednesday-solutions","download_url":"https://codeload.github.com/wednesday-solutions/nodejs-hapi-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wednesday-solutions%2Fnodejs-hapi-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268310797,"owners_count":24230185,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["authentication","database","dockerization","hapi","mysql","sequelize","swagger","swaggerui","wurst"],"created_at":"2025-02-22T03:18:52.144Z","updated_at":"2025-08-01T23:10:16.187Z","avatar_url":"https://github.com/wednesday-solutions.png","language":"JavaScript","readme":"\u003cimg align=\"left\" src=\"https://github.com/wednesday-solutions/nodejs-hapi-template/blob/main/nodejs_hapi_template_github.svg\" width=\"480\" height=\"560\" /\u003e\n\n\u003cdiv\u003e\n  \u003ca href=\"https://www.wednesday.is/?utm_source=github\u0026utm_medium=nodejs-hapi-template\" align=\"left\" style=\"margin-left: 0;\"\u003e\n    \u003cimg src=\"https://uploads-ssl.webflow.com/5ee36ce1473112550f1e1739/5f5879492fafecdb3e5b0e75_wednesday_logo.svg\"\u003e\n  \u003c/a\u003e\n  \u003cp\u003e\n    \u003ch1 align=\"left\"\u003eNode Hapi Template\n    \u003c/h1\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\nAn enterprise Hapi template application built using Nodejs showcasing - Testing Strategies, DB seeding \u0026 migrations, integration with an ORM, containerization using Docker, REST Apis, a middleware for authorization, redis caching, rate limited endpoints, paginated endpoints, and directory based routing\n  \u003c/p\u003e\n\n---\n\n  \u003cp\u003e\n    \u003ch4\u003e\n      Expert teams of digital product strategists, developers, and designers.\n    \u003c/h4\u003e\n  \u003c/p\u003e\n\n  \u003cdiv\u003e\n    \u003ca href=\"https://www.wednesday.is/contact-us/?utm_source=github\u0026utm_medium=nodejs-hapi-template\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://uploads-ssl.webflow.com/5ee36ce1473112550f1e1739/5f6ae88b9005f9ed382fb2a5_button_get_in_touch.svg\" width=\"121\" height=\"34\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/wednesday-solutions/\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://uploads-ssl.webflow.com/5ee36ce1473112550f1e1739/5f6ae88bb1958c3253756c39_button_follow_on_github.svg\" width=\"168\" height=\"34\"\u003e\n    \u003c/a\u003e\n  \u003c/div\u003e\n\n---\n\n\u003cspan\u003eWe’re always looking for people who value their work, so come and join us. \u003ca href=\"https://www.wednesday.is/hiring\"\u003eWe are hiring!\u003c/a\u003e\u003c/span\u003e\n\n\u003c/div\u003e\n\n![Nodejs Hapi Template](https://github.com/wednesday-solutions/node-js-hapi-template/workflows/Nodejs%20Hapi%20Template/badge.svg)\n\n\u003cdiv\u003e\n\u003cimg src='./badges/badge-statements.svg' height=\"20\"/\u003e\n\u003cimg src='./badges/badge-branches.svg' height=\"20\"/\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003cimg src='./badges/badge-lines.svg'  height=\"20\"/\u003e\n\u003cimg src='./badges/badge-functions.svg' height=\"20\"/\u003e\n\u003c/div\u003e\n\n---\n\n## Out of the box support for\n\n-   Dockerization\n-   Authorization middleware\n-   Redis Cache\n-   Rate Limited endpoints\n-   Paginated endpoints\n-   Swagger UI\n-   Support for directory based routing\n-   Simplified support for migrations and seeders using sequelize\n-   DAO layer for all database interactions\n-   Tests using jest\n\n## Setup and Configuration.\n\n### Pre-requisites\n\n-   node\n-   docker\n-   docker-compose\n-   mysql\n-   redis\n\n### Installation\n\n-   Install dependencies using npm\n\n    -   `npm install`\n\n### Setup\n\n-   Run `./scripts/setup-local.sh`\n-   This will seed the data in mysql and run the server.\n\n### Auto Generate models from database\n\n-   Automatically generate bare sequelize models from your database.\n    `https://github.com/sequelize/sequelize-auto`\n\nExample:\n`sequelize-auto -o \"./models\" -d temp_dev -h localhost -u root -p 3306 -x password -e mysql`\n\n### Sequelize\n\n[Sequelize](https://sequelize.readthedocs.io/en/latest/) is a promise-based ORM for Node.js. It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL and features solid transaction support, relations, read replication and more.\n\nInstall Sequelize:\n\n-   `npm install -g sequelize-cli`\n\nFull documentation: https://sequelize.readthedocs.io/en/latest/\n\n### MySQL Setup\n\nInstall MySQL\n\n-   `brew install mysql`\n\n-   This helps in accessing the database(`temp_dev`)\n\n`ALTER USER '@root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'`;\n\nTo Access mysql\n\n-   `mysql -uroot -p`\n-   This will ask for password and the altered password is `password`\n\n-   Start Server\n    `mysql.server start`\n\n-   Stop Server\n    `mysql.server stop`\n    \n### redis Setup\n\nInstall\n \n- `brew install redis`\n\nStart\n\n- `brew services start redis`\n\nStop\n\n- `brew services stop redis`\n\n\n### Migrations\n\nWith migrations you can transfer your existing database into another state and vice-versa.\n\n**Setting up Sequelize Migrations for a initial database**\n\nSteps\n\n1. Create a `resources` folder\n2. Create individual `.sql` files for each table and add it sequentially, by prefixing by 01,02 \u0026 so on.\n3. Each file should contain the proper sql syntax.\n4. Point the migration files to `/resources/v1`\n5. Run `npx sequlize db:migrate`\n\n**Structure with example**\n\n```\n    /\n        migrations/\n            20191014145811-initial-migration.js\n        resources/\n            v1/\n                01_create_school.sql\n                02_create_student.sql\n```\n\n**Database State Changes**\n\n1. Create a migration file that prefixes with the timestamp add it in the `/migrations` folder. Ex: `20191014145811-alter-student.js`\n2. Add the .sql file in the `/resources/v2`\n3. Point the new migration file to `/resources/v2`\n4. Run `npx sequlize db:migarte --name migartions/20191014145811-alter-student.js`\n\n**Structure**\n\n```\n    /\n        migrations/\n            20191015143811-initial-migration.js\n            20191014145811-alter-student.js\n        resources/\n            v1/\n                01_create_school.sql\n                02_create_student.sql\n            v2/\n                03_alter_student.sql\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwednesday-solutions%2Fnodejs-hapi-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwednesday-solutions%2Fnodejs-hapi-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwednesday-solutions%2Fnodejs-hapi-template/lists"}