{"id":23740266,"url":"https://github.com/georgianstan/nestjs-microservice-boilerplate","last_synced_at":"2025-07-18T16:34:32.324Z","repository":{"id":45191111,"uuid":"237610244","full_name":"GeorgianStan/nestjs-microservice-boilerplate","owner":"GeorgianStan","description":"Boilerplate for a TCP Microservice in NestJS with TypeORM and tests","archived":false,"fork":false,"pushed_at":"2021-06-29T07:26:17.000Z","size":238,"stargazers_count":45,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-04T11:48:28.335Z","etag":null,"topics":["boilerplate","database","mariadb-mysql","nestjs","nestjs-microservices","nestjs-typeorm","tcp"],"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/GeorgianStan.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":"2020-02-01T12:16:29.000Z","updated_at":"2022-09-03T15:21:40.000Z","dependencies_parsed_at":"2022-07-19T18:03:58.001Z","dependency_job_id":null,"html_url":"https://github.com/GeorgianStan/nestjs-microservice-boilerplate","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/GeorgianStan%2Fnestjs-microservice-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgianStan%2Fnestjs-microservice-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgianStan%2Fnestjs-microservice-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgianStan%2Fnestjs-microservice-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeorgianStan","download_url":"https://codeload.github.com/GeorgianStan/nestjs-microservice-boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231970945,"owners_count":18453930,"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":["boilerplate","database","mariadb-mysql","nestjs","nestjs-microservices","nestjs-typeorm","tcp"],"created_at":"2024-12-31T09:47:50.651Z","updated_at":"2024-12-31T09:47:51.240Z","avatar_url":"https://github.com/GeorgianStan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Changelog\n\n### v2.1.0\n\n- sample `.env` file to indicate required environment variables\n- switch to truly private variables, instead of TypeScript modifiers\n- `CustomResponse` interface includes the `namespace` now\n\n## v2.0.0\n\n### Core\n\n- **upgrade** to latest **NestJS** version(v7)\n- folder structure update\n- use `cross-env` to set the `NODE_ENV` for cross OS support\n\n### Modules\n\n- refactor `utils` to simply `custom-response`\n- `CustomResponse` interface is a generic now\n- new custom-response status `WARNING = 'warning'`\n- `config.service` will use now `process.cwd()` istead of a relative path\n- `config.service` will return the values from `.env` files or from `process.env`\n- `database.module` will receive each entity inside the `entities` instead of `'dist/**/*.entity{.ts,.js}'`\n\n---\n\n### Explanation\n\nFor a better understanding, check out this [article](https://itnext.io/nestjs-microservice-with-typeorm-mariadb-and-integration-e2e-testing-379338e99580).\n\n# Preparation\n\n- install the desired database, this example is made with **MariaDB** [link to a youtube tutorial](https://www.youtube.com/watch?v=hDKnsUrz0nM\u0026t=195s)\n\n- install Pachet Sender (like Postman for TCP) [download link](https://packetsender.com/)\n\n- download the code and run `npm i`\n\n# Write your .env variables\n\nNow is time to write your configuration for this project. Create two files: _.env.development_ and _.env.test_.\n\n**!** Both will be ignored with _.gitignore_\n\n**!** In production instead of these two, create a new file on your server named _.env.production_\n\nThis is an example for _.env.development_\n**! Replace with your config**\n\n```\nDB_SERVER_PORT=3306\nDB_SERVER_HOST=localhost\nDB_SERVER_USERNAME=root\nDB_SERVER_PASSWORD=root\nDATABASE=users\n\nERROR_CODE_NAMESPACE=users-microservice\n```\n\n# Microservice Port\n\n**:8875**\n\n# Response Format\n\n```\n{\n  \"status\":ResponseStatus\n  \"data\":any -\u003e '' when no data is found\n  \"error\":CustomError\n}\n```\n\n**ResponseStatus** - \"success\" or \"fail\"\n\n**CustomError** - consist of 3 parts: an error code, a message and a namespace. Codes are universal, but messages can vary. Here is the error JSON payload:\n\n```\n{\n  \"code\":number,\n  \"msg\":string || string[]\n  \"namespace\":string\n}\n```\n\n# Error codes\n\n## 10xx - General Server or Network issues\n\n**1000 UNKNOWN**\n\n- An unknown error occured while processing the request.\n\n**1001 DATABASE_ERROR**\n\n- An unknown error occured on database.\n\n## 11xx - Request issues\n\n**1100 BAD_PARAMETERS**\n\n- Bad parameters send to endpoint\n- The validation pipe will return the error as message\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgianstan%2Fnestjs-microservice-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorgianstan%2Fnestjs-microservice-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgianstan%2Fnestjs-microservice-boilerplate/lists"}