Code Monkey home page Code Monkey logo

marten's Introduction

Marten

logo

Version License CI CI Discord


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.

Overview

Key characteristics

๐ŸŽฏ 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 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 moderate use of macros and tries to optimize for decent compile times.

๐Ÿงณ Full-featured

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, templating engines, 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 separating projects into a set of logical "apps". These apps can also be extracted to contribute features and behaviors 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 into the framework. Database ORM, translations, migrations, templates, sessions, and many more can be leveraged right away.

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

Render user-facing content 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 %}
<ul>
  {% for article in articles %}
    <li>{{ article.title }}</li>
  {% endfor %}
</ul>
{% endblock content %}

Documentation

Online browsable documentation is available at https://martenframework.com/docs.

Getting started

Are you new to the Marten web framework? The following resources will help you get started:

  • The installation guide will help you install Crystal and the Marten CLI
  • The tutorial will help you discover the main features of the framework by creating a simple web application

Authors

Morgan Aubert (@ellmetha) and contributors.

Acknowledgments

The Marten web framework initially draws its inspiration from Django and Ruby on Rails. You can browse the Acknowledgments section of the documentation to learn more about the various inspirations and contributions that helped shape Marten.

License

MIT. See LICENSE for more details.

marten's People

Contributors

ellmetha avatar sija avatar vladdoster avatar matthewmcgarvey avatar dredge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.