{"id":29913663,"url":"https://github.com/akkaraponph/nodejs-ts-fastify-handler-service-model","last_synced_at":"2026-04-10T11:02:26.667Z","repository":{"id":39903962,"uuid":"494113492","full_name":"akkaraponph/nodejs-ts-fastify-handler-service-model","owner":"akkaraponph","description":"folder-by-type","archived":false,"fork":false,"pushed_at":"2022-07-11T02:24:14.000Z","size":396,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"node-fastify-sequelize-postgresql","last_synced_at":"2025-08-02T02:26:59.391Z","etag":null,"topics":["eslint","fastify","fastify-swagger","jest","jwt-authentication","nodejs","nodejs-server","postgresql","prettier","redis","redis-cache","rest-api","restful-api","sequelize","starter-template","swagger","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akkaraponph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-19T14:48:14.000Z","updated_at":"2024-08-20T14:11:17.000Z","dependencies_parsed_at":"2022-09-23T12:44:05.008Z","dependency_job_id":null,"html_url":"https://github.com/akkaraponph/nodejs-ts-fastify-handler-service-model","commit_stats":null,"previous_names":["akkaraponph/nodejs-ts-fastify-handler-service-model"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/akkaraponph/nodejs-ts-fastify-handler-service-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akkaraponph%2Fnodejs-ts-fastify-handler-service-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akkaraponph%2Fnodejs-ts-fastify-handler-service-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akkaraponph%2Fnodejs-ts-fastify-handler-service-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akkaraponph%2Fnodejs-ts-fastify-handler-service-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akkaraponph","download_url":"https://codeload.github.com/akkaraponph/nodejs-ts-fastify-handler-service-model/tar.gz/refs/heads/node-fastify-sequelize-postgresql","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akkaraponph%2Fnodejs-ts-fastify-handler-service-model/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31639524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["eslint","fastify","fastify-swagger","jest","jwt-authentication","nodejs","nodejs-server","postgresql","prettier","redis","redis-cache","rest-api","restful-api","sequelize","starter-template","swagger","typescript"],"created_at":"2025-08-02T02:13:14.324Z","updated_at":"2026-04-10T11:02:26.648Z","avatar_url":"https://github.com/akkaraponph.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003enodejs-app-structure-init\u003c/h3\u003e\n\u003ch4 align=\"center\"\u003eREST API\u003c/h4\u003e\n\u003cbr /\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n   \n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n## About The Project\n\u003cbr /\u003e\n\u003c!-- [![Product Name Screen Shot][product-screenshot]]() --\u003e\nApp starter REST API With Node.js Fastify MongoDB - Typescript\n\u003c/p\u003e\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n### Structure\n#### Routes-Handlers-Servicess-Structure\n```\n📦nodejs-app-structure-init\n ┣ 📂src\n ┃ ┣ 📂config\n ┃ ┃ ┣ 📂swagger\n ┃ ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┃ ┗ 📜swagger.option.ts\n ┃ ┃ ┣ 📜config.ts\n ┃ ┃ ┣ 📜database.config.ts\n ┃ ┃ ┗ 📜index.ts\n ┃ ┣ 📂errors\n ┃ ┃ ┣ 📜article.errors.ts\n ┃ ┃ ┣ 📜auth.errors.ts\n ┃ ┃ ┗ 📜index.ts\n ┃ ┣ 📂handlers\n ┃ ┃ ┣ 📜article.handler.ts\n ┃ ┃ ┣ 📜auth.handler.ts\n ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┗ 📜user.handler.ts\n ┃ ┣ 📂helpers\n ┃ ┣ 📂hooks\n ┃ ┃ ┣ 📜auth.hook.ts\n ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┗ 📜protectedRoutes.hook.ts\n ┃ ┣ 📂interfaces\n ┃ ┃ ┗ 📂types\n ┃ ┃ ┃ ┣ 📂handlers\n ┃ ┃ ┃ ┃ ┣ 📜article.handler.types.ts\n ┃ ┃ ┃ ┃ ┗ 📜auth.handler.types.ts\n ┃ ┃ ┃ ┣ 📂hooks\n ┃ ┃ ┃ ┃ ┗ 📜auth.hook.types.ts\n ┃ ┃ ┃ ┗ 📂models\n ┃ ┃ ┃ ┃ ┣ 📜article.model.types.ts\n ┃ ┃ ┃ ┃ ┗ 📜user.model.types.ts\n ┃ ┣ 📂models\n ┃ ┃ ┣ 📜article.model.ts\n ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┗ 📜users.model.ts\n ┃ ┣ 📂redis\n ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┗ 📜redisClient.ts\n ┃ ┣ 📂routes\n ┃ ┃ ┣ 📂swagger-schema\n ┃ ┃ ┃ ┣ 📜article.route.schema.ts\n ┃ ┃ ┃ ┣ 📜auth.route.schema.ts\n ┃ ┃ ┃ ┗ 📜users.route.schema.ts\n ┃ ┃ ┣ 📜article.route.ts\n ┃ ┃ ┣ 📜auth.route.ts\n ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┗ 📜users.route.ts\n ┃ ┣ 📂services\n ┃ ┃ ┣ 📜article.service.ts\n ┃ ┃ ┣ 📜index.ts\n ┃ ┃ ┗ 📜user.service.ts\n ┃ ┣ 📂utils\n ┃ ┃ ┣ 📜custom-error.ts\n ┃ ┃ ┗ 📜logger.ts\n ┃ ┣ 📜app.spec.ts\n ┃ ┗ 📜app.ts\n ┣ 📜.env\n ┣ 📜.eslintrc.ts\n ┣ 📜.gitignore\n ┣ 📜.prettierrc.ts\n ┣ 📜index.ts\n ┣ 📜jest.config.ts\n ┣ 📜package-lock.json\n ┣ 📜package.json\n ┣ 📜README.md\n ┣ 📜tsconfig.json\n ┣ 📜yarn.lock\n ┗ 📜[.]env\n```\n\n### Built With\n\n* [NodeJs](https://nodejs.org/)\n* [Sequelize](https://sequelize.org/)\n* [Posgres](https://www.postgresql.org/)\n* [Fastify](https://www.fastify.io/)\n* [Jest](https://jestjs.io/)\n* [Swagger](https://swagger.io/)\n* [Redis](https://redis.io/)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\n* models - The schema definition of the Model\n\n* routes - The API routes maps to the handlers\n\n* handlers - The handlers handles all the logic behind validating request parameters, query, Sending Responses with correct codes.\n\n* services - The services contains the database queries and returning objects or throwing errors\n\n* interfaces/types - typescript interfaces\n\n* errors - Error type definitions\n\n* utils - Frequently used utility functions\n\n[Ref.route-controller-service-structure-for-expressjs](https://sodocumentation.net/node-js/topic/10785/route-controller-service-structure-for-expressjs)\n\n\n### Prerequisites\n\n* npm\n  ```sh\n  npm install npm@latest -g\n  ```\n\n### Installation\n\n1. Clone the repo\n   ```sh\n   git clone https://github.com/billowdev/nodejs-app-structure-init.git\n   ```\n2. Install NPM packages\n   ```sh\n   npm install\n   ```\n3. Enter your ENV in `.env`\n```\n  PORT=5000 | Your port\n  JWT_SECRET=YourJWTSecret\n  NODE_ENV=development\n  CLIENT_URL=localhost\n\n  REDIS_HOST=localhost\n  REDIS_PORT=6379\n  REDIS_USERNAME=default\n  REDIS_PASSWORD=REDISPASSWORD\n  REDIS_DATABASE=0\n  REDIS_BIND=0.0.0.0\n\n  DB_USERNAME= Your username for database\n  DB_PASSWORD= Your password for database\n  DB_DATABASE_DEVELOPMENT= database name for development\n  DB_DATABASE_PRODUCTION= database name for production\n  DB_DATABASE_TEST= database name for test\n  DB_HOST=localhost | your host\n  DB_DIALECT=postgres | mysql | your dialect\n\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakkaraponph%2Fnodejs-ts-fastify-handler-service-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakkaraponph%2Fnodejs-ts-fastify-handler-service-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakkaraponph%2Fnodejs-ts-fastify-handler-service-model/lists"}