https://martenframework.com Marten logo Marten Documentation GitHub The pragmatic web framework Marten is a Crystal web framework that makes building web applications easy, productive, and fun. Get started with Marten Meet Marten Simple Marten's syntax is inherited from the slickness and simplicity of the Crystal programming language. On top of that, the framework tries to be KISS and DRY compliant as much as possible in order to reduce time-to-market. Fast Marten gives you the ability to build full-featured web applications by leveraging the bare metal performances of the Crystal programming language. It also makes a moderate use of macros and tries to optimize for decent compile times. Full-featured Marten adheres to the "batteries included" philosopy. Out of the box, it provides the tools and features that are commonly required by web applications: ORM, migrations, translations, templating engine, sessions, etc. Extensible Marten gives you the ability to contribute extra functionalities to the framework easily. Things like custom model field implementations, new route parameter types, session stores, etc... can be registered to the framework easily. App-oriented Marten allows to separate projects into a set of logical "apps". These apps can also be extracted in order to contribute features and behaviours to other Marten projects. The goal here is to allow the creation of a powerful apps ecosystem over time. Secure Marten comes with security mechanisms out of the box. Things like cross-site request forgeries, clickjacking, or SQL injections are taken care of by the framework to avoid common security issues. Batteries included The tools you need are built in the framework. Database ORM, translations, migrations, templates, sessions, and many more can be leveraged right away. 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 contents with templates Templates provide a convenient way to define your presentation logic and to write contents (such as HTML) that are 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 on GitHub The Marten framework is open source and is distributed under the MIT license. It is maintained and developed on GitHub. Contribute Marten logo Marten Marten is a Crystal Web framework that enables pragmatic development and rapid prototyping. It provides a consistent and extensible set of tools that developers can leverage to build web applications without reinventing the wheel. Learn more Getting started with Marten GitHub Code of Conduct (c) Marten framework 2022