News for hackers. Stuff that matters.
Re:Marten, a Crystal web framework that makes building web a... by akudha on Sunday October 30, 2022 @07:46PM (#33400282)
I'm learning Cyrstal. Do you have any advice on which of the two frameworks you listed should a newcomer try?
Re:Marten, a Crystal web framework that makes building web a... by noaheverett on Sunday October 30, 2022 @07:51PM (#33400325)
They’re all good to try IMO, another is https://kemalcr.com which is akin to Sinatra if you just want to get an HTTP server with routes setup quickly.
Re:Marten, a Crystal web framework that makes building web a... by speg on Sunday October 30, 2022 @08:12PM (#33400474)
I made my own :) Was not efficient at getting a web project up, but a good way to learn the language itself.
Re:Marten, a Crystal web framework that makes building web a... by rishav_sharan on Sunday October 30, 2022 @11:52PM (#33401864)
You don't even need a framework with Crystal. The stdlib gives you all that you need. I personally do not use any frameworks at all.

Coming to your question, Amber is pretty much dead. Lucky or Kemal are the big ones to use. There are also Athena and Azu toolkit.

Re:Marten, a Crystal web framework that makes building web a... by viraptor on Monday October 31, 2022 @12:25AM (#33402066)
> The stdlib gives you all that you need

Url with variables routing? Csrf generation? Session loading? Forms processing? Templating? ORM? Assets pipeline integration?

If you're doing a very simple api, maybe stdlib will do. But for actual interactive webapp, it's not even close with what is normally used from web frameworks.

Re:Marten, a Crystal web framework that makes building web a... by rishav_sharan on Monday October 31, 2022 @06:03AM (#33403775)
> Url with variables routing?

No. But then I find that trivial to implement. Takes around 10 lines of code.

> Csrf generation?

Yes. You can generate secure tokens and send them in headers.

> Session loading?

No. And this one is a pain point. But then I didn't find any session libs in go or nodejs that fitted my needs, so I have no issues rolling my own.

> Forms processing?

Not sure whats the need here. Do you mean validating the inputs? Again thats just a few lines of code.

> Templating?

ECR Templating in stdlib works well.

> ORM? I do not use ORMs as I prefer to write my sql queries by hand. Crystal provides object mapping with query results by default.

> Assets pipeline integration?

Not very sure what you mean here.

Overall, I personally feel that I can get all that i need for my app in about a couple of dozen lines of code and I don't really need the emntal overhead of learning a new framework. But I suppose others will have a different view point.

Here are some of my repos which can give an idea of how I do things in crystal; https://github.com/rishavs/kaipi https://github.com/rishavs/cove

Re:Marten, a Crystal web framework that makes building web a... by FerociousTimes on Monday October 31, 2022 @06:38AM (#33404005)
Writing boilerplate code manually is not something that should be touted as a best practices esp if you intend to reinvent the wheel every time you want a usecase implemented that was probably covered thoroughly by a framework somewhere else.

With frameworks esp like the ones as RoR, the Convention over Configuration (CoC) consideration trumps all the purported benefits that may arise from building your own framework from scratch.

You just learn the fundamentals of one of the robust and well-established frameworks once, and forget about all the fluff and cruft, and just focus on building the business logic and satisfying the user's/customer's needs.

The Not Invented There (NIT) anti-pattern is one hell of a drug!

Re:Marten, a Crystal web framework that makes building web a... by npn on Monday October 31, 2022 @01:45PM (#33409606)
well one of the weakest point of crystal is it's slow compiling time. A full-featured framework for crystal looks nice on paper, but after your app grow it will become a hinder instead, solely for the additional compiling time overhead of all the nice features the framework provided.

It hurts my productivity so bad I have to split the code base to multi independent services, each one use a simple server to serve some part of the system. After this those frameworks just cease to being helpful.

Re:Marten, a Crystal web framework that makes building web a... by aliqot on Monday October 31, 2022 @09:53AM (#33405698)
gorilla/session is nice
Re:Marten, a Crystal web framework that makes building web a... by viraptor on Monday October 31, 2022 @03:27PM (#33411397)
It's 10 lines here, 10 lines there. But they're not really 10 - in practice that's going to be 100 once you get past the most trivial use case and add good error handling. Then there are tests to make sure it works. Once you write all of those bits you need properly and start sharing it with your next web app and add some generalisation/config... you've created half a custom framework.
Re:Marten, a Crystal web framework that makes building web a... by xialvjun on Monday October 31, 2022 @04:19AM (#33403209)
But Amber's Latest release: v1.3.0 - 10/26/2022
Re:Marten, a Crystal web framework that makes building web a... by jasonl99 on Thursday November 03, 2022 @09:58AM (#33451073)
I've been playing around with crystal for years, and absolutely love it (I'm a full-time ruby dev using Sequel as an ORM). I wish I had more time to spend with crystal. Kemal (referenced above) is really good, and excellent with websockets.

That said, I started playing around with the Marten framework and while it's really new, it's an amazingly good start. I absolutely love the way that models automatically create migrations. Using Sqlite as a default is good for probably 99% of uses cases, and absolutely good for learning the framework (Sqlite itself is amazingly powerful).

I've been wondering what new shiny toys I was going to play around with over vacation during the holidays, and I now have my answer :).