Securial Gem
Overview
๐ก๏ธ What is Securial?
Securial is a mountable Rails engine that provides robust, extensible authentication and access control for Rails applications. It supports:
-
๐ JWT-based authentication
-
โช๏ธ API session tokens, with refresh tokens
-
๐คณ Simple integration with web and mobile apps
-
๐งน Clean, JSON-based API responses
-
๐ง User management with roles
-
๐ซ Database-agnostic support
๐ Why Securial?
Securial was built to offer a clean, modular, and API-first authentication system for Rails developers who want full control without the black-box complexity. Whether youโre building for the web, mobile, or both, Securial gives you the flexibility to implement exactly what you need โ from simple JWT authentication to more advanced setups involving sessions, API tokens, and role-based access.
It follows familiar Rails conventions, stays lightweight and database-agnostic, and keeps security at the core. With fully customizable controllers, serializers, and logic, Securial is designed to grow with your project โ making it an ideal choice for everything from side projects to production-grade APIs.
๐ Installation
Securial can be installed on an existing Rails application or use the securial new app_name
command to create a new Securial-ready Rails app.
Installation on an existing Rails app:
Add Securial to an existing Rails app is as simple as 1..2..3:
-
Add
gem "securial"
to your GemFile -
Run
bundle install
-
Run
rails generate securial:install
-
Mount the Securial engine in your Rails application
config/routes.rb
file:
โโruby Rails.application.routes.draw do mount Securial::Engine => โ/securialโ
# The rest of your routes
end โโ
-
Run the migrations by running the command:
rails db:migrate
๐ก Full installation steps are available in the Wiki โบ Installation.
โ๏ธ Configuration
Securial generates an initializer with sensible defaults and full control over logging, mailers, session settings, and roles.
For all configuration options and examples, refer to the Wiki โบ Configuration
๐ฆ Usage
After installation and mounting, Securial exposes endpoints like:
-
GET /securial/status โ Check service availability
-
POST /securial/sessions โ Sign in (JWT or session)
-
DELETE /securial/sessions โ Sign out
-
GET /securial/accounts/cool_username โ Get a user profile by username
-
GET /securial/admins/roles โ View roles
Securial returns consistent JSON API responses.
Full details, including authentication flows and protected routes, are available in the Wiki โบ Authentication module docs.
๐งฉ Modules
Securial is organized into modular components including:
-
Authentication
-
User Management
-
Generators
-
Identity concern
-
Configuration
Explore all modules in the Wiki.
๐ Development & Testing
-
Clone the repo on your computer
-
Run
bundle install
-
Start coding right away ๐โโ๏ธ
To run the test suite:
$ bin/test
View the coverage report:
$ open coverage/index.html
๐ค Contributing
Bug reports and pull requests are welcome on GitHub at github.com/alybadawy/securial.
-
Fork the repo
-
Create your feature branch (git checkout -b my-feature)
-
Commit your changes (git commit -am โAdd my featureโ)
-
Push to the branch (git push origin my-feature)
-
Open a Pull Request
โ๏ธ License
The gem is available as open source under the terms of the MIT license.
\ 1