It's May and it's Monday and it's also one year anniversary edition! Time flies! This issue's topics are a mix of alternative frameworks and languages, but first let's see what happened in Svelteverse.
One release in the past month. Lots of fixes and new feature Support passing CSS custom properties to component.
Feels like a lot of energy is going into SvelteKit right now. The logo on its website is stunning. It also has a very smooth setup experience and minimal amount of dependencies. I encourage you to create a new project. I guarantee you will be pleasantly surprised.
Overall it's still a little shaky and rough around the edges, but we are off to a good start! You can tell that SvelteKit is gaining popularity by the increased number of YT videos and all the SvelteKit related questions being asked on Svelte subreddit.
According to Github it's 77% complete. I predicted at the end of June in the last newsletter. Let's see if my predictions hold up!
I guess we can now officially proclaim Sapper dead. Its development has stalled and for a good reason. Good luck with the migration to SvelteKit! Should be smooth as butter.
Fresh out the oven another Svelte state management solution. Immutable store for Svelte with full Typescript support and Redux Devtools integration. BOOM!
The cool thing about Svelte stores is that as long as you fulfill its contract you can pretty much do anything on the inside. No wonder there are so many new solutions popping up. It's fun and easy!
An example of how to integrate Stripe into a SvelteKit project. You have no good excuse left to not to charge for your app anymore.
Supabase (open-source Firebase alternative) is cool, SvelteKit is cool and auth is hard. Learn how to put everything together by studying this code.
Mad scientist Joshua Nussbaum is doing something crazy mad. He is doing a 1000 experiments experiment. One a day. They are not only code experiments, but still! That's like 3 years in total! Currently on #170.
Gitpod's New Site
Gitpod converted their site to SvelteKit. 200 pages. It's snappy and fast. Check it out with network tab open in Dev Tools!
Talking about Gitpod. Mike Nikles, who recently joined the company, has started a project called Webstone. He mentioned it on Twitter after I said that Svelte is currently missing a generator for CRUD. Like forms, DB access and other useful things that some frameworks have. Hopefully this project will make it easier to get started. Contribute!
A week ago this year's Svelte Summit was held. I haven't watched it yet, but maybe I will find some time to catch up.
Svelte vs React
This is not a comparison of the frameworks. Well, actually it is, but not which one is better than the other. After working with Svelte and using external libraries I've noticed that some of the libraries on NPM work better with React that with Svelte.
Why is that? Because Svelte is stateful and React is stateless. React is declarative. Every time you change state it will re-render itself, allowing you to call some library function in the process. Svelte, on the other hand, will not do anything when you modify state unless you explicitly tell it to.
One way to fix this is to use a computed variable. Every time the variable changes Svelte will call some function, but I must admit that it feels a little "hacky" to me.
I've mentioned above that Solid.js is gaining ground. It's a really cool and well designed framework with a React-like API. One good thing is that it, like Svelte, does not use virtual DOM. It also claims to be the fastest framework, but I doubt that it matters unless you are building games or something else requiring high FPS. I bet that your users won't complement you on your form field validations feeling snappy.
I've played with Elm a couple of years ago and liked it, but I've abandoned it because tooling (editor support) was not that great. Things have significantly improved since.
One thing I never liked (and still kind of don't) is the way you write HTML in Elm. It's lists all the way down and if you what to use an SVG icon you have to convert it to an Elm type first. There are CLI tools for that or you can do it with Webpack.
Even if you feel that Elm is not for you I recommend that you take a look at it. I guarantee it will influence how you write and structure your normal projects. In a good way.
Start by reading Elm at Rakuten. It's a long article (40 minute reading time!) evaluating Elm after two years in production with many interesting pointers to other places, not only Elm related.
One of the articles mentioned in the article above is TypeScript's Blind Spots that highlights some of the TypeScript type gotchas.
Read also Elm vs. Svelte if you are curious how the two differ.
Svelte with Webpack 5
Webpack might be old (I prefer mature), but it won't go anywhere soon. Many companies and projects around the world rely on it. You can't go wrong on betting on Webpack. Here is an article that shows how to setup a Svelte project using the newest Webpack 5.
Calculator fields in Svelte forms
In some situations Svelte's bidirectional bindings won't cut it and you have to reach for React-line unidirectional (one-way) bindings.
Version 7 of RxJS was finally released. 50% smaller, better typings and more consistent APIs.
Never heard of it before, but feels like I am a little late to the party. Neat service if you need to store some JSON in your app. And who doesn't, right?
Firebase SDK 9
Finally! Firebase has listened to its users and is releasing version 9 of the SDK which is tree-shakeable. Personally, I am very excited as Firebase SDK (Firestore and Auth) are a hefty (700kb!!) chunk of my app bundle. The app itself is around 150kb. The SDK is currently in beta.
If you don't want to use modern NoSQL solutions plain old SQL will get you far. There is this one project I've been keeping an eye on called Litestream. It's replication of SQLite database. You are probably rolling your eyes, but SQLite will take you far especially if you are on a budget or tinkering with a hobby app. Wrap it in a Hapi or Express server, add Prisma ORM, put it on some PaaS and you've just got yourself a nice and cheap API.
Here is an article that shows just how cheap it is https://mtlynch.io/litestream/
And finally ...
Bad Joke of the Monthpermalink
Q: How do you generate a random string?
A: Put a Windows user in front of Vim and ask him to exit
That's it for this month. Thank you for reading!
If you liked what you read, it would make me really happy if you could share it on Twitter.