3 ms·
My side project https://totalrealreturns.com/ https://totalrealreturns.com/ is now about 5k lines of Crystal. There are some rough edges: in particular I think
by compumike 4y ago
My side project https://totalrealreturns.com/ https://totalrealreturns.com/ is now about 5k lines of Crystal. There are some rough edges: in particular I think it could use a better templating solution (a port of HAML would be ideal!), and there are some failure modes with the Redis connection pool that have required workarounds.
This includes unit tests: the built-in spec framework is great and much like rspec. https://crystal-lang.org/reference/1.6/guides/testing.html https://crystal-lang.org/reference/1.6/guides/testing.html
I'm now starting to use Crystal for internal backend infrastructure and microservices.
For anyone who wants to kick the tires on Crystal, I built a crystal-docker-quickstart project template: https://github.com/compumike/crystal-docker-quickstart https://github.com/compumike/crystal-docker-quickstart works without having to install anything locally. (Assuming you have docker.) You can have your own, home-built "Hello world" static binary in under a minute:
git clone https://github.com/compumike/crystal-docker-quickstart.git my_app && cd my_app && ./d_dev
# in the shell that appears:
make && out/my_app
Then just edit src/main.cr and you're off and running :)
- paulgb 4y agoThat is one fast-loading page, especially for (what looks to be) dynamic data! Are you doing anything special or just using a good CDN?
- compumike 4y agoThanks :) No CDN actually -- it's just a side project served straight from a single VPS at the moment. You're probably just seeing the speed of response caching (which I've written in Crystal too, using Redis and local disk as storage backends). If you request a new ticker symbol that isn't already cached, or specify custom date ranges, it will recompute or even have to fetch data from upstream data provider, and those requests will take a bit longer. Also, the whole site is currently served up as a single HTTP request, except for a few external JS and CSS files (Bootstrap, uPlot) which are served from public CDNs.
- karol 4y agoNice project, learned a bit from it about some Vanguard funds I didn't know about previously.