marten_turbo
Version, currently 0.4.07 versions
github.com/treagod/marten-turbo
Enhance your Marten app with dynamic updates using Turbo Frames!
Installation
# Add this to your shard.yml
dependencies:
marten_turbo:
github: treagod/marten-turbo
version: ~> 0.4.0Then run:
shards installshard.yml
- Crystal
>= 1.19.0- License
- MIT
Dependencies
Runtime Dependencies
- marten>= 0.6.0, < 0.8.0github: martenframework/marten
Development Dependencies
README
Marten Turbo adds Turbo Frames, Turbo Streams and Turbo-aware handlers to Marten applications.
It gives you three template tags (dom_id, turbo_frame, turbo_stream), a Crystal API to
build Turbo Stream responses, and versions of Marten's generic record handlers that answer with a
Turbo Stream when the browser asks for one.
This is the server side only. Turbo itself still needs to be installed and loaded in your frontend, for example through marten-importmap.
Compatibility
| Marten Turbo | Marten | Crystal |
|---|---|---|
| 0.4.x | 0.6.x, 0.7.x | >= 1.19 |
| 0.3.x | 0.6.x | >= 1.19 |
Installation
Add the shard to your shard.yml:
dependencies:
marten_turbo:
github: treagod/marten-turbo
Run shards install, then require it in src/project.cr:
require "marten_turbo"
The template tags are registered when the app is set up, so MartenTurbo::App has to be part of
your installed_apps:
Marten.configure do |config|
config.installed_apps = [
MartenTurbo::App,
# Other applications...
]
end
Skip that step and every template using dom_id, turbo_frame or turbo_stream fails with an
unknown tag error.
Example
A handler that creates an article and answers Turbo requests with a stream:
class ArticleCreateHandler < MartenTurbo::Handlers::RecordCreate
model Article
schema ArticleSchema
template_name "articles/create.html"
turbo_stream_name "articles/create.turbo_stream.html"
success_route_name "articles"
end
articles/create.turbo_stream.html gets the new record as record:
<turbo-stream action="append" target="articles">
<div id="{% dom_id record %}">{{ record.title }}</div>
</turbo-stream>
Regular form submits still get the redirect to articles. Only requests that accept
text/vnd.turbo-stream.html get the stream.
Documentation
The full documentation lives at
treagod.github.io/marten-turbo, or under
docs/ in this repository.
Contributing
Bug reports and pull requests are welcome on
GitHub. Run crystal spec and
crystal tool format before opening a PR.
License
MIT. See LICENSE.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.4.0- Tagged
- Sep 27, 2026
- Commit
98412c286ee4- Crystal
>= 1.19.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/treagod/marten-turbo
Metadata
- Created
- Aug 12, 2026
- Updated
- Nov 9, 2026
- Synced
- Nov 9, 2026
- Versions
- 7