{"id":15700812,"url":"https://github.com/ardalanamini/express-api-template","last_synced_at":"2025-05-12T14:28:19.622Z","repository":{"id":37940463,"uuid":"451512013","full_name":"ardalanamini/express-api-template","owner":"ardalanamini","description":"This is a starter Express.js API Template, helping to get past the routine of starting a new project from scratch again and again!","archived":false,"fork":false,"pushed_at":"2023-03-07T00:04:52.000Z","size":1116,"stargazers_count":8,"open_issues_count":14,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T14:28:14.465Z","etag":null,"topics":["codecov","docker","docker-compose","eslint","express","express-js","expressjs","jest","mongodb","mongoose","node","node-js","nodejs","sentry","swagger","typedoc","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/ardalanamini.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}},"created_at":"2022-01-24T15:07:18.000Z","updated_at":"2025-01-30T17:18:19.000Z","dependencies_parsed_at":"2024-10-24T05:25:23.803Z","dependency_job_id":"575b5c5f-6e81-4609-aab5-26f70ea7af84","html_url":"https://github.com/ardalanamini/express-api-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardalanamini%2Fexpress-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardalanamini%2Fexpress-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardalanamini%2Fexpress-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardalanamini%2Fexpress-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ardalanamini","download_url":"https://codeload.github.com/ardalanamini/express-api-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253754509,"owners_count":21958875,"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":["codecov","docker","docker-compose","eslint","express","express-js","expressjs","jest","mongodb","mongoose","node","node-js","nodejs","sentry","swagger","typedoc","typescript"],"created_at":"2024-10-03T19:54:27.346Z","updated_at":"2025-05-12T14:28:19.574Z","avatar_url":"https://github.com/ardalanamini.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express.js API Template\n\n[![Test][TEST_WORKFLOW_BADGE]][TEST_WORKFLOW_URL]\n[![CodeCov][CODECOV_BADGE]][CODECOV_URL]\n\nThis is a starter _Express.js_[^EXPRESS_JS_FOOTNOTE] API Template, helping to get past the routine of starting a new\nproject from scratch again and again!\n\n\u003e This template is still in WIP phase!\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Usage](#usage)\n  - [Build](#build)\n  - [Test](#test)\n  - [Code Style](#code-style)\n  - [Documents](#documents)\n    - [API](#api-documents)\n    - [Code](#code-documents)\n  - [Config](#config)\n    - [Common](#common-config)\n    - [Server](#server-config)\n    - [Database](#database-config)\n    - [Sentry](#sentry-config)\n  - [Start](#start)\n  - [Docker](#docker)[^DOCKER_FOOTNOTE]\n- [Directory Layout](#directory-layout)\n- [Versioning](#versioning)\n\n## Prerequisites\n\n- _Node.js_[^NODE_JS_FOOTNOTE] (`v16.13.2` or higher)\n- _MongoDB_[^MONGODB_FOOTNOTE] (`v5`)\n\n## Usage\n\nFirst install the dependencies:\n\n```shell\nnpm i\n```\n\n### Build\n\nBuild the project. (Using _TypeScript_[^TYPESCRIPT_FOOTNOTE])\n\n```shell\nnpm run build\n```\n\nWatch for changes and rebuild automatically.\n\n```shell\nnpm run build:watch\n```\n\n### Test\n\nTest the project. (Using _Jest_[^JEST_FOOTNOTE])\n\n```shell\nnpm test\n```\n\nTest with code coverage report.\n\n```shell\nnpm run test:coverage\n```\n\nTest in ci.\n\n```shell\nnpm run test:ci\n```\n\n### Code Style\n\nCheck for code style issues in the project. (Using _ESLint_[^ESLINT_FOOTNOTE])\n\n```shell\nnpm run lint\n```\n\nFix code style issues in the project.\n\n```shell\nnpm run lint:fix\n```\n\n### Documents\n\n#### API Documents\n\nGenerate the API documents to be served statically. (Using _Swagger_[^SWAGGER_FOOTNOTE])\n\n```shell\nnpm run docs:swagger\n```\n\nGenerate \u0026 serve the API documents. (The documents' server address will be printed in the terminal)\n\n```shell\nnpm run docs:api\n```\n\n#### Code Documents\n\nGenerate the Code documents to be served statically. (Using _TypeDoc_[^TYPEDOC_FOOTNOTE])\n\n```shell\nnpm run docs:code\n```\n\nAfter running this command, open `docs/code/index.html` in your preferred browser.\n\n### Config\n\nFirst create the `.env` file:\n\n```shell\ncp .env.example .env\n```\n\n#### Common Config\n\n|     Name      |               Type                |    Default    |                                                Description                                                |\n|:-------------:|:---------------------------------:|:-------------:|:---------------------------------------------------------------------------------------------------------:|\n|  `NODE_ENV`   | `production`,`development`,`test` | `development` | _Node.js_[^NODE_JS_FOOTNOTE] environment (`test` will be provided by the testing framework automatically) |\n| `RELEASE_ENV` |      `production`,`staging`       |   `staging`   |                                            Release environment                                            |\n\n#### Server Config\n\n| Name              |  Type   |   Default   |                    Description                     |\n|-------------------|:-------:|:-----------:|:--------------------------------------------------:|\n| `SERVER_HOSTNAME` | string  | `localhost` | _Express.js_[^EXPRESS_JS_FOOTNOTE] server hostname |\n| `SERVER_PORT`     | integer |   `3000`    |   _Express.js_[^EXPRESS_JS_FOOTNOTE] server port   |\n\n#### Database Config\n\n| Name           |  Type  | Default |                    Description                     |\n|----------------|:------:|:-------:|:--------------------------------------------------:|\n| `DATABASE_URI` | string |    -    | _MongoDB_[^MONGODB_FOOTNOTE] connection string uri |\n\n#### Sentry Config\n\n| Name         |  Type  | Default |                 Description                  |\n|--------------|:------:|:-------:|:--------------------------------------------:|\n| `SENTRY_DSN` | string |    -    | _Sentry_[^SENTRY_FOOTNOTE] project DSN value |\n\n### Start\n\nStart the API.\n\n```shell\nnpm start\n```\n\nWatch for changes and restart automatically.\n\n```shell\nnpm run start:watch\n```\n\n### Docker\n\nStart the services:\n\n```shell\ndocker-compose up -d --build --remove-orphans\n```\n\nStop the services:\n\n```shell\ndocker-compose down\n```\n\n## Directory Layout\n\n```\n.\n├── __tests__        # Test files\n│   ├── controllers  # Express.js controller tests\n│   └── jest         # Test utilities\n├── docs             # Static documents\n│   ├── api          # API documents\n│   └── code         # Code documents\n├── scripts          # Project scripts\n└── src              # Source files\n    ├── config       # Configuration values\n    ├── constants    # Constants\n    ├── controllers  # Express.js controllers\n    ├── lib          # Libraries\n    └── models       # Database models\n```\n\n## Versioning\n\nWe use _SemVer_[^SEMVER_FOOTNOTE] for versioning. For the versions \u0026 changelogs available, see the releases on this\nrepository.\n\n\u003c!-- Footnotes --\u003e\n\n[^EXPRESS_JS_FOOTNOTE]: [Express.js][EXPRESS_JS_WEBSITE]\n\n[^NODE_JS_FOOTNOTE]: [Node.js][NODE_JS_WEBSITE]\n\n[^TYPESCRIPT_FOOTNOTE]: [TypeScript][TYPESCRIPT_WEBSITE]\n\n[^JEST_FOOTNOTE]: [Jest][JEST_WEBSITE]\n\n[^ESLINT_FOOTNOTE]: [ESLint][ESLINT_WEBSITE]\n\n[^SWAGGER_FOOTNOTE]: [Swagger][SWAGGER_WEBSITE]\n\n[^TYPEDOC_FOOTNOTE]: [TypeDoc][TYPEDOC_WEBSITE]\n\n[^SEMVER_FOOTNOTE]: [SemVer][SEMVER_WEBSITE]\n\n[^DOCKER_FOOTNOTE]: [Docker][DOCKER_WEBSITE]\n\n[^MONGODB_FOOTNOTE]: [MongoDB][MONGODB_WEBSITE]\n\n[^SENTRY_FOOTNOTE]: [Sentry][SENTRY_WEBSITE]\n\n\u003c!-- Links --\u003e\n\n[TEST_WORKFLOW_URL]: https://github.com/ardalanamini/express-api-template/actions/workflows/test.yml\n\n[TEST_WORKFLOW_BADGE]: https://github.com/ardalanamini/express-api-template/actions/workflows/test.yml/badge.svg\n\n[CODECOV_URL]: https://codecov.io/gh/ardalanamini/express-api-template\n\n[CODECOV_BADGE]: https://codecov.io/gh/ardalanamini/express-api-template/branch/main/graph/badge.svg?token=PSHIW2SL1S\n\n[NODE_JS_WEBSITE]: https://nodejs.org/en\n\n[EXPRESS_JS_WEBSITE]: https://expressjs.com\n\n[TYPESCRIPT_WEBSITE]: https://www.typescriptlang.org\n\n[JEST_WEBSITE]: https://jestjs.io\n\n[ESLINT_WEBSITE]: https://eslint.org\n\n[SWAGGER_WEBSITE]: https://swagger.io\n\n[TYPEDOC_WEBSITE]: https://typedoc.org\n\n[SEMVER_WEBSITE]: http://semver.org\n\n[DOCKER_WEBSITE]: https://www.docker.com\n\n[MONGODB_WEBSITE]: https://www.mongodb.com\n\n[SENTRY_WEBSITE]: https://sentry.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardalanamini%2Fexpress-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fardalanamini%2Fexpress-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardalanamini%2Fexpress-api-template/lists"}