{"id":23700999,"url":"https://github.com/lennetech/nest-server-starter","last_synced_at":"2025-09-03T05:32:01.655Z","repository":{"id":40489184,"uuid":"193322889","full_name":"lenneTech/nest-server-starter","owner":"lenneTech","description":"Starter kit for lenne.Tech Nest Server","archived":false,"fork":false,"pushed_at":"2024-08-26T16:33:36.000Z","size":8845,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-26T19:38:23.373Z","etag":null,"topics":["api","graphql","mikroorm","mongodb","nestjs","server","starter-kit"],"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/lenneTech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2019-06-23T08:14:45.000Z","updated_at":"2024-08-26T16:33:39.000Z","dependencies_parsed_at":"2023-11-17T16:37:54.608Z","dependency_job_id":"32e75e57-527c-48bb-9215-cb639244d772","html_url":"https://github.com/lenneTech/nest-server-starter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenneTech%2Fnest-server-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenneTech%2Fnest-server-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenneTech%2Fnest-server-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenneTech%2Fnest-server-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lenneTech","download_url":"https://codeload.github.com/lenneTech/nest-server-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231837438,"owners_count":18433962,"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":["api","graphql","mikroorm","mongodb","nestjs","server","starter-kit"],"created_at":"2024-12-30T09:31:25.460Z","updated_at":"2024-12-30T09:31:26.073Z","avatar_url":"https://github.com/lenneTech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Starter for lenne.Tech Nest Server\n\nThis is the starter kit for the [lenne.Tech Nest Server](https://github.com/lenneTech/nest-server).\n\nIt contains everything you need to get started right away and a few code examples to help you create your own modules.\n\nIn combination with Angular (see [lenne.Tech Angular example](https://github.com/lenneTech/angular-example)\nincl. [ng-base](https://github.com/lenneTech/ng-base/tree/main/projects/ng-base/README.md)) the Nest Server is an ideal\nbasis for your next project.\n\nFor efficient handling we recommend using the [lenne.Tech CLI](https://github.com/lenneTech/cli) \nto initialize a new project and create modules and module elements.\n\nThis starter is regularly updated to the latest version of the Nest server. This makes it ideal for viewing the changes \nand applying them to your own project (see [Update Notes](update)).\n\n[![License](https://img.shields.io/github/license/lenneTech/nest-server-starter)](/LICENSE)\n\n## Requirements\n\n- [Node.js incl. npm](https://nodejs.org):  \n  the runtime environment for your server\n\n- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git):  \n  the version control system for your source code\n\n- [MongoDB](https://docs.mongodb.com/manual/installation/#mongodb-community-edition-installation-tutorials)\n  (or any other database compatible with [MikroORM](https://mikro-orm.io)):  \n  the database for your objects\n\n## 1. Install the starter kit via [CLI](https://github.com/lenneTech/cli)\n\n```\n$ npm install -g @lenne.tech/cli\n$ lt server create \u003cServerName\u003e\n$ cd \u003cServerName\u003e\n```\n\n## 2. Start the server\n\n```\n$ npm run start:dev\n```\n\n## 3. Extend the server\n\nSince the server is based on [Nest](https://nestjs.com/), you can find all information about extending your server\nin the [documentation of Nest](https://docs.nestjs.com/).\n\nTo create a new Module with model, inputs, resolver and service you can use the [CLI](https://github.com/lenneTech/cli):\n\n```\n$ lt server module \u003cModuleName\u003e\n```\n\nWe are currently working on a documentation of the extensions and auxiliary classes that the\n[lenne.Tech Nest Server](https://github.com/lenneTech/nest-server) contains. As long as this is not yet available,\nhave a look at the [source code](https://github.com/lenneTech/nest-server/tree/master/src/core).\nThere you will find a lot of things that will help you to extend your server, such as:\n\n- [GraphQL scalars](https://github.com/lenneTech/nest-server/tree/master/src/core/common/scalars)\n- [Filter and pagination](https://github.com/lenneTech/nest-server/tree/master/src/core/common/args)\n- [Decorators for restrictions and roles](https://github.com/lenneTech/nest-server/tree/master/src/core/common/decorators)\n- [Authorisation handling](https://github.com/lenneTech/nest-server/tree/master/src/core/modules/auth)\n- [Ready to use user module](https://github.com/lenneTech/nest-server/tree/master/src/core/modules/user)\n- [Common helpers](https://github.com/lenneTech/nest-server/tree/master/src/core/common/helpers) and\n  [helpers for tests](https://github.com/lenneTech/nest-server/blob/master/src/test/test.helper.ts)\n- ...\n\n## Further information\n\n### Running the app\n\n```bash\n# Development\n$ npm start\n\n# Watch mode\n$ npm run start:dev\n\n# Production mode\n$ npm run start:prod\n```\n\n### Test\n\n```bash\n# e2e tests\n$ npm run test:e2e\n```\n\nConfiguration for testing:\n```\nNode interpreter: /user/local/bin/node\nJest package: FULL_PATH_TO_PROJECT_DIR/node_modules/jest\nWorking directory: FULL_PATH_TO_PROJECT_DIR\nJest options: --config jest-e2e.json --forceExit\n```\nsee [E2E-Tests.run.xml](.run/E2E-Tests.run.xml)\n\n## Debugging\n\nConfiguration for debugging is:\n```\nNode interpreter: /user/local/bin/node\nNode parameters: node_modules/@nestjs/cli/bin/nest.js start --debug --watch\nWorking directory: FULL_PATH_TO_PROJECT_DIR\nJavaScript file: src/main.ts\n```\nsee [Debug.run.xml](.run/Debug.run.xml)\n\n## Configuration\n\nThe configuration of the server is done via the `src/config.env.ts` file. This file is a TypeScript file that exports\nan object with the configuration values. It is automatically integrated into the `ConfigService`\n(see src/core/common/services/config.service.ts).\n\n### Environment variables\n\nTo protect sensitive data and to avoid committing them to the repository the `.env` file can be used.\nAn example `.env` file is provided in the `.env.example` file.\n\nThere are multiple ways to manipulate or extend the configuration via environment variables:\n1. Via \"normal\" integration of the environment variables into the `src/config.env.ts`\n2. Via JSON in the `NEST_SERVER_CONFIG` environment variable\n3. Via single environment variables with the prefix `NSC__` (Nest Server Config)\n\n#### Normal environment variables\nUsing `dotenv` (see https://www.dotenv.org/) environment variables can directly integrated into the\n`src/config.env.ts` via `process.env`. E.g.:\n```typescript\nexport const config = {\n  development: {\n    port: process.env.PORT || 3000,\n  },\n};\n```\n\n#### JSON\nThe `NEST_SERVER_CONFIG` is the environment variable for the server configuration.\nThe value of `NEST_SERVER_CONFIG` must be a (multiline) JSON string that will be parsed by the server\n(see config.env.ts). The keys will override the other configuration values via deep merge\n(see https://lodash.com/docs/4.17.15#merge, without array merging).\n\n#### Single config variables\nThe prefix `NSC__` (**N**est **S**erver **C**onfig) can be used to set single configuration values via environment\nvariables. The key is the name of the configuration value in uppercase and with double underscores (`__`) instead of\ndots. Single underscores are used to separate compound terms like `DEFAULT_SENDER` for `defaultSender`.\nFor example, the configuration value `email.defaultSender.name` can be set via the environment variable\n`NSC__EMAIL_DEFAULT_SENDER_NAME`.\n\n## Test \u0026 debug the NestServer package in this project\nUse [yalc](https://github.com/wclr/yalc) to include the NestJS server in the project.\n\n1. clone [NestServer](https://github.com/lenneTech/nest-server): `git clone https://github.com/lenneTech/nest-server.git`\n2. go to the nest-server folder (`cd nest-server`), install the packages via `npm i` and start the nest server in watch \u0026 yalc mode: `npm run watch`\n3. link the nest server live package to this project via `npm run link:nest-server` and start the server: `npm start`\n4. unlink the nest-server live package and use the normal package again when you are done: `npm run unlink:nest-server`\n\n## Deployment with deploy.party\n\nThis project is prepared for deployment with deploy.party.\n\nExample configuration for deploy.party (productive):\n\n| Key                  | Value                                              |\n|----------------------|----------------------------------------------------|\n| Source               | GitLab                                             |  \n| Repository           | my-repo                                            |\n| Branch               | main                                               |\n| Registry             | localhost                                          |\n| Name                 | api                                                |\n| URL                  | api.my-domain.com                                  |\n| Type                 | Node                                               |\n| Base image           | node:20                                            |\n| Custom image command | RUN apt-get install -y tzdata curl                 |\n|                      | ENV TZ Europe/Berlin                               |\n| Base directory       | ./projects/api                                     |\n| Install command      | npm install                                        |\n| Build command        | npm run build                                      |\n| Start command        | npm run dp:prod                                    |\n| Healthcheck command  | curl --fail http://localhost:3000/meta \\|\\| exit 1 |\n| Port                 | 3000                                               |\n| Enable SSL           | true                                               |\n\n## Documentation\nThe API and developer documentation can automatically be generated.\n\n```bash\n# generate and serve documentation\n$ npm run docs\n```\n\n## Update\nAn update to a new Nest Sever version can be done as follows:\n\n1. set the new Nest Server version in the package.json under `{dependencies: {\"@lenne.tech/nest-server\": \"NEW_VERSON\" }}`.\n2. run `npm run update`\n3. adjust project according to changes in git history from nest server\n4. run tests via `npm run tests:e2e`, build via `npm run build` and start the server with `npm start` to check if everything is working\n\nSince this starter is regularly updated, it is ideal as a template for the changes to be made in your own project. \nSimply compare the current version in the Git history of this starter with the version that was previously used in \nthe project and adapt your own project accordingly.\n\n## Planned enhancements:\n\n- Documentation of extensions and auxiliary classes\n\n## Thanks\n\nMany thanks to the developers of [Nest](https://github.com/nestjs/nest)\nand all the developers whose packages are used here.\n\n## License\n\nMIT - see LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flennetech%2Fnest-server-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flennetech%2Fnest-server-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flennetech%2Fnest-server-starter/lists"}