{"id":15611718,"url":"https://github.com/patrickvaler/express-jwt-acl-mongoose-starter","last_synced_at":"2025-04-28T12:21:15.523Z","repository":{"id":208712428,"uuid":"92987027","full_name":"patrickvaler/express-jwt-acl-mongoose-starter","owner":"patrickvaler","description":"Basic setup of express with JWT authentication (passport, passport-jwt), access control lists (node_acl) and Mongoose, written in ES6.","archived":false,"fork":false,"pushed_at":"2020-06-02T20:29:38.000Z","size":1664,"stargazers_count":7,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T09:31:32.797Z","etag":null,"topics":["acl","es6","express","jsonwebtoken","jwt","mongoose"],"latest_commit_sha":null,"homepage":null,"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/patrickvaler.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}},"created_at":"2017-05-31T20:42:40.000Z","updated_at":"2022-05-17T15:27:50.000Z","dependencies_parsed_at":"2023-11-22T22:46:30.445Z","dependency_job_id":null,"html_url":"https://github.com/patrickvaler/express-jwt-acl-mongoose-starter","commit_stats":null,"previous_names":["patrickvaler/express-jwt-acl-mongoose-starter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fexpress-jwt-acl-mongoose-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fexpress-jwt-acl-mongoose-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fexpress-jwt-acl-mongoose-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fexpress-jwt-acl-mongoose-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickvaler","download_url":"https://codeload.github.com/patrickvaler/express-jwt-acl-mongoose-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311340,"owners_count":21569011,"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":["acl","es6","express","jsonwebtoken","jwt","mongoose"],"created_at":"2024-10-03T06:07:14.054Z","updated_at":"2025-04-28T12:21:15.503Z","avatar_url":"https://github.com/patrickvaler.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/patrickvaler/express-jwt-acl-mongoose-starter.svg?branch=master)](https://travis-ci.org/patrickvaler/express-jwt-acl-mongoose-starter) [![Dependency Status](https://david-dm.org/patrickvaler/express-jwt-acl-mongoose-starter/status.svg?style=flat)](https://david-dm.org/patrickvaler/express-jwt-acl-mongoose-starter) [![GitHub version](https://badge.fury.io/gh/patrickvaler%2Fexpress-jwt-acl-mongoose-starter.svg)](https://badge.fury.io/gh/patrickvaler%2Fexpress-jwt-acl-mongoose-starter) [![Greenkeeper badge](https://badges.greenkeeper.io/patrickvaler/express-jwt-acl-mongoose-starter.svg)](https://greenkeeper.io/)\n\n\nexpress-jwt-acl-mongoose-starter \n====\nBasic setup of express with JWT authentication (passport, passport-jwt), access control lists (node_acl) and Mongoose, written in ES6.\n\n\n\n\n## Requirements\n- [Node.js](\"https://nodejs.org/\") \u003e= 6.x\n- [MongoDB](\"https://docs.mongodb.com/manual/installation/\")\n\n## Authentication\nAuthentication is based on [json web tokens](\"https://jwt.io\"). `passport-jwt` strategy is used to handle the email / password authentication.\nAfter a successful login the generated token is sent to the requester. To access the protected routes, the requester must sent the token\nin the header request.\n\n## API\n### Signup: `/api/signup`\n```\nPOST /api/signup\nHost: localhost:3000\nContent-Type: application/json\n\n{\n    \"email\": \"example@example.com\",\n    \"password\": \"password123\"\n}\n```\n\n### Login: `/api/login`\n```\nPOST /api/login\nHost: localhost:3000\nContent-Type: application/json\n\n{\n    \"email\": \"example@example.com\",\n    \"password\": \"password123\"\n}\n```\n\n### Protected route: `/api/protected`\nToken must be put in request header, by using `Authorization` key\n```\nGET /api/protected\nHost: localhost:3000\nAuthorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjU5MmRhZTg1NGQ4ODlmNzkwZTY4NzMxZCIsImVtYWlsIjoiaW5mb0BwYXRyaWNrdmFsZXIuY2giLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE0OTYyNDE0NjAsImV4cCI6MTQ5NjI1MTU0MH0.VqwxvFavzhJtYe4XvPk9N19hzU62pGBUzA7XzlSPoq0\n```\n\n### Protected route (access for admin role only): `/api/adminonly`\nUser must have role `admin` to be able to get access to this endpoint. Token must be put in request header, by using `Authorization` key\n```\nGET /api/adminonly\nHost: localhost:3000\nAuthorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjU5MmRhZTg1NGQ4ODlmNzkwZTY4NzMxZCIsImVtYWlsIjoiaW5mb0BwYXRyaWNrdmFsZXIuY2giLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE0OTYyNDE0NjAsImV4cCI6MTQ5NjI1MTU0MH0.VqwxvFavzhJtYe4XvPk9N19hzU62pGBUzA7XzlSPoq0\n```\n\n## Scripts\n**Run for development**\n```bash\n$ npm run serve\n```\nRuns the application with [nodemon](\"https://nodemon.io/\"). Server is listening on Port 3000 by default, this can be overwritten by `API_PORT` constant in `src/config/config.js`. Application will automatically run babel and eslint and restart if a code change was detected.\n\n**Build**\n```bash\n$ npm run build\n```\nRuns eslint, transpiles the ES6 code and copies the transpiled code into build folder.\n\n**Test**\n```bash\n$ npm test\n```\nRuns eslint and verifies the unit tests from `test/` folder;\n\n## Eslint\n`eslint` is pre-configured for this project It uses the airbnb configuration package and a minimal set of own rules. Configuration is available in `.eslintrc.js`.\n\n\n## License\n\n*The MIT License (MIT)*\n\nCopyright (c) 2017 Patrick Valer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\nMade with ♥ by [Patrick Valer](\"https://patrickvaler.ch\") (\u003chello@patrickvaler.ch\u003e)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickvaler%2Fexpress-jwt-acl-mongoose-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickvaler%2Fexpress-jwt-acl-mongoose-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickvaler%2Fexpress-jwt-acl-mongoose-starter/lists"}