Introduction
Welcome to Soli MVC, a modern web framework designed for developers who value both elegance and performance. Soli combines the expressiveness of dynamic languages with the speed of compiled execution.
What you'll learn
This guide will introduce you to the MVC pattern, Soli's philosophy, and help you understand how to build applications with Soli.
What is Soli?
Soli is a high-performance programming language and web framework written in Rust. It features:
Expressive Syntax
Inspired by Ruby and modern languages for maximum developer happiness.
Blazing Performance
Bytecode compilation with optional JIT for near-native speed.
Batteries Included
Built-in ORM, WebSockets, and hot-reload development server.
Type Safety
Optional static typing allows you to catch bugs early.
The MVC Pattern
Soli follows the Model-View-Controller (MVC) architectural pattern, separating your app into three layers:
Model
Manages data, business logic, and database interactions. Located in app/models/.
View
Handles the presentation layer and HTML templates. Located in app/views/.
Controller
Coordinates between Models and Views to handle requests. Located in app/controllers/.
Project Structure
my_app/
├── app/
│ ├── controllers/ # Request handlers
│ │ └── home_controller.soli
│ ├── models/ # Data models
│ │ └── user.soli
│ ├── views/ # HTML templates
│ │ ├── layouts/ # Shared layouts
│ │ │ └── application.html.erb
│ │ └── home/
│ │ └── index.html.erb
│ └── middleware/ # Request interceptors
│ └── auth.soli
├── config/
│ └── routes.soli # Route definitions
├── public/ # Static assets
│ ├── css/
│ └── js/
└── package.json # Build configuration
Quick Example
Here's how the pieces fit together in a simple Soli application:
1 Define a Route
get("/", "home#index");
get("/users/:id", "users#show");
2 Create a Controller
fn index(req: Any) -> Any {
let message = "Welcome to Soli!";
return render("home/index", {
"title": "Home",
"message": message
});
}
3 Build a View
<h1><%= message %></h1>
<p>Start building something amazing.</p>
Pro Tip
The fastest way to learn Soli is to build something. Start with a simple blog or todo app and expand from there!