My tech stack is about to explode 🤯
Effect, XState, Next, Drizzle. Everything is boiling under the surface, slowing building up to major releases.
Major 👀
Let's get a sneak peek 👇
Effect v4
The first sneak peek of v4 came during the Effect Days this year:
I am following the progress, PR after PR, on my Github feed.
The features and improvements in the video are just the tip of the iceberg ⛰️
A few other things that are landing in v4.
Optics
Directly from the "draft docs" of the upcoming effect:
Optics are a way to access and modify parts of data structures.
> Did I miss anything? Maybe... functional optics in v4? x.com/GiulioCanti/st…
(3/3) - Smart constructors - Memoisation - Functional optics (unofficial github.com/fp-ts/optic) - Property‑based testing & law checking - Initial encodings & interpreters Did I miss anything?
It solves the problem of changing values in nested objects/arrays:
const employee: Employee = {
name: "john",
company: {
name: "awesome inc",
address: {
city: "london",
street: {
num: 23,
name: "high street"
}
}
}
}
// Build an optic that drills down to the street name
const _name = Optic.id<Employee>()
.key("company") // access "company"
.key("address") // access "address"
.key("street") // access "street"
.key("name") // access "name"
// Create a function that changes the street `name`
const capitalizeName = _name.modify(String.capitalize)
const newEmployee = capitalizeName(employee) // ✨
// Instead of 👇
const newEmployee = {
...employee,
company: {
...employee.company,
address: {
...employee.company.address,
street: {
...employee.company.address.street,
name: String.capitalize(employee.company.address.street.name)
}
}
}
}
Needless to say, this is a huge deal. And it works out-of-the-box with Schema
⚡️
Differ
A new Differ
module allows extracting patches from multiple schema values.
Check out the PR here, it's based on JSON Patch (RFC 6902).
Another feature unlocked by the default JSON serializer in schema v4: compute & apply JSON Patch for any type (including custom ones)
It gives you a reliable way to converge schemas to the same value 🪄
IndexedDb
This is not from v4, but (hopefully) even sooner 🔜
Check out the IndexedDb PR (made by me 👋)
This module abstracts away the confusion of the IndexedDb API into a TypeScript-friendly Drizzle-like API:
Effect.gen(function*() {
const api = yield* Db.getQueryBuilder
const addedKey = yield* api.from("person").insert({
firstName: "John",
lastName: "Doe",
age: 30
})
const data = yield* api.from("person").select()
}).pipe(provideDb(Db))
The above is all IndexedDb, but it looks "like SQL", with Schema
defining the structure of your tables.
And it's all type safe, as type safe as it gets ✨
The upcoming IndexedDb module in @EffectTS_ is ✨ As type safe as it gets ☑️
XState v6
A bunch of work is happening also on XState (PR for XState v6).
There is a discussion open on Github with some proposed ideas 👀
A few things I am looking forward for:
- State-specific context ("typestates")
- Typed errors in actors
- Unified
enqueue
API
Of course, I plan to directly contribute to some of the above. This is going to be huge 🫡
Yes yes yes 👀 Just ping me anywhere when the v6 branch is ready for the work, and I will jump on it
Next 16
Next.js Conf is coming this October, and Next 16 with it.
Next.js Conf returns Oct 22 Live in SF. Streaming worldwide. Next.js 16. Workshops. Community. Lock in → nextjs.org/conf
Every major release of Next brings some interesting features (and challenges, as I jump in to migrate my codebase(s)).
Drizzle v1
Another milestone coming soon-ish is Drizzle v1.
This is a major rewrite, which (usually) means a huge jump in everything 🙌
We improved TypeScript types performance for Drizzle Relational Schema and Queries by ~x21.4 times TS v5.8.3: 728.8k -> 34.1k TS v5.9.2: 553.7k -> 25.4k types instantiations for 3300 lines production drizzle schema + 990 lines relations Turns out lower type instantiations
Bonus: TypeScript Go
Do not forget about TypeScript Go.
This will come later on (TypeScript v7?), but it's no doubt going to change everything. Be excited! 🎉
Meanwhile, AI is seriously getting serious for writing code (alongside you, of course).
You can instruct agents to speed up development on all fronts, especially if you know what the AI is doing. Don't miss out on this 👀
See you next 👋