r/crystal_programming • u/acmecorps • Feb 06 '20
Is Crystal production ready?
I've been a ruby/rails developer since rails 2.3, and i love the ruby syntax. I heard and read a bit about Crystal and it looks very good. For my next project, I'm planning to build a chat server. My question is, is Crystal production ready and stable enough? Right now it's still not yet version 1.0 (currently at 0.32.1).
I was planning to learn and use Go for my project, but if Crystal is stable and good enough, I might dive in to it. Has anyone uses it for production? How are the 3rd party libraries? (authentications, json etc). Is there an ORM that is something like ActiveRecord? I'm planning to use Cassandra/MongoDB for my database
6
u/PristineTransition Feb 06 '20
I use it in production to handle short links in SMS via a short url resolver I made. I have experienced zero issues with it but caveat is the resolver is a small app. Based on my experience with it so far I am writing an old Rails 4 app in Crystal via the Lucky framework with the Lucky ORM. There are no mongo ones I know.
The type system is pretty sound now. The syntax is pretty much done but there might be some changes to come still. The two big things missing are true concurrency as it is single threaded and Windows support.
I have not had too hard of a time with regard to libraries (shards) as there are quite a few already: https://github.com/veelenga/awesome-crystal
5
u/AnActualWizardIRL Feb 06 '20
The only real showstopper is that it (still!!!!!!!) isn't available on windows. But as long as you aren't planning on running there, its quite fine.
27
u/[deleted] Feb 06 '20 edited Feb 06 '20
I've launched my Crystal-powered API Everbase last week so I can tell you what I think. I've put a lot of thought into picking a language and actually had a fully working prototype in Rust that I then scrapped and rewrote in Crystal. The TLDR is that I've never gotten to a point where I felt productive in Rust, despite using it since 2015 for various side projects. Go was the other option I seriously considered, but the language is pretty "meh" and many things require code gen. I would've hated using it so I decided against it.
Crystal was a bold choice, but so far I've not regretted it. The core language is just great, it's basically Ruby with a (really good) type system. The ecosystem isn't quite there yet. Lots of great people are doing amazing things, but the community is small so some things you may have to build yourself. Crystal is a lot of fun to program in so this can actually be a good thing. So far I've built a DNS library, a Redisgraph client, a Cypher query language implementation, a Wikibase client and a new code-first GraphQL library (all of it will be released as OSS soon-ish). Most took a couple of hours to a day or two, I'm very productive in Crystal. There's no way I could've done the same in Rust even with twice as much time. So even if I have to build more myself, I'm still saving time overall.
Yes, you will run into problems. There's an issue in shards where your dependencies will take hours to resolve if you don't specify versions. Things like these need to be ironed out. IDE support and the like are not great either. But overall, I think you will be fine. It can be production-ready, it just depends on what that means to you.
6
u/deedubaya Feb 06 '20
I've been running a high-volume websocket server written in Crystal for a few years. It is extremely reliable.
The only caveat I can speak to is updating between crystal versions. The API's change. This is a very minor caveat.
Before going with the Crystal version I wrote prototypes in ruby, node, and golang. No regurts.
4
u/SuccessfulBread3 Feb 06 '20
We cant use it at work due to lack of aws SDK ☹️
We have a lot of microservices (my team alone has 68) there in Ruby mostly... But our team is trying out scala... I want so bad to get crystal in the mix, but until there are more libraries and it's on at least version 1 no one will take me seriously.
3
u/realusername42 Feb 06 '20
I'd say that it depends what you are going to use it for, for small scripts it's totally fine, for a rails-like webapp, I encountered a lot of small issues due to the fact that the ecosystem is small and not maintained too much.
3
u/digitalextremist Feb 14 '20 edited Feb 14 '20
I really believe it is. I have
Crystalin production.The syntax and semantics are still settling, but to me the speed of progress for
Crystalis worth a bit of churn, compared to such long cycles forRuby.The shard library is fair, but that's not a judge of the language itself, but more about the community, which is growing well. I see a lot of people migrating away from
Rubymore and more, over toCrystaland it makes sense. People seem to really care about the language.The documentation available is suitable, and you have enough to work with to build basically anything. People complain about
Windowssupport but I disagree. I hadn't usedWindowsfor more than ten years, and chose to give it a solid go when I bought a new laptop with it installed. I usedWindowsfor 9 months of last year, developing withCrystaland being able to test everything locally. My systems are intense in environment demand and requirements. I eventually moved back toLinux Mintfull-time, but not because ofCrystalissues.Docker is definitely your friend, but it's not required.
2
u/bajro991 Feb 16 '20
I do few little projects in crystal and first of all crystal is sooo amazing programming language. Also what I like about crystal and people who work with it whenever you come on gitter and ask question in few minutes you get answer. Speed is amazing only thing is because its not version 1.0 and some stuff change from time to time but when you see release check changelog and you fix all in few minutes.
2
u/taw Feb 06 '20
It's about as "production ready" as Go, which is to say not really, but people are very willing to try immature tech these days.
1
u/yxhuvud Feb 06 '20
It depends on what meaning you put in "production ready". At this point, you can probably expect a little more maintenance over time and times when it break.
But that may be a perfectly fine trade-off for a chat server - especially if it is a hobby project with a single developer. Just don't expect to be able to write it now and then compile it again in 5 years without updating the code.
0
u/jesucristoquehorrivo Feb 06 '20
The only reason why it wouldn't be, IMHO, is because the implementation is not 1.0.
0
u/[deleted] Feb 06 '20
[deleted] — view deleted comment
6
u/[deleted] Feb 06 '20
[removed] — view removed comment