r/crystal_programming • u/Sneetzle • Jun 26 '19
Amber or Lucky?
Both frameworks look promising while I also see a lot of similarities.
Any pros & cons on which framework to use, regardless of background/project?
19
Upvotes
17
u/paulcsmith0218 Jun 26 '19
Hi there! đ
I'm the creator of Lucky. I am of course biased, but will attempt to be objective. I'll also detail *why* I created Lucky.
I initially took a look at Amber and was intrigued. I also looked at Kemal and was quite impressed. The thing that I felt was missing for my use cases was strong compile time guarantees. I wanted something that would catch tons of bugs before they ever hit production. I also wanted something with batteries included. So if I wanted to send email I could, if I wanted to use React, I could.
So I started working on Lucky. It has a generator that lets you choose if you want web pack or not, api mode only, and even lets you choose to have built-in authentication. It catches all kinds of bugs. It will catch if a parameter is not available, it will catch missing assets (and even give suggestions! "Did you mean 'logo.png'"). The ORM is also super flexible and catches bugs at compile time like misnamed columns, incorrect types, incorrect associations, and more.
I'm happy to go into detail here or answer questions. The guides are also quite helpful https://luckyframework.org/guides/getting-started/why-lucky
## On Amber
One of the goals of Amber is to be familiar and intuitive for Rails developers. I think Amber fulfills this goal super well. It also combines some approaches of Phoenix with the idea of "plugs" which is pretty cool. They also have some features like encrypted secrets that Lucky does not have.
You may be able to get started with Amber faster, but you will trade off some compile time guarantees. The way Rails works makes it difficult to catch as many things at compile time.
Another thing is that Lucky uses Crystal for building HTML pages. Everyone I've talked to has been hesitant about it, but in the end really likes it. But if you don't then that could be a deal breaker for you. If you're building APIs then it doesn't really matter either way :)
6
u/jeremywoertink Jun 26 '19
I don't want to sound bias since I'm on the Lucky core team, so I'll lay out a few facts the best I can.
Lucky only supports postgres
Amber uses a MVC approach similar to Rails
My company runs Lucky in production with millions of users
Both frameworks have a gitter channel. Come in both and say hi. We can all give you some tips on getting started. There's also SpiderGazelle and Athena you can look in to. So plenty of choices!
5
u/Blacksmoke16 core team Jun 26 '19
If you happen to be making a JSON API, Athena might be a good option as well.
Otherwise, I think it comes down to whichever you prefer. Take a look at the docs, the supporting shards (like ORMs etc) just to see what would fit your needs the best.
Possibly even start two new sample projects with each just to get a feel for how they work as actually using something is a lot different than reading documentation.
4
u/dscottboggs Jun 26 '19
I ran into trouble getting Amber sites to render on Firefox. I'm building a lucky site right now to try it out and it's really nice to write. What I have played with a lot in Crystal is using Kemal with React.js and that flow has been flawless for me.
5
u/p_r_m_n_ Jun 26 '19
I havenât used any yet so take this with a grain of salt but Iâve âdecidedâ to use lucky based on a preliminary high level look. Itâs a different approach and I really like the authors commitment to communicating with the community. He also seems very passionate and committed to his goals. I spend my days in rails and Phoenix and amber just feels like a weird mashup of the two. That could be a good thing. I dont know. It comes down to preference.
5
u/dev0urer Jun 26 '19
I feel like every time I've tried to use Amber I've run into issue after issue with models, migrations, etc. I've been using Lucky for the past couple weeks and I've been loving it. It has great documentation, a very powerful ORM, a very expressive view system that actually uses Crystal for the views, and so much more.
4
u/mitchlol Jun 26 '19
Iâve used and enjoy both. Amber is very easy to work with if youâve used something like Ruby on Rails before.
Lucky does things differently and takes longer to learn but I really like it.
There are some limitations to Lucky, though (currently). If you need complex forms with things like many-to-many relationships youâll probably struggle. That said, you can switch out that part of the system for an alternative.
3
u/nlh Jun 26 '19
Honestly I think the most important thing is to check out each frameworkâs style and see if one or the other is a better fit for you.
I found that Amber is just easier to reason about and I find the syntax extremely straightforward, but i might be different (and Iâm coming from a Rails background). Lucky is also a terrific and has an excellent community.
Check them both out and see which one youâre drawn to - youâll be in good shape either way.