zitadel / zitadel

ZITADEL - Identity infrastructure, simplified for you.
https://zitadel.com
Apache License 2.0
8.61k stars 544 forks source link

[Proposal] Integrate an additional ID Generator in Zitadel (ie. UUID-based) #8305

Open borisroman opened 3 months ago

borisroman commented 3 months ago

Preflight Checklist

Describe your problem

Introduction

Zitadel, an open-source authentication and authorization platform, currently employs an ID generation interface with a single implementation based on Sonyflake . While Sonyflake offers several advantages in terms of distributed ID generation, we propose adding a second ID generator based on UUIDv7 to enhance integration capabilities into systems which are fully UUID-based.

Current ID Generation: Sonyflake

Sonyflake is a distributed unique ID generator inspired by Twitter's Snowflake. It focuses on lifetime and performance in environments with multiple hosts and cores.

Proposal

We would like to integrate another ID generator into Zitadel to enhance the platform's flexibility and integration capabilities. While Sonyflake's robust multi-machine support and extended ID lifetime are advantageous, many of our implementations do not require such extensive distribution. UUIDv7's time-sortable and globally unique IDs offer performant database indexing, precise timestamping, and simplified operations without the need for translation tables. This addition will cater to a broader range of use cases.

Why?

Open for Discussion

We propose the integration of UUIDv7 as an additional ID generator in Zitadel to enhance flexibility and meet diverse needs. This proposal is open for discussion, and we invite feedback and suggestions from the community to ensure the best possible outcome.

Thank you for considering this proposal. We look forward to your input.

Describe your ideal solution

As a developer I would like to have a UUID-based ids for resources.

Version

2.56.0

Environment

Self-hosted

Additional Context

No response

stebenz commented 2 weeks ago

Technically it would be easy to replace the sonyflake id generator with any desired generator as long as it covers the interface.

type Generator interface {
    Next() (string, error)
}

I will move this to the Backlog as if there is interest in it people can react on the issue. Contributions are welcome as well, not quite sure if it's a good first issue, but should not be that much work to implement.

borisroman commented 1 week ago

@stebenz Thanks for the comment!

I've provided an implementation in #8306. However, before I rebase and adjust that PR, #8693 needs to be merged first.