Take this as a working example and as an inspiration. Pull Requests are welcome 🙏
think sinatra is nice? Don't forget to give Roda a chance!
maybe you're interested in JRuby, too? Joda will help you get started 🙌
This repository aims to be a boilerplate for a modular and modern (v4) Sinatra app.
There used to be a demo on heroku, but heroku is no more (free of charge at least) 🪦
Please check out the credits section! Without the community, this never would have been possible. Thank you.
Feel free to contribute, add more features, strip features or simply improve existing code - pull requests welcome 😄
Sinatra is a ruby/rack framework, that can be used as an alternative where Rails would simply be an overkill.
I started working my way through the sinatra docs, aiming for a setup that can easily be modeled to a basic use case.
Have you tried Roda, Sequel and Rodauth?
Yes! And I totally use that setup whenever possible (November 2021) and you should try at least roda as a POC 😎 I am 100 % serious! There's nothing wrong with sinatra, but roda kills it. The journey will undoubtedly make you a better (ruby) programmer.
I want this Sinatra boilerplate app to:
- work with Bundler
- use ActiveRecord as ORM
- have an MVC-like structure
- support Sass/Scss and CoffeeScript
- party with jQuery and Turbolinks! Yes, Turbolinks.
- rolls with a very basic bcrypt/warden based Authentication System
- use PostgresQL as Database
- run on heroku (don't forget:
$ heroku config:add APP_ENV=production)
You need Ruby (>= 3.2) and Bundler (of course).
$ git clone$ bundle install- edit config/database.yml
- set
SESSION_SECRETenvironment variable (see.env.example) $ rake db:setup$ bundle exec pumaorrerun rackup(rerun gem - not included by default!)- visit
localhost:9292in your browser - edit titles in views/layout.erb and views/nav.erb
- check/set timezone config/timezone.rb
$ cp .env.example .envthen edit and adjust (setDATABASE_HOST=db)$ podman compose -f compose.yaml build$ podman compose -f compose.yaml up -d db- Wait a few seconds for the database to be ready
$ podman compose -f compose.yaml run --rm web bundle exec rake db:setup$ podman compose -f compose.yaml up
Visit localhost:3000 in your browser.
The web service will automatically wait for the db service to be healthy before starting.
Adminer (database management UI) is available at localhost:8080.
- read the credits
- read the code
- run the code, see what it does
- delete what you don't need and built from there, should a barebone branch be offered? What do you think? 😁
Most code is commented, so you'll learn what it does.
- enable flash messages, especially for validation feedback
- Send in pull requests, improve this project with features or simply by adding/improving comments 😁
- Be nice, make public forks
- What did you use this app for? Please, let me know! Share your projects.
❤️ 😓 😭
Contributors to this project
https://github.com/simonneutert/sinatras-skeleton/graphs/contributors
thank you for open sourcing, writing documentation, blogging, answering and giving a hand on stackoverflow 👍
Warden
ActiveRecord + PostgresQL
BCrypt
Kieran's Answer on StackOverflow
Sprockets
Official Sinatra Docs