Skip to content

Install Lesli core

Lesli is a Ruby on Rails gem designed to seamlessly integrate with your application. It ensures complete isolation of code, database, and assets, preventing any interference with your main RoR application.

Rails application

Create a new Rails application

shell
rails new LesliApp

Navigate to the LesliApp folder

shell
cd LesliApp

Add Lesli gem to your Rails app

shell
bundle add lesli

Database

Open the database configuration file LesliApp/config/database.yml

Add PostgreSQL as the main database (Currently Lesli is compatible only with Postgres)

yml
default: &default
  adapter: postgresql
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: "db_dev"
  username: "db_user"
  password: "db_pass"

test:
  <<: *default
  database: "lesli-test"
  username: "db_user"
  password: "db_pass"

Create the database for Lesli

shell
rails db:create

Lesli include a Rake task to start the database, this task is going to create, migrate, seed and initialize our database.

shell
rake lesli:db:setup

Router

Open the Rails routes file at: LesliApp/config/routes.rb and include the Lesli modules

ruby
Rails.application.routes.draw do
    mount Lesli::Engine => "/lesli"
end

Run Lesli

Execute the Rails server

shell
rails server

Using your favorite web browser navigate to http://127.0.0.1:3000/login, Lesli mounted devise at root level, so you already have an authentication engine working.

https://www.lesli.dev/login

The seeders comes with default users with different roles and privileges, to see Lesli in action use the owner user:

username: [email protected]
password: tardis2023$

INFO

It is possible to add development users, roles, privileges and more; we will explore this options later in the documentation.