CoursesAI WorkshopCompaniesPricingBlogNewsletter
  • Courses
  • AI Workshop
  • Companies
  • Pricing
  • Blog
  • Newsletter
Subscribe

Subscribe to our newsletter

Don't miss the news that are truly worth it:

By subscribing you agree to the privacy policy
  • Courses
  • Companies
  • Communities
  • Blog
  • Gift card
  • Newsletter
  • Help
  • Shop
  • ConfAiBot
  • Contact
  • Legal notice
  • General conditions
  • Privacy policy
  • Cookies policy
What happens when IDs can NOT be UUIDs?

What happens when IDs can NOT be UUIDs?

23 October 2025

Subscribe to our newsletter

Don't miss the news that are truly worth it:

By subscribing you agree to the privacy policy

Hey there!

Summary of this email:

  • What happens when IDs can NOT be UUIDs? (+ extra content added to courses)
  • We're going live from TRGx today! (follow along here)

Estimated reading time: 2 tiny minutes.


🔑 What happens when IDs can NOT be UUIDs?

Something like this happens with invoice numbering in Spain, for example. Invoice series must have sequential and consecutive numbering. No gaps, no duplicates.

So, dream on 🌈.

If we have a domain constraint like this, we have no choice but to accept it. We'll keep modeling the "invoice.id" as a UUID, but it will also have the "invoice.serie" and "invoice.number" fields, which are the data the user actually understands as the invoice "identifier." We can generate that ID within a transaction.

Also, in that case the frontend can't decide it because race conditions could occur where an invoice number gets duplicated, for example.

Another case is when we don't have this kind of constraint, but having an ID that long just feels unwieldy. This also happens to us at Codely, for instance, with course identifiers.

For example this URL: codely.com/cursos/mcp-a-fondo-crea-tu-servidor-siguiendo-buenas-practicas-3cp2

There we're seeing the "url_id" (3cp2), which allows us to have "self-healing URLs." That means if tomorrow the course name changes to "MCP," the URL will be: codely.com/cursos/mcp-3cp2, but the links we might have published in tweets pointing to the previous URL, codely.com/cursos/mcp-a-fondo-crea-tu-servidor-siguiendo-buenas-practicas-3cp2, will still work because the ID 3cp2 handles the redirect.

You can try it: codely.com/cursos/hola-caracola-3cp2

The thing is, we don't want to "pollute" the URL with a monster string like the UUID that is the real "course.id." So we create another field with a much shorter ID that, in this case, can be generated by the frontend because it's random, and off we go. 😊

In fact, this question is so good that we've expanded the Aggregates course (and others) to answer interesting questions:

  • Domain Modeling: Aggregates
    • What happens when IDs can NOT be UUIDs
  • Domain Modeling: Repositories
    • Does a repository always have to return the same entity?
    • Not all dependencies in your code are a Repository: The Gateway Pattern
  • AI: Embeddings and RAG
    • What criteria to follow when comparing different embedding models
    • How to migrate between different embedding models

🔴 We're going live from TRGx today!

Today at 20:00 CEST we'll be doing a live show: 10 years in a tech coma.

Where we'll see what would have happened if a developer had missed the last 10+ years of technological advances.

We'll be doing it live from TRGx, a conference about designing, developing, and marketing digital services that was born around the hyperactive community of subscribers to La Bonilista.

If you can't be at the event, you can follow the livestream on our YouTube channel. Hit the bell so you get notified when it starts. 😊


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:

> - Knock knock > - An async function > - Who's there? 😂 😂 😂

Cheers!

SubscribeSign in