Using a beta language and framework in production, Crystal and the Lucky framework

0 112
Avatar for nolyoi
Written by
3 years ago
Topics: Crystal, Lucky, Programming, Code, Coding, ...

Crystal and Lucky

It's been awhile since I've posted. But, I've been hard at work building an application using Crystal and the Lucky framework. In this post I will go over how the project has been going and what it's been like using a language and framework that are both still in beta.

Due to a non-disclosure agreement, I can't give too many details. However, as I stated, we have been using Crystal and Lucky for a couple months now. This is all currently set up in a Docker container.

Our development process is pretty typical. Clickup has been amazing for issue tracking, sprints, and all of that good stuff. Our branche names are generated in Clickup via their Github integration, so all you have to do is copy the git code given to you and it will checkout a branch and link it up to clickup.

From there we use some GitHub actions to check various things such as code formatting, run our tests, deploy the branch to a small testing container and more.

One issue I did encounter was with how Lucky handles forms. Forms basically have a 1 to 1 relationship right now and there isn't support for nested forms that you can find in Rails. This leads to creating separate save and update operations. Creating attributes for the fields that belong to the model that would normally be nested that now have to get a default value set for them by creating methods to query the model. Then the nil checks on top of it. That can get messy very quickly. Thankfully, nested forms are on the roadmap for the 1.0 release of Lucky. Whew.

Another thing that can be a bit bothersome is the time it takes to compile and test the app. Every time you save, Crystal has to recompile the entire app before you can use it because it is a compiled language. It's not terribly slow, but it can definitely slow you down a bit. Same goes for the tests. If you have a lot of tests to run, it can be quite slow. Hopefully some shards get written in the future to address this possibly by using concurrency or, a unique solution I've seen in Ruby, run tests only on the files that have changed.

Overall, the experience has been pretty great imo. I've been big on Crystal for a little while now and now that I've gotten pretty deep into Lucky, I'm loving it as well. But, it still does have some shortcoming being such a new framework. Their documentation is great, but having such a small community, you won't find much else help. They do have a Discord channel with very active devs, I can't really say I've had a moment where I was completely stuck and couldn't figure out the solution to the problem.

I'm looking forward to working on more projects in the Crystal language. If I ever have the opportunity to use this pair again in the future, it will definitely be near the top of my list.

I've actually started a personal project using Crystal and Lucky. It is an app inspired by StackOverflow but tailored specifically to the Crystal ecosystem. I'll attach some screens below though I am still a bit away from finishing it.




If you'd like to learn more about Crystal or Lucky, please checkout their websites and get involved!

Crystal: https://crystal-lang.org/
Lucky: https://luckyframework.org/

1
$ 0.30
$ 0.30 from @TheRandomRewarder
Avatar for nolyoi
Written by
3 years ago
Topics: Crystal, Lucky, Programming, Code, Coding, ...

Comments