Skip to content

It is a starter for Ruby on Rails API application with devise gem with devise-jwt extension.

License

Notifications You must be signed in to change notification settings

nejdetkadir/devise-jwt-starter

Repository files navigation

CircleCI Ruby Style Guide Ruby Version Rails Version GPLv3 license Deployed to Heroku

Devise JWT Starter

It is a starter for Ruby on Rails API application with devise gem with devise-jwt extension.

Features

  • 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.

API Endpoints

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

Installation

Prerequisites

Environment variables

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

For Running

  • 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

LICENSE

GNU GENERAL PUBLIC LICENSE Version 3