{"id":21310594,"url":"https://github.com/cembdc/nodejs-restapi","last_synced_at":"2025-07-11T23:31:51.438Z","repository":{"id":55675791,"uuid":"250991244","full_name":"cembdc/nodejs-restapi","owner":"cembdc","description":"⌛️ Boilerplate for API backends with Node.js and Express.","archived":false,"fork":false,"pushed_at":"2020-12-19T17:12:25.000Z","size":433,"stargazers_count":8,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-08T10:27:49.418Z","etag":null,"topics":["api-backends","boilerplate","es2017","es2018","es2019","es6","express-boilerplate","expressjs","mongodb","mongoose","nodejs","nodejs-restapi","rest-api","starter","starter-template"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/cembdc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-29T09:00:41.000Z","updated_at":"2022-03-02T11:30:19.000Z","dependencies_parsed_at":"2022-08-15T06:10:56.409Z","dependency_job_id":null,"html_url":"https://github.com/cembdc/nodejs-restapi","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/cembdc%2Fnodejs-restapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cembdc%2Fnodejs-restapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cembdc%2Fnodejs-restapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cembdc%2Fnodejs-restapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cembdc","download_url":"https://codeload.github.com/cembdc/nodejs-restapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225769345,"owners_count":17521258,"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-backends","boilerplate","es2017","es2018","es2019","es6","express-boilerplate","expressjs","mongodb","mongoose","nodejs","nodejs-restapi","rest-api","starter","starter-template"],"created_at":"2024-11-21T17:14:09.036Z","updated_at":"2024-11-21T17:14:09.637Z","avatar_url":"https://github.com/cembdc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nodejs-Restapi-Boilerplate\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5e98f54d5b3a41ae87355a3106c889cf)](https://www.codacy.com/gh/CemBdc/nodejs-restapi/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=CemBdc/nodejs-restapi\u0026utm_campaign=Badge_Grade)\n[![Build Status](https://travis-ci.com/CemBdc/nodejs-restapi.svg?branch=master)](https://travis-ci.com/CemBdc/nodejs-restapi)\n[![Coverage Status](https://coveralls.io/repos/github/CemBdc/nodejs-restapi/badge.svg?branch=master)](https://coveralls.io/github/CemBdc/nodejs-restapi?branch=master)\n\nA Boilerplate/Starter Project for building RESTful APIs using Node.js, Express, and Mongoose.\n\n## Directory structure\n\n### Overview\n\nProject `src` structure directories.\n\n```\nsrc/\n├─ config/\n│  ├─ config.js\n├─ controller.js\n│  ├─ controller.index.js\n│  ├─ userController.js\n├─ loader/\n│  ├─ express.js\n│  ├─ mongoose.js\n│  ├─ server.js\n├─ middlewares/\n│  ├─ middlewares.index.js\n│  ├─ validator.js\n├─ routes/\n│  ├─ routes.index.js\n│  ├─ routes.js\n│  ├─ userRoute.js\n├─ utils/\n│  ├─ requestUtil.js\n│  ├─ utils.index.js\ntest/\n├─ example.test.js\n├─ userController.test.js\n└─\n```\n\n## Features\n\n-   **ES9**: latest ECMAScript features\n-   **NoSQL database**: [MongoDB](https://www.mongodb.com) object data modeling using [Mongoose](https://mongoosejs.com)\n-   **Authentication and authorization**: using [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken)\n-   **Validation**: request data validation using [Joi](https://github.com/hapijs/joi)\n-   **Logging**: //TODO: winston\n-   **Testing**: unit and integration tests using [Mocha](https://mochajs.org/) [Chai](http://chaijs.com/)\n-   **Error handling**: centralized error handling mechanism\n-   **API documentation**: //TODO: swagger\n-   **Dependency management**: with [Npm](https://www.npmjs.com/)\n-   **Environment variables**: using [dotenv](https://github.com/motdotla/dotenv)\n-   **Security**: set security HTTP headers using [helmet](https://helmetjs.github.io)\n-   **Santizing**: sanitize request data against xss and query injection\n-   **CORS**: Cross-Origin Resource-Sharing enabled using [cors](https://github.com/expressjs/cors)\n-   **Compression**: //TODO: gzip compression with [compression](https://github.com/expressjs/compression)\n-   **CI**: continuous integration with [Travis CI](https://travis-ci.org)\n-   **Docker support**\n-   **Code coverage**: using [coveralls](https://coveralls.io)\n-   **Code quality**: with [Codacy](https://www.codacy.com)\n-   **Git hooks**: with [husky](https://github.com/typicode/husky)\n-   **Linting**: with [ESLint](https://eslint.org) and [Prettier](https://prettier.io)\n-   **Editor config**: consistent editor configuration using [EditorConfig](https://editorconfig.org)\n\n## Getting Started\n\n### Installation\n\nClone the repo:\n\n```bash\ngit clone https://github.com/CemBdc/nodejs-restapi.git\ncd nodejs-restapi\n```\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\nSet the environment variables:\n\n```bash\ncp .env.example .env\n\n# open .env and modify the environment variables (if needed)\n```\n\n## Commands\n\n### Running locally:\n\n```bash\nnpm run start\n```\n\n### Lint\n\n```bash\n# lint code with ESLint\nnpm run lint\n```\n\n### Test\n\n```bash\n# run all tests with Mocha\nnpm run test\n\n# run test coverage\nnpm run test:coverage\n```\n\n## Contributing\n\nContributions are more than welcome! Please check out the [contributing guide](CONTRIBUTING.md).\n\n## Inspirations\n\n- [danielfsousa/express-rest-es2017-boilerplate](https://github.com/danielfsousa/express-rest-es2017-boilerplate)\n- [madhums/node-express-mongoose](https://github.com/madhums/node-express-mongoose)\n- [kunalkapadia/express-mongoose-es6-rest-api](https://github.com/kunalkapadia/express-mongoose-es6-rest-api)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcembdc%2Fnodejs-restapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcembdc%2Fnodejs-restapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcembdc%2Fnodejs-restapi/lists"}