A lightweight, framework-free Ruby web application that demonstrates how to build a Rack app with custom routing, controllers, and views.
Ruweb is an educational, minimal web project focused on understanding web fundamentals without Rails or Sinatra. It includes:
- A Rack-compatible application entry point (
App#call) - A singleton router with declarative route definitions
- Basic controller/action dispatching for dynamic routes
- Static file serving from
public/ - HTML views rendered directly from disk
The request flow is:
config.ruboots Rack middleware and runsApp.App#calldelegates route resolution toRouter.instance.- The router matches the path and either:
- executes an inline block route (for
/), or - infers controller/action for paths like
/articles/index.
- executes an inline block route (for
- Controllers return HTML strings that become the response body.
ruweb/
├── app.rb # Rack app class
├── config.ru # Rack boot file and middleware
├── config/
│ └── routes.rb # Route declarations
├── lib/router/
│ └── router.rb # Singleton router implementation
├── controllers/
│ ├── application_controller.rb
│ └── articles_controller.rb # Example controller
├── views/
│ └── index.html # Example view
└── public/
├── style.css
└── images/
- Ruby 3.0+ (recommended)
- Bundler
git clone https://github.com/syntaxmage05/ruweb.git
cd ruweb
bundle installStart the Rack server:
bundle exec rackupThen open:
- Home route: http://localhost:9292/
- Articles page: http://localhost:9292/articles/index
Defined in config/routes.rb:
GET /→ inline response ("Fred's Blog")GET /articles/index→ArticlesController#indexrenderingviews/index.html
- Static assets are served from
/publicviaRack::Static. Rack::Reloaderis enabled inconfig.rufor easier local iteration.- Routing uses a simple convention:
/<controller>/<action>.
Run RuboCop checks:
bundle exec rubocopRuweb is ideal for:
- learning Rack request/response mechanics,
- understanding how routers and controllers can be built from scratch,
- experimenting with Ruby web architecture before adopting larger frameworks.
No license file is currently included in this repository.