{"id":13311585,"url":"https://github.com/carvalhoviniciusluiz/restify-devise","last_synced_at":"2026-04-18T22:18:18.174Z","repository":{"id":94378638,"uuid":"128949441","full_name":"carvalhoviniciusluiz/restify-devise","owner":"carvalhoviniciusluiz","description":"Starter project for a rest api with restify \u0026 node-devise","archived":false,"fork":false,"pushed_at":"2018-04-26T17:47:15.000Z","size":63,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-01T13:05:40.054Z","etag":null,"topics":["api","authentication","boilerplate","es6","i18n","joi","jwt","mongodb","mongoose","passport","render","restify"],"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/carvalhoviniciusluiz.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":"2018-04-10T14:49:35.000Z","updated_at":"2019-10-08T21:32:01.000Z","dependencies_parsed_at":"2023-03-04T20:16:08.276Z","dependency_job_id":null,"html_url":"https://github.com/carvalhoviniciusluiz/restify-devise","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carvalhoviniciusluiz%2Frestify-devise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carvalhoviniciusluiz%2Frestify-devise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carvalhoviniciusluiz%2Frestify-devise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carvalhoviniciusluiz%2Frestify-devise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carvalhoviniciusluiz","download_url":"https://codeload.github.com/carvalhoviniciusluiz/restify-devise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242892565,"owners_count":20202557,"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","authentication","boilerplate","es6","i18n","joi","jwt","mongodb","mongoose","passport","render","restify"],"created_at":"2024-07-29T18:02:15.006Z","updated_at":"2026-04-18T22:18:17.223Z","avatar_url":"https://github.com/carvalhoviniciusluiz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eRestify Devise\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  Starter project for a rest api with \u003ca href=\"http://restify.com/docs/home/\"\u003erestify\u003c/a\u003e \u0026 \u003ca href=\"https://www.npmjs.com/package/node-devise\"\u003enode-devise\u003c/a\u003e.\n  Inspired by \u003ca href=\"https://blog.risingstack.com/node-js-project-structure-tutorial-node-js-at-scale/\"\u003eAdvanced Node.js Project Structure Tutorial.\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/carvalhoviniciusluiz/restify-devise\"\u003e\u003cimg alt=\"Travis Status\" src=\"https://img.shields.io/travis/carvalhoviniciusluiz/restify-devise/master.svg?label=travis\u0026maxAge=43200\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://scrutinizer-ci.com/g/carvalhoviniciusluiz/restify-devise/?branch=master\"\u003e\u003cimg alt=\"Code Coverage\" src=\"https://scrutinizer-ci.com/g/carvalhoviniciusluiz/restify-devise/badges/quality-score.png?b=master\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  It also allows users to deploy in Heroku without leaving the web browser and with little configuration.\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://heroku.com/deploy\"\u003e\n    \u003cimg src=\"https://www.herokucdn.com/deploy/button.svg\" alt=\"Deploy\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n- Restify Devise is consumable via API. To do this use [postman](https://www.getpostman.com/), [httpie](https://httpie.org/) or [curl](https://curl.haxx.se/).\n\n- Try it online - [restify-devise.herokuapp](http://restify-devise.herokuapp.com/)\n\n- Checkout our demo - [github.io/devise-vue](https://carvalhoviniciusluiz.github.io/devise-vue/#/)\n\n## Note\n\n- See the [node-devise](https://www.npmjs.com/package/node-devise) documentation for how to configure the user schema :).\n\n- For the tests will be used [httpie](https://github.com/jakubroztocil/httpie#installation)\n\n## Table of Contents\n\n* [Requirements](#requirements)\n* [Installation](#installation)\n* [Usage](#usage)\n  * [User registration](#user-registration)\n  * [Signing in](#signing-in)\n  * [Accessing Protected Routes](#accessing-protected-routes)\n    * [Password recovery](#password-recovery)\n    * [User unlock](#user-unlock)\n* [License](#license)\n\n## Requirements\n\n- node \u003e= 8\n- npm \u003e= 5\n\n## Installation\n\nYou must configure the environment variables to be able to run the application, follow the table below for this:\n\n\u003e Development-specific options must be added in the configuration file `.env`\n\n\u003e You can also perform manual deployment on heroku through the [installation](./heroku.deploy.sh) file.\n\n`sh heroku.deploy.sh`\n\nKey | Description\n------------ | -------------\nPROCESS_TYPE| Defines a main process between the various application processes.\nPORT| Server communication port.\nCLIENT_URI| Define a URL for client redirection.\nMONGODB_URI| Sets the location of mongodb. You can use the [mlab](https://mlab.com/signup/) service to receive a remote database.\nSECRET_KEY| Encryption private key.\nMAILER_USER| Reply email `may be fake`.\nMAILER_KEY| By default, the application consumes the [sendgrid](https://app.sendgrid.com/signup) service for sending emails. You must enter the access token for the project.\n\n## Usage\n\nWith the project installed correctly, you can test the endpoints below:\n\n\u003e You can use the web project to see the result of the routes below., e.g:\n\n\u003e `http restify-devise.herokuapp.com/session payload:='{\"email\": \"your@email\", \"password\": \"secret\"}'`\n\n#### User registration\n\n```\nhttp :8088/registration payload:='{\"email\": \"your@email\", \"password\": \"secret\"}'\n# HTTP/1.1 200 OK\n# {}\n```\n\nYou can change the language by changing the header `accept-language`:\n\n```\nhttp :8088/registration payload:='{\"email\": \"your@email\"}' 'accept-language: pt-BR'\n# HTTP/1.1 400 Bad Request\n# {\n#   \"code\": \"BadRequest\",\n#   \"message\": {\n#     \"context\": {\n#       \"key\": \"password\",\n#       \"label\": \"password\"\n#     },\n#     \"warn\": \"'Senha' é obrigatório\"\n#   }\n# }\n```\n\n#### Signing in\n\nWhen the account is not verified:\n\n```\nhttp :8088/session payload:='{\"email\": \"your@email\", \"password\": \"secret\"}'\n# HTTP/1.1 401 Unauthorized\n# {\n#   \"code\": \"InvalidCredentials\",\n#   \"message\": \"Account not confirmed\"\n# }\n```\n\nWhen the password is incorrect:\n\n```\nhttp :8088/session payload:='{\"email\": \"your@email\", \"password\": \"secret1\"}'\n# HTTP/1.1 401 Unauthorized\n# {\n#   \"code\": \"InvalidCredentials\",\n#   \"message\": \"Incorrect password\"\n# }\n```\n\nWhen the data is right:\n\n```\nhttp :8088/session payload:='{\"email\": \"your@email\", \"password\": \"secret\"}'\n# HTTP/1.1 200 OK\n# {\n#   \"token\": \"token\"\n# }\n```\n\n### Accessing Protected Routes\n\nRecovery needs a token, so create a token to continue:\n\n\u003e this example is [available here as well](./src/controllers/passwords/create.spec.js).\n\n```js\nconst createToken = () =\u003e {\n  return jwt.sign({}, 'secret')\n}\n```\n\n#### Password recovery\n\n```\nhttp :8088/password payload:='{\"email\": \"your@email\"}'\n# HTTP/1.1 401 Unauthorized\n# Unauthorized\n```\n\nthe correct access returns `204` and forwards an email to the informed account\n\n```\nhttp :8088/password payload:='{\"email\": \"your@email\"}' token=='token'\n# HTTP/1.1 204 No Content\n# {}\n```\n\n#### User unlock\n\nthe project is set to [lock the account after 3 incorrect access](#note) attempts,\na blocked account will return the following response:\n\n```\nhttp :8088/session payload:='{\"email\": \"your@email\", \"password\": \"secret1\"}'\n# HTTP/1.1 401 Unauthorized\n# {\n#   \"code\": \"InvalidCredentials\",\n#   \"message\": \"Account locked. Check unlock instructions sent to you.\"\n# }\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2018-present\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarvalhoviniciusluiz%2Frestify-devise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarvalhoviniciusluiz%2Frestify-devise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarvalhoviniciusluiz%2Frestify-devise/lists"}