{"id":17651760,"url":"https://github.com/diegovictor/lib-quality","last_synced_at":"2026-04-10T12:31:53.872Z","repository":{"id":98964624,"uuid":"293118737","full_name":"DiegoVictor/lib-quality","owner":"DiegoVictor","description":"Allows users to get data about opened repositories' issues days average, deviation and a chart data comparing a set of libraries issues per day","archived":false,"fork":false,"pushed_at":"2025-12-04T12:54:47.000Z","size":1345,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-05T09:52:55.779Z","etag":null,"topics":["api","bearer","coverage-report","dotenv","eslint","insomnia","javascript","jest","jwt","mongodb","node","nodejs","postman","prettier","rest","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/DiegoVictor.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-09-05T17:02:04.000Z","updated_at":"2025-12-04T12:54:51.000Z","dependencies_parsed_at":"2024-12-24T16:23:02.209Z","dependency_job_id":"0c82bd4a-da13-45b0-b30f-06e156af7e5b","html_url":"https://github.com/DiegoVictor/lib-quality","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/DiegoVictor/lib-quality","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Flib-quality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Flib-quality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Flib-quality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Flib-quality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiegoVictor","download_url":"https://codeload.github.com/DiegoVictor/lib-quality/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Flib-quality/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31642738,"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":["api","bearer","coverage-report","dotenv","eslint","insomnia","javascript","jest","jwt","mongodb","node","nodejs","postman","prettier","rest","ts","typescript"],"created_at":"2024-10-23T11:43:30.593Z","updated_at":"2026-04-10T12:31:53.860Z","avatar_url":"https://github.com/DiegoVictor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LibQuality\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/DiegoVictor/lib-quality/config.yml?logo=github\u0026style=flat-square)](https://github.com/DiegoVictor/lib-quality/actions)\n[![mongodb](https://img.shields.io/badge/mongodb-6.21.0-13aa52?style=flat-square\u0026logo=mongodb\u0026logoColor=white)](https://mongodb.com/)\n[![typescript](https://img.shields.io/badge/typescript-5.9.3-3178c6?style=flat-square\u0026logo=typescript)](https://www.typescriptlang.org/)\n[![eslint](https://img.shields.io/badge/eslint-8.57.0-4b32c3?style=flat-square\u0026logo=eslint)](https://eslint.org/)\n[![airbnb-style](https://flat.badgen.net/badge/style-guide/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)\n[![jest](https://img.shields.io/badge/jest-30.2.0-brightgreen?style=flat-square\u0026logo=jest)](https://jestjs.io/)\n[![coverage](https://img.shields.io/codecov/c/gh/DiegoVictor/lib-quality?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/DiegoVictor/lib-quality)\n[![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://raw.githubusercontent.com/DiegoVictor/lib-quality/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\u003cbr\u003e\n[![Run in Insomnia}](https://insomnia.rest/images/run.svg)](https://insomnia.rest/run/?label=LibQuality\u0026uri=https%3A%2F%2Fgithub.com%2FDiegoVictor%2Flib-quality%2FInsomnia_2021-08-16.json)\n[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/3419c923f3c15604cbab)\n\nAllow users to search by project name and check issues status like opened issues, average days opened and deviation. The app use JWT to logins, validation, also a simple versioning was made.\n\n## Table of Contents\n\n- [Installing](#installing)\n  - [Configuring](#configuring)\n    - [.env](#env)\n    - [MongoDB](#mongodb)\n- [Usage](#usage)\n  - [Bearer Token](#bearer-token)\n  - [Versioning](#versioning)\n  - [Routes](#routes)\n    - [Requests](#requests)\n- [Running the tests](#running-the-tests)\n  - [Coverage report](#coverage-report)\n\n# Installing\n\nEasy peasy lemon squeezy:\n\n```\n$ yarn\n```\n\nOr:\n\n```\n$ npm install\n```\n\n\u003e Was installed and configured the [`eslint`](https://eslint.org/) and [`prettier`](https://prettier.io/) to keep the code clean and patterned.\n\n## Configuring\n\nThe application use just one database: [MongoDB](https://www.mongodb.com/). For the fastest setup is recommended to use [docker-compose](https://docs.docker.com/compose/), you just need to up all services:\n\n```\n$ docker-compose up -d\n```\n\n### .env\n\nIn this file you may configure your MongoDB's database connection, JWT settings and app's port. Rename the `.env.example` in the root directory to `.env` then just update with your settings.\n\n| key                 | description                                                                                                                            | default                            |\n| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |\n| APP_PORT            | Port number where the app will run.                                                                                                    | `3333`                             |\n| JWT_SECRET          | A alphanumeric random string. Used to create signed tokens.                                                                            | -                                  |\n| JWT_EXPIRATION_TIME | How long time will be the token valid. See [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken#usage) repo for more information. | `7d`                               |\n| MONGO_URL           | MongoDB's server url.                                                                                                                  | `mongodb://mongo:27017/libquality` |\n\n### MongoDB\n\nStore searchs terms, users searchs by session and the users utilized by the application. If for any reason you would like to create a MongoDB container instead of use `docker-compose`, you can do it by running the following command:\n\n```\n$ docker run --name libquality-mongo -d -p 27017:27017 mongo\n```\n\n# Usage\n\nTo start up the app run:\n\n```\n$ yarn dev:server\n```\n\nOr:\n\n```\nnpm run dev:server\n```\n\nThen open the demo `demo/index.htrml` file, wait some seconds until the api request be done, then you will be able to see the chart!\n\n## Error Handling\n\nInstead of only throw a simple message and HTTP Status Code this API return friendly errors:\n\n```json\n{\n  \"statusCode\": 400,\n  \"error\": \"Bad Request\",\n  \"message\": \"Missing authorization token\",\n  \"code\": 240,\n  \"docs\": \"https://github.com/DiegoVictor/lib-quality#errors-reference\"\n}\n```\n\n\u003e Errors are implemented with [@hapi/boom](https://github.com/hapijs/boom). As you can see an url to error docs are returned too. To configure this url update the `DOCS_URL` key from `.env` file. In the next sub section ([Errors Reference](https://github.com/DiegoVictor/lib-quality#errors-reference)) you can see the errors code description.\n\n### Errors Reference\n\n| code | message                                                   | description                                                |\n| ---- | --------------------------------------------------------- | ---------------------------------------------------------- |\n| 140  | Email already in use                                      | An user with the same email already exists.                |\n| 141  | User and/or password does not match                       | Password not match.                                        |\n| 144  | User and/or password does not match                       | An user with the provided email was not found.             |\n| 240  | Missing authorization token                               | The `Authorization` header was not sent.                   |\n| 241  | Token expired or invalid                                  | The Bearer token provided is expired or invalid.           |\n| 350  | An error occured while trying to get repositories list    | The repositories search fail.                              |\n| 351  | An error occured while trying to get repositories         | The tentative to get user's repositories fail.             |\n| 352  | An error occured while trying to get repositories' issues | The request fail when trying to load repositories' issues. |\n| 440  | Resource not found                                        | The url requested was not found.                           |\n\n## Bearer Token\n\nA few routes expect a Bearer Token in an `Authorization` header.\n\n\u003e You can see these routes in the [routes](#routes) section.\n\n```\nGET http://localhost:3333/v1/repositories/libquality Authorization: Bearer \u003ctoken\u003e\n```\n\n\u003e To achieve this token you just need authenticate through the `/sessions` route and it will return the `token` key with a valid Bearer Token.\n\n## Versioning\n\nA simple versioning was made. Just remember to set after the `host` the `/v1/` string to your requests.\n\n```\nGET http://localhost:3333/v1/repositories/libquality\n```\n\n## Routes\n\n| route                          | HTTP Method |                                   params                                   |                                                       description                                                        |    auth method     |\n| :----------------------------- | :---------: | :------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------: | :----------------: |\n| `/sessions`                    |    POST     |                  Body with user's `email` and `password`.                  |                           Authenticates user, return a Bearer Token and user's id and session.                           |        :x:         |\n| `/users`                       |    POST     |                  Body with user's `email` and `password`.                  |                                                    Create a new user.                                                    |        :x:         |\n| `/repositories/:projectName`   |     GET     |                       `:projectName` to search for.                        |                                  Search repositories in GitHub and return suggestions.                                   | :heavy_check_mark: |\n| `/analytics/:user/:repository` |     GET     |    `:user` and `:repository` from a GitHub's repository (`full name`).     |               Return repository's name, open issues count, days opened average and days opened deviation.                | :heavy_check_mark: |\n| `/analytics/chart`             |     GET     | `repository[0]`, `repository[1]` ... `repository[n]`, repository full name | Return data to fill a chart of lines ([Chart.js](https://www.chartjs.org). You can see an example inside `demo` folder.) |        :x:         |\n\n\u003e Routes with auth method expect an `Authorization` header. See [Bearer Token](#bearer-token) section for more information.\n\n### Requests\n\n- `POST /session`\n\nRequest body:\n\n```json\n{\n  \"email\": \"johndoe@example.com\",\n  \"password\": \"123456\"\n}\n```\n\n- `POST /users`\n\nRequest body:\n\n```json\n{\n  \"email\": \"johndoe@example.com\",\n  \"password\": \"123456\"\n}\n```\n\n# Running the tests\n\n[Jest](https://jestjs.io/) was the choice to test the app, to run:\n\n```\n$ yarn test\n```\n\nOr:\n\n```\n$ npm run test\n```\n\n## Coverage report\n\nYou can see the coverage report inside `tests/coverage`. They are automatically created after the tests run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Flib-quality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegovictor%2Flib-quality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Flib-quality/lists"}