ESC
Type to search...
S
Soli Docs

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 convenience of a batteries-included web framework.

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.

Reliable Runtime

Built in Rust for a stable, memory-safe runtime.

Batteries Included

Built-in ORM, WebSockets, and hot-reload development server.

Type Annotations

Optional type annotations for documentation, IDE support, and runtime validation.

The MVC Pattern

Soli follows the Model-View-Controller (MVC) architectural pattern, separating your app into three layers:

M

Model

Manages data, business logic, and database interactions. Located in app/models/.

V

View

Handles the presentation layer and HTML templates. Located in app/views/.

C

Controller

Coordinates between Models and Views to handle requests. Located in app/controllers/.

Project Structure

my_app/
├── app/
│   ├── controllers/      # Request handlers
│   │   └── home_controller.sl
│   ├── models/           # Data models
│   │   └── user.sl
│   ├── views/            # HTML templates
│   │   ├── layouts/      # Shared layouts
│   │   │   └── application.html.slv
│   │   └── home/
│   │       └── index.html.slv
│   └── middleware/       # Request interceptors
│       └── auth.sl
├── config/
│   └── routes.sl       # 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

def index(req: Any)
    let message = "Welcome to Soli!"

    render("home/index", {
        "title": "Home",
        "message": message
    })
end

3 Build a View

<h1><%= message %></h1>
<p>Start building something amazing.</p>

Next Steps