It is a starter for Ruby on Rails API application with devise gem with devise-jwt extension.
- Sign in/up/out
- Send an email when user resetting password.
- Send an email when user confirming email.
- Send email when user changed password.
- Development environment supports mailcatcher as default.
- Writed unit tests with rspec.
- Uses rubocop with extensions for code analyzing and formatting based on the community Ruby style guide.
Route | HTTP Verb | Request Body | Header Body | Description |
---|---|---|---|---|
/users | POST |
{user: {email: "foo@bar.com", password: "mypass", password_confirmation: "mypass"}} |
Empty | Returns authentication bearer token on header |
/users/sign_in | POST |
{user: {email: "foo@bar.com", password: "mypass"}} |
Empty | Returns authentication bearer token on header |
/users/sign_out | DELETE |
Empty | Authentication: Bearer Token | Returns sign out message |
/users/password | POST |
{user: {email: "foo@bar.com"}} |
Empty | Returns instructions about resetting password |
/users/password | PATCH |
{user: {reset_password_token: "token", password: "securepass", password_confirmation: "securepass"}} |
Empty | Returns status |
/users/confirmation | POST |
{user: {email: "foo@bar.com"}} |
Empty | Returns instructions about confirming password |
/users/confirmation/:confirmation_token | GET |
Empty | Empty | Returns status |
- Ruby
- PostgreSQL
- Mailcatcher (For development)
Create a file named ".env" in the root directory and fill its contents as follows for production environment.
DEVISE_JWT_SECRET_KEY=X
SMTP_MAIL_USERNAME=X
SMTP_MAIL_PASSWORD=X
SMTP_MAIL_ADDRESS=X
SMTP_MAIL_PORT=X
SMTP_MAIL_DOMAIN=X
RESET_PASSWORD_URL=X
CONFIRMATION_EMAIL_URL=X
-
Install GEM dependencies:
bundle install
-
Create database, migrate tables and run the seed data:
rails db:create rails db:migrate rails db:seed
-
If you are setting up again, when you already have previous databases:
rails db:reset
-
For dropping database
rails db:drop
GNU GENERAL PUBLIC LICENSE Version 3