Hey there!
Summary of this email:
- Domain vs Infrastructure (+ Automatic Embeddings in Postgres course published in the Standard plan)
- ChatGPT 5 drops today and OpenAI news
- ManagerPro updates
Estimated reading time: 4 minutes.
⚡ Domain vs Infrastructure
This seems like something we usually have pretty clear:
- What goes in domain: Our business logic.
- What goes in infrastructure: Everything else (saving to db, calling an API...).
But sometimes there are nuances, gray areas, where things can get complicated.
One of those gray areas is embedding generation.
Embedding generation is the transformation of data (text, images, audio...) into numerical vectors that capture their semantic meaning, enabling operations like similarity searches.
In short: Transforming data so you can later search through it semantically.
Instead of doing: SELECT * FROM products WHERE color = 'red' and price < 100; you could do SELECT * FROM products WHERE embeddings <=> 'red colored and less than 100 EUR'.
To generate this embedding, we need to call an LLM that generates them.
So, easy, right? We create an interface in the domain for embedding generation and then implement it in infrastructure.
If only the debate ended there.
- Does our domain need to know about the concept of embeddings? Should our entity have that field?
- Is it generated on insert or asynchronously?
- Isn't it like an index that can be fully delegated to the database?
There are many decisions to make here. Some better than others. None perfect.
Depending on the case, one will work better than another.
Our recommendation: If possible, make it asynchronous, trying to keep the domain as clean as possible.
One way to achieve that is to delegate everything to the database. Be careful here though, as not all databases support this.
One that does is Postgres, since it allows HTTP calls through its triggers + has a queue system to make it more scalable.
Conclusion: The line between what is domain and what is infrastructure isn't always clear, but knowing our tools inside and out can help us decide where to put each thing.
If you want to learn how to move all that logic to Postgres, we've just published the Automatic Embeddings in Postgres course in Codely Pro Standard. 😊
- We compare different ways to generate them
- Trigger vs MQ queues vs domain events
- In the most scalable way
🆕 ChatGPT 5 drops today and OpenAI news
Yesterday, the folks at OpenAI posted a tweet with the following text: LIVE5TREAM THURSDAY 10AM PT.
So most likely, today at 7pm CEST, we'll get to see GPT-5. And we hope it's not just an incremental jump, but a real statement showing that OpenAI is still in the lead.
Because on top of that, last Tuesday, they released their open source models (finally something open from OpenAI!). They seemed like very powerful models, but now that a couple of days have passed and people have been able to run benchmarks, they're not as impressive as they seemed.
All this and more, we'll be discussing tomorrow at 9am CEST on Cafe con Codely. You can follow it on YouTube or Twitch.
💥 ManagerPro updates
This week, in the ManagerPro newsletter we published a post about how to get headcount increases for your team. Something that's usually quite tricky since the default answer tends to be no.
We've also finished publishing the Conflict Management: Common Mistakes course. A course where you'll learn to recognize the most common mistakes in conflict management so you can avoid them. All with real examples and simulated scenarios.
You can sign up for ManagerPro here. 😊
And since you've made it this far in the newsletter, here's the joke of the week, which I know you were waiting for:
> Why did the developer go broke? Because he used up all his cache. 😂
Cheers!