Crystal web development, batteries included.

Marten provides a consistent and extensible set of tools for building complete web applications without reinventing the wheel.


Latest release: 0.6.4 (Aug 4, 2026)

Meet Marten

Batteries included

Marten adheres to the "batteries included" philosophy. Out of the box, it provides the tools and features that are commonly required by web applications: ORM, migrations, translations, templates, sessions, emailing, authentication, etc.

Consistent

Marten's components are designed to work together and follow consistent conventions across the framework, providing predictable APIs and development patterns.

Extensible

Marten's components are designed to work together and follow consistent conventions across the framework, providing predictable APIs and development patterns.

App-oriented

Marten allows separating projects into a set of logical "apps". These apps can also be extracted to contribute features and behaviors to other Marten projects, providing a foundation for developing and distributing reusable Marten applications.

Fast

Marten gives you the ability to build full-featured web applications while leveraging the native performance of the Crystal programming language. It also aims to keep compile times under control.

Secure

Marten comes with security mechanisms out of the box. Things like cross-site request forgeries, clickjacking, and SQL injections are taken care of by the framework to avoid common security issues.

Batteries included

The tools you need are built into the framework. ORM, migrations, translations, templates, sessions, emailing, authentication, and much more are available out of the box. Here are a few examples of what working with Marten looks like.

class Article < Marten::Model
  field :id, :big_int, primary_key: true, auto: true
  field :title, :string, max_size: 128
  field :content, :text
  field :author, :many_to_one, to: User
end

Design your models easily

Marten comes with an object-relational mapper (ORM) that you can leverage to describe your database using Crystal classes and a convenient DSL.

class Article < Marten::Model
  field :id, :big_int, primary_key: true, auto: true
  field :title, :string, max_size: 128
  field :content, :text
  field :author, :many_to_one, to: User
end

Process requests with handlers

Handlers are responsible for processing web requests and for returning responses. This can involve loading records from the database, rendering HTML templates, or producing JSON payloads.

class ArticleListHandler < Marten::Handler
  def get
    render "articles/list.html", { articles: Article.all }
  end
end
{% extend "base.html" %}
{% block content %}
    {% for article in articles %}
  • {{ article.title }}
  • {% endfor %}
{% endblock content %}

Render user-facing content with templates

Templates provide a convenient way to define your presentation logic and to write content (such as HTML) that is rendered dynamically. This rendering can involve model records or any other variables you define.

{% extend "base.html" %}
{% block content %}
    {% for article in articles %}
  • {{ article.title }}
  • {% endfor %}
{% endblock content %}

Contribute to Marten

The Marten framework is open source and is distributed under the MIT license. It is maintained and developed on GitHub.