Skip to content

Minimalistic Roda-based app with Sequel-powered migrations

Notifications You must be signed in to change notification settings

vladyio/roda-sequel-blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roda & Sequel blog app

  1. Motivation
  2. Setup
  3. Application structure

Motivation

Self-introduction into Roda, Sequel ecosystem and Zeitwerk autoloading.

Setup

  1. Install dependencies:
bundle install
  1. Configure the .env file
touch .env

# Generate a secret key:
ruby -r 'securerandom' -e 'puts "SECRET_KEY=#{SecureRandom.hex(32)}"' > .env

# Add database name:
cat "DATABASE_NAME=YOUR_DB_NAME" > .env
  1. Prepare the database (sqlite3):
bundle exec rake db:create
bundle exec rake db:migrate
  1. Run Puma application server at http://localhost:9292 with a Rake default task:
rake

# OR to run explicitly:

rake start

Application structure & architecture

Gems

The application is built with:

  1. Roda routing toolkit for routing
  2. Sequel for database connection, migration and ORM
  3. Zeitwerk to autoload/reload application during development
  4. dry-configurable for ApplicationSettings class to store application settings
  5. tilt & erubi for the view layer

Boot process

  1. Entrypoint: config.ru
  2. requires config/boot
  3. requires config/application_loader and config/application_settings
  4. config/application_loader sets up the zeitwerk gem, which autoloads the whole app directory
  5. Rack runs the Router from app/router.rb (basically the application itself, with routes and actions)

Models are in app/models directory.

Views are in app/views directory. Partials are supported as well.

About

Minimalistic Roda-based app with Sequel-powered migrations

Topics

Resources

Stars

Watchers

Forks