{"id":15724878,"url":"https://github.com/ephraimduncan/node-express-auth-api","last_synced_at":"2026-04-05T21:04:48.988Z","repository":{"id":111607581,"uuid":"569778864","full_name":"ephraimduncan/node-express-auth-api","owner":"ephraimduncan","description":"A Simple Node Authentication REST API with Express and MongoDB","archived":false,"fork":false,"pushed_at":"2022-11-28T18:01:20.000Z","size":62,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T06:32:30.259Z","etag":null,"topics":["boilerplate","express","mongodb","mongoose","nodejs","rest-api"],"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/ephraimduncan.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2022-11-23T15:39:59.000Z","updated_at":"2025-01-04T12:07:10.000Z","dependencies_parsed_at":"2023-03-11T13:30:20.710Z","dependency_job_id":null,"html_url":"https://github.com/ephraimduncan/node-express-auth-api","commit_stats":null,"previous_names":["ephraimduncan/node-express-auth-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephraimduncan%2Fnode-express-auth-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephraimduncan%2Fnode-express-auth-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephraimduncan%2Fnode-express-auth-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephraimduncan%2Fnode-express-auth-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ephraimduncan","download_url":"https://codeload.github.com/ephraimduncan/node-express-auth-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246399801,"owners_count":20770909,"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","express","mongodb","mongoose","nodejs","rest-api"],"created_at":"2024-10-03T22:18:15.501Z","updated_at":"2025-12-30T22:28:35.219Z","avatar_url":"https://github.com/ephraimduncan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Node.js Auth API\n\nA Simple Authentication RESTful API using Node.js, Express, and Mongoose.\n\nBy running a single command, you will get a production-ready Node.js app installed and fully configured on your machine. The app comes authentication using JWT, request validation\n\n## Installation\n\nIf you would still prefer to do the installation manually, follow these steps:\n\nClone the repo:\n\n```bash\ngit clone https://github.com/dephraiim/node-express-auth-api\ncd node-express-auth-api\n```\n\nInstall the dependencies:\n\n```bash\npnpm 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\n## Table of Contents\n\n- [Features](#features)\n- [Commands](#commands)\n- [Environment Variables](#environment-variables)\n- [Project Structure](#project-structure)\n- [API Endpoints](#api-endpoints)\n- [Authentication and Authorization](#authentication-and-authorization)\n- [Upcoming Features](#upcoming-features)\n- [Contributing](#contributing)\n\n## Features\n\n- **NoSQL database**: [MongoDB](https://www.mongodb.com) object data modeling using [Mongoose](https://mongoosejs.com)\n- **Authentication and authorization**: using [JWT](https://jwt.io)\n- **Validation**: request data validation using [Joi](https://github.com/hapijs/joi)\n- **Logging**: using [morgan](https://github.com/expressjs/morgan)\n- **Error handling**: error handling mechanism using [http-errors](https://github.com/jshttp/http-errors)\n- **Environment variables**: using [dotenv](https://github.com/motdotla/dotenv)\n\n## Commands\n\nRunning locally:\n\n```bash\npnpm dev\n```\n\n## Environment Variables\n\nThe environment variables can be found and modified in the `.env` file. They come with these default values:\n\n```bash\n# Port number\nPORT=3000\n\n# URL of the Mongo DB\nMONGODB_URL=mongodb://127.0.0.1:27017/\nDB_NAME=node_express_auth_api\n\n\n# JWT\n# JWT secret key\nACCESS_TOKEN_SECRET=\"\"\nREFRESH_TOKEN_SECRET=\"\"\n```\n\n## Project Structure\n\n```\nsrc\\\n |--controllers\\    # Route controllers (controller layer)\n |--models\\         # Mongoose models (data layer)\n |--routes\\         # Routes\n |--lib\\            # Utility classes and functions\n |--app.js          # Express app\n```\n\n## API Endpoints\n\nList of available routes:\n\n**Auth routes**:\\\n`POST /auth/register` - register\\\n`POST /auth/login` - login\\\n`POST /auth/refresh` - refresh auth tokens\\\n`POST /auth/logout` - logout a user\\\n\n## Authentication and Authorization\n\nThese routes require a valid JWT access token in the Authorization request header using the Bearer schema. If the request does not contain a valid access token, an Unauthorized (401) error is thrown.\n\n**Generating Access Tokens**:\n\nAn access token can be generated by making a successful call to the register (`POST /auth/register`) or login (`POST /auth/login`) endpoints. The response of these endpoints also contains refresh tokens (explained below).\n\n**Refreshing Access Tokens**:\n\nAfter the access token expires, a new access token can be generated, by making a call to the refresh token endpoint (`POST /auth/refresh`) and sending along a valid refresh token in the request body. This call returns a new access token and a new refresh token.\n\n## Upcoming Features\n\n- Set Secure HTTP Headers using Helmet\n- gzip compressiong with express-compression\n- Continuous Integration with Github Actions\n- Docker Support\n- Git Hooks\n- Unit and Integration Tests\n- API Documentation with Swagger\n- TypeScript Support\n- Linting with ESLint\n- Pagination\n\n## Contributing\n\nContributions are more than welcome! Please check out the [contributing guide](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephraimduncan%2Fnode-express-auth-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fephraimduncan%2Fnode-express-auth-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephraimduncan%2Fnode-express-auth-api/lists"}