This week periodic appointment with refactoring the blog and organizing my open source contributions.
This time I was able to under-engineer the implementation (this never happened before π€―).
Released update 1οΈβ£ β Faster pages (generated at build time) β Better code examples styling β Removed dependencies Next round coming π
π‘ Project update π‘ The articles are reaching the next level π β Step by step difference β Highlight lines with blur β Copy code Better examples = Easier to understand π€
I also published a new open source package ππΌββοΈ
Here is everything that I shipped this week π
Tech stack
- Effect: new core dependency that runs my website, everything is implemented starting from Effect
- NextJs: the website uses
nextjs
(since a long time ago) - Dart: new open source package released on pub.dev (
ITrie
)
Setup
Every once in a while I take some time to review and improve my stack.
On the web nowadays, if your codebase was implemented 6 months ago, today it would be completely outdated ποΈ
The same can be said for open source projects: they require continuos improvements and support π οΈ
In preparation for a strong 2024, my goal was:
- Add features to the blog, while at the same time reducing dependencies and improving performance
- Organize and plan a roadmap for my open source projects
TLDR: I made it ππ
Get started
This was the situation of the blog before the improvements:
- Local
mdx
articles powered bycontentlayer
- NextJs version 13 (outdated)
- Effect (without a proper structure)
This is the the situation after the improvements:
- Local
mdx
articles served without external dependencies - Newest version of NextJs, all the articles generated at build time (performance π)
- Effect everywhere ππΌββοΈ
This level of performance π
Second major update: I published a new package on pub.dev βοΈ
π I published a new package π Welcome ITrie β‘οΈ Efficient, immutable and stack safe Trie in @dart_lang Store and search string and prefixes with β‘οΈ speed This is how it works ππ§΅
Let's see how I got here π
There is more π€©
Every week I dive headfirst into a topic, uncovering every hidden nook and shadow, to deliver you the most interesting insights
Not convinced? Well, let me tell you more about it
Implementation
How many dependencies can I remove while still having the same (and more) features? π€
Every external dependency has a (significant) maintenance cost, especially on the web βοΈ
My blog was based on contentlayer
. Nonetheless, the library wasn't getting any update for a while now:
contentlayer is still based on an older version of nextjs. This dependency was starting to cause some update problems on my blog
Back to the basics: Node
Last week I read a blog post from Lee Robinson (@leeerob) on his 2023 blog update:
This is how to remove dependencies and come back to plain node
I did the same using Effect (of course ππΌββοΈ)
π‘ How I use @EffectTS_ with @nextjs π‘ 1οΈβ£ Implement all the logic using Effect (Services) 2οΈβ£ Execute a single main function in a server component 3οΈβ£ Return possible errors and success value Clear separation logic/UI β
Adding features and improve performance
At the same time I updated some styling and added some features:
βΉοΈ Project update βΉοΈ You can now copy code snippets on my blog π‘ This was definitely a missing features, but now it's there to stay ππΌββοΈ
Another idea I implemented is to generate all the article pages at build time using nextjs
:
export async function generateStaticParams() {
return await mainAll.pipe(Effect.runPromise);
}
export default async function Page({
params: { slug },
}: {
params: { slug: string };
}) {
const { source, tableOfContents, frontmatter, readingTime } = await main(
slug
).pipe(
Effect.catchAll(() => Effect.sync(() => redirect("/articles"))),
Effect.runPromise
);
return ( /** */ );
}
π‘ Win-Win: Less dependencies, more features, better performance
New open source package: itrie
I ported my Trie implementation from typescript to dart and published a new package: ITrie
All open source and available on pub π₯ Check it out π pub.dev/packages/itrie
A Trie is ideal when working with String
and words in general (more examples coming π).
Tweet not found
The embedded tweet could not be foundβ¦
I also did some research on the present and future of
fpdart
. More updates on this in the upcoming weeks, you don't want to miss this π
I wrote a complete overview of how my website is implemented using Effect, NextJs, and MDX.
This article covers all the details of the engine behind the blog and the newsletter π¨βπ»
Takeaways
- Take some time to update your tech stack every once in a while
- Technologies are evolving fast: you need to be continuously learning and exploring to stay up to date
- It's possible to remove dependencies and still add features (under-engineeringβ’οΈ)
- 2024 will be a powerful year: be prepared for much more content and upgrades π
Now the blog is ready for all the upcoming project of the next weeks.
I am planning some interesting updates: Effect, fpdart
, Flutter apps, local-first and more π
See you next π