/simple_panel_rails_backend

Admin panel rails grape API with authentication

Primary LanguageRubyMIT LicenseMIT

Build Status

SIMPLE PANEL RAILS API

Staging: https://simple-panel-rails-backend.robertz.co/api/docs

REACT CLIENT:

Staging: https://simple-panel-react-client.robertz.co Repository: https://github.com/robertziel/simple_panel_react_client

About service:

  • Grape API: /api
  • Swagger documentation: /api/docs

Seed sample user rake db:seed:

  • email: hello@robertz.co
  • password: 12345678

Docker

Repository contains basic docker setup. depending on needs you can run app locally using both traditional rails server or docker-compose.

Docker compose is set up as default to run locally in development environment but can be easily changed for production needs.

Check this link for more about docker implementation: https://docs.docker.com/compose/rails/

  1. Build:
docker-compose build
  1. Set up database (run always after migration file added):
docker-compose run web rake db:create db:migrate db:seed
  1. Start containers and check localhost:8080:
docker-compose up
  1. Shut down containers:
docker-compose down

ENV

Set in .env:

  • CORS_ALLOWED_ORIGINS - if empty localhost:3000 is used as default
  • HOST - subdomain the application is available in

User authentication:

  • written from scratch, only bcrypt gem is used
  • after successful sign in API returns token used for further authentication active for one day
  • user cannot register - should be added from panel Not implemented yet
  • Other features worth adding in the future (depending on project requirement):
    • new user must confirm email
    • account is locked after N unsuccessful login attempts, then unlocked by token link sent via email
    • forgotten password token link sent via email
    • add last login IP etc.

To do:

https://github.com/robertziel/simple_panel_rails_backend/projects/1