Skip to content

feat: add uuid v4/v7 generator api endpoint#597

Open
Shadow-MMN wants to merge 2 commits into
StreamFi-x:devfrom
Shadow-MMN:feat/uuid-generator-api
Open

feat: add uuid v4/v7 generator api endpoint#597
Shadow-MMN wants to merge 2 commits into
StreamFi-x:devfrom
Shadow-MMN:feat/uuid-generator-api

Conversation

@Shadow-MMN
Copy link
Copy Markdown

@Shadow-MMN Shadow-MMN commented Apr 24, 2026

Description

Adds a new API endpoint GET /api/routes-f/uuid that generates UUIDs with support for version 4 (random) and version 7 (time-ordered).

_Closes #562

Changes proposed

What were you told to do?

feat(routes-f): uuid generator endpoint supporting v4 and v7

What did you do?

  • v4: 16 random bytes with version=4 and variant=0x80 bits set
  • v7: Timestamp in first 6 bytes (big-endian) + 10 random bytes, version=7
  • Uses native crypto.getRandomValues — no external dependencies
  • Edge runtime (export const runtime = 'edge')

Check List (Check all the applicable boxes)

🚨Please review the contribution guideline for this repository.

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

Screenshots/Videos

Implement GET /api/routes-f/uuid with support for:
- UUID v4 (random) generation using crypto.getRandomValues
- UUID v7 (time-ordered) with timestamp in first 48 bits
- Query params: version (v4|v7, default v4), count (1-100, default 1)
- Strict validation returning 400 for invalid inputs
- Edge runtime configuration

Add comprehensive Jest tests covering valid/invalid cases.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

Someone is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 24, 2026

@Shadow-MMN Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Shadow-MMN
Copy link
Copy Markdown
Author

@davedumto please can you take a look at this pr and give me your review.

@davedumto
Copy link
Copy Markdown
Contributor

Kindly fix conflicts so I can merge. Thanks for your contribution

@Shadow-MMN
Copy link
Copy Markdown
Author

@davedumto can we check it out now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants