{"id":34623682,"url":"https://github.com/block/uuidv7","last_synced_at":"2026-05-27T17:31:20.035Z","repository":{"id":318949776,"uuid":"1076244834","full_name":"block/uuidv7","owner":"block","description":"A Minimal UUID v7 Implementation","archived":false,"fork":false,"pushed_at":"2026-03-12T21:12:07.000Z","size":213,"stargazers_count":15,"open_issues_count":4,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-15T03:38:19.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/block.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-10-14T15:39:07.000Z","updated_at":"2026-05-14T11:25:06.000Z","dependencies_parsed_at":"2025-10-17T11:05:08.106Z","dependency_job_id":"29d2d99f-a12a-432d-9646-7d668eeaf5d3","html_url":"https://github.com/block/uuidv7","commit_stats":null,"previous_names":["block/vee-seven"],"tags_count":4,"template":false,"template_full_name":"block/oss-project-template","purl":"pkg:github/block/uuidv7","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fuuidv7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fuuidv7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fuuidv7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fuuidv7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/block","download_url":"https://codeload.github.com/block/uuidv7/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fuuidv7/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33384550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T04:15:53.637Z","status":"ssl_error","status_checked_at":"2026-05-23T04:15:53.242Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T15:43:09.708Z","updated_at":"2026-05-27T17:31:20.026Z","avatar_url":"https://github.com/block.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UUIDv7\n\nHigh-performance UUID v7 implementations across multiple languages.\n\n## Introduction\n\n[UUID v7](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7) is a time-ordered UUID format that encodes a Unix timestamp in the most significant 48 bits, making UUIDs naturally sortable by creation time. This is useful for:\n\n- Database indexed fields that benefit from sequential ordering\n- Distributed systems where time-based ordering is valuable\n- Event logs and audit trails where chronological sorting is important\n\nThis repository provides minimal, high-performance implementations across multiple languages that integrate seamlessly with each language's standard UUID type.\n\n### Compact Base62 Format\n\n**Recommended for APIs, databases, and anywhere IDs are stored or transmitted as text.**\n\nAll implementations provide 22-character Base62 compact strings using `0-9A-Za-z` that are:\n- **39% shorter** than standard UUID strings (22 vs 36 characters)\n- **Lexicographically sortable** - preserves time-based ordering\n- **URL-safe** - no special characters, hyphens, or encoding needed\n- **Database-friendly** - shorter indexed strings, better performance\n\n**Example**: `01JDQYZ9M6K7TCJK2F3W8N` (compact) vs `01936c0a-5e0c-7b3a-8f9d-2e1c4a6b8d0f` (standard)\n\nUse compact strings for wire formats, database text fields, URLs, and API responses.\n\n## Language Implementations\n\n| Language | Status | Directory | Package |\n|----------|--------|-----------|---------|\n| **Java** | ✅ Stable | [java/](java/) | `xyz.block:uuidv7` |\n| **JavaScript** | ✅ Stable | [javascript/](javascript/) | `@block/uuidv7` |\n| **Swift** | ✅ Stable | [swift/](swift/) | `uuidv7` |\n| **Go** | ✅ Stable | [go/](go/) | `github.com/block/uuidv7/go` |\n| **Ruby** | ✅ Stable | [ruby/](ruby/) | `uuidv7` |\n| **Rust** | ✅ Stable | [rust/](rust/) | `block-uuidv7` |\n\n## Design Principles\n\nAll implementations follow these core principles:\n\n**Minimal API Surface**: Utility functions that work with the language's standard UUID type rather than introducing a new type. Maximum compatibility with existing code.\n\n**Separate Implementations for Different Use Cases**: Two distinct variants for different performance/ordering trade-offs:\n- **Standard**: Maximum performance with zero synchronization overhead. UUIDs generated in the same millisecond may not be strictly ordered, but uniqueness is maintained through random bits.\n- **Monotonic**: Uses a synchronized counter to ensure strict ordering within the same millisecond, following RFC 9562 recommendations. Best for database primary keys and scenarios requiring guaranteed sequential ordering.\n\n**Timestamp Extraction**: UUIDs contain timing information, and implementations make it easy to extract this for debugging, observability, and time-based queries.\n\n**Compact String Representation**: All implementations provide methods to generate and parse 22-character Base62 compact strings directly. Recommended for wire formats, database text fields, URLs, and API responses. The compact format is lexicographically sortable and preserves the time-ordering of UUID v7.\n\n## Format\n\nUUID v7 follows RFC 9562:\n- **Bits 0-47**: Unix timestamp in milliseconds (48 bits)\n- **Bits 48-51**: Version field (0111 for v7)\n- **Bits 52-63**: Counter or random bits (12 bits, called `rand_a`)\n  - **Monotonic mode**: Sequential counter for strict ordering within the same millisecond\n  - **Standard mode**: Random bits for maximum performance\n- **Bits 64-65**: Variant field (10 for RFC 4122)\n- **Bits 66-127**: Random bits (62 bits, called `rand_b`)\n\n## Quick Start\n\nSee the README in each language directory for installation and usage:\n\n- **Java**: [java/README.md](java/README.md)\n- **JavaScript**: [javascript/README.md](javascript/README.md)\n- **Swift**: [swift/README.md](swift/README.md)\n- **Go**: [go/README.md](go/README.md)\n- **Ruby**: [ruby/README.md](ruby/README.md)\n- **Rust**: [rust/README.md](rust/README.md)\n\n## Project Resources\n\n| Resource                                   | Description                                                                    |\n| ------------------------------------------ | ------------------------------------------------------------------------------ |\n| [CODEOWNERS](./CODEOWNERS)                 | Outlines the project lead(s)                                                   |\n| [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) | Expected behavior for project contributors, promoting a welcoming environment |\n| [CONTRIBUTING.md](./CONTRIBUTING.md)       | Developer guide to build, test, run, access CI, chat, discuss, file issues     |\n| [GOVERNANCE.md](./GOVERNANCE.md)           | Project governance                                                             |\n| [LICENSE](./LICENSE)                       | Apache License, Version 2.0                                                    |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblock%2Fuuidv7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblock%2Fuuidv7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblock%2Fuuidv7/lists"}