{"id":28258528,"url":"https://github.com/olehxch/rest-api-handlers","last_synced_at":"2026-04-29T01:03:26.773Z","repository":{"id":223479040,"uuid":"756381540","full_name":"olehxch/rest-api-handlers","owner":"olehxch","description":"Enhancing REST API Handlers Organization for Node.js Microservices","archived":false,"fork":false,"pushed_at":"2025-08-31T11:29:56.000Z","size":33361,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-31T13:19:30.275Z","etag":null,"topics":["api-router","architecture","microservices","nodejs","software"],"latest_commit_sha":null,"homepage":"https://link.springer.com/article/10.1007/s42979-025-04311-8","language":"JavaScript","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/olehxch.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-12T15:00:50.000Z","updated_at":"2025-08-31T11:29:59.000Z","dependencies_parsed_at":"2024-02-21T09:39:37.485Z","dependency_job_id":"d1922fd2-e6e9-4881-9dc1-fa15eeb83799","html_url":"https://github.com/olehxch/rest-api-handlers","commit_stats":null,"previous_names":["olehxch/microservice-rest-api-routing","olehxch/rest-api-handlers"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/olehxch/rest-api-handlers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olehxch%2Frest-api-handlers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olehxch%2Frest-api-handlers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olehxch%2Frest-api-handlers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olehxch%2Frest-api-handlers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olehxch","download_url":"https://codeload.github.com/olehxch/rest-api-handlers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olehxch%2Frest-api-handlers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"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":["api-router","architecture","microservices","nodejs","software"],"created_at":"2025-05-20T01:14:58.161Z","updated_at":"2026-04-29T01:03:26.765Z","avatar_url":"https://github.com/olehxch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enhancing REST API Handlers Organization for Node.js Microservices\n\n## Introduction\n\nThis repository contains source code for the research titled [\"Enhancing REST API Handlers Organization for Node.js Microservices.\"](https://link.springer.com/article/10.1007/s42979-025-04311-8)\n\n## Project Structure\n\nThe project structure contains:\n\n- **[assets](./assets)** - Folder with additional images and files\n- **[frameworks](./frameworks)** - This folder contains the source code of the five services with their native routing methods implemented for comparison purposes (Express.js, Koa, Hapi.js, Next.js, Nest.js)\n- **[proposed-approach](./proposed-approach)** - This folder contains the source code of the proposed approach described in the research paper\n- **[proposed-approach-huge](./proposed-approach-huge)** - This folder contains the source code of the proposed approach described in the research paper with 938 API handlers for performance testing\n\n## How to run approaches\n### How to run an author's proposed approach\n\nOpen terminal in the folder `/proposed-approach` folder and run `npm start`. After a successful start a text `Server listening on port 3000` should appear in the console. \n\n### How to run a Express.js native routing approach\n\nOpen terminal in the folder `/frameworks/express` folder and run `npm start`. After a successful start a text `Server listening on port 3000` should appear in the console. \n\n### How to run a Koa native routing approach\n\nOpen terminal in the folder `/frameworks/koa` folder and run `npm start`. Application will wait for the network requests and no logs expected.\n\n### How to run a Hapi.js native routing approach\n\nOpen terminal in the folder `/frameworks/hapi` folder and run `npm start`. After a successful start a text `Server running on http://localhost:3000` shosuld appear in the console.\n\n### How to run a Nest.js native routing approach\n\nOpen terminal in the folder `/frameworks/nest` folder and run `npm start`. After a successful start a full log with initialized routes should appear in the console. \n\n### How to run a Next.js native routing approach\n\nOpen terminal in the folder `/frameworks/next` folder. To run a production build execute `npm start`. To run a development build run `npm run dev`. After a successful start a text `Ready in 297ms` should appear in the console. \n\n## Implemented REST API\n\n| Method | Handler                     | Path                          |\n|--------|-----------------------------|-------------------------------|\n| DELETE | DeleteSatellite             | `/satellites/:id`             |\n| GET    | GetSatelliteSpecificDetail  | `/satellites/:id/details/:detailId` |\n| GET    | GetSatelliteDetails         | `/satellites/:id/details`     |\n| GET    | GetSatellite                | `/satellites/:id`             |\n| PATCH  | PartialUpdateSatellite      | `/satellites/:id`             |\n| PUT    | UpdateSatellite             | `/satellites/:id`             |\n| GET    | ListSatellites              | `/satellites`                 |\n| POST   | AddSatellite                | `/satellites`                 |\n\n## Testing\n\n### Code Complexity\n\n1. Open terminal in the root folder\n2. Run the [code_complexity.sh](./code_complexity.sh) file\n\nThis file will generate code complexity metrics for each approach. Two files will be generated: `code_complexity.html` and `code_complexity.txt` in the root folders of each framework and approach. Please check `code_complexity.txt` for detailed descriptions.\n\n| Framework        | Average Code Complexity | Explicit Route Mapping | Root Router | New Route Controllers | index.js Files Inside Folders |\n|------------------|-------------------------|-------------------------|-------------|------------------------|-------------------------------|\n| Proposed Approach | 1.0                     | No                      | 0           | 1                      | 0                             |\n| Express.js        | 1.0                     | Yes                     | 1           | 1                      | N                             |\n| Koa               | 1.0                     | Yes                     | 1           | 1                      | N                             |\n| Hapi.js           | 1.0                     | Yes                     | 1           | 1                      | N                             |\n| Nest.js           | 1.0                     | Yes                     | 1           | 1                      | N                             |\n| Next.js           | 1.1                     | Yes                     | 0           | 1                      | 0                             |\n\n### Performance Evaluation\n\n1. Install Python dependencies using [uv](https://docs.astral.sh/uv/) package manager by running command `uv sync`\n2. Open one of the frameworks or proposed approach and start the service by running the command `npm start`. It should start the service at `localhost:3000`\n3. Open terminal in the root folder and run [load_testing.sh](./load_testing.sh) to start load testing – `uv run load_testing.sh`\n4. Open UI available at `http://0.0.0.0:8089` and start the load testing\n5. Use UI navigation to gather additional metrics and review the results\n\n| Framework         | Requests | Fails | Latency, ms (p50) | Latency, ms (p95) | Latency, ms (p99) | Average, ms | Current RPS |\n|------------------|----------|-------|-------------------|-------------------|-------------------|-------------|--------------|\n| Proposed Approach| 1,125,540| 3,836 | 180               | 1000              | 1300              | 388.56      | 5925.1       |\n| Express.js       | 1,266,208| 1,658 | 130               | 770               | 990               | 262.4       | 7458.3       |\n| Koa              | 1,825,937| 0     | 0.07              | 110               | 170               | 16.85       | 13474.8      |\n| Hapi.js          | 1,809,789| 0     | 1                 | 120               | 200               | 21.91       | 13590.6      |\n| Nest.js          | 1,029,060| 5,509 | 190               | 1200              | 1500              | 462.12      | 4940.4       |\n| Next.js          | 493,536  | 37,355| 620               | 16000             | 16000             | 1732.52     | 2457.7       |\n\n### Comparison of CPU and Memory Usage Results\n\n| Framework         | CPU (avg) % | CPU (max) % | Memory (avg) % | Memory (max) % |\n|------------------|-------------|-------------|----------------|----------------|\n| Proposed Approach| 37.05       | 50.70       | 61.28          | 62.90          |\n| Express.js       | 39.16       | 58.60       | 61.02          | 62.40          |\n| Koa              | 36.91       | 75.10       | 61.23          | 63.30          |\n| Hapi.js          | 36.84       | 53.70       | 62.54          | 63.10          |\n| Nest.js          | 37.87       | 55.60       | 61.80          | 63.30          |\n| Next.js          | 38.98       | 51.30       | 62.20          | 63.20          |\n\n## Dependency Graphs\n\n*Dependency graph for the proposed routing approach:*\n![Dependency graph for the proposed routing approach](/assets/depgraph-proposed-approach.png)\n\n*Dependency graph for the application based on the Express.js framework:*\n![Dependency graph for the application based on the Express.js framework](/assets/depgraph-express.png)\n\n*Dependency graph for the application based on the Koa framework:*\n![Dependency graph for the application based on the Koa framework](/assets/depgraph-koa.png)\n\n*Dependency graph for the application based on the Hapi.js framework:*\n![Dependency graph for the application based on the Hapi.js framework](/assets/depgraph-hapi.png)\n\n*Dependency graph for the application based on the Nest.js framework:*\n![Dependency graph for the application based on the Nest.js framework](/assets/depgraph-nest.png)\n\n*Dependency graph for the application based on the Next.js framework:*\n![Dependency graph for the application based on the Next.js framework](/assets//depgraph-next.png)\n\n## Citation\n\n[Link to citation on Springer](https://link.springer.com/article/10.1007/s42979-025-04311-8#citeas)\n\n```\nChaplia, O., Klym, H., Konuhova, M. et al. Enhancing REST API Handlers Organization for Node.js Microservices. SN COMPUT. SCI. 6, 776 (2025). https://doi.org/10.1007/s42979-025-04311-8\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folehxch%2Frest-api-handlers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folehxch%2Frest-api-handlers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folehxch%2Frest-api-handlers/lists"}