PostgreSQL sequence · Sqids encoding · zero retries

Short links that can't collide.

Snipx pulls the next integer from an atomic PostgreSQL sequence and encodes it through a bijective function. Every code maps to exactly one ID. No hashing, no lookups, no retry loops.

Step 1

PostgreSQL sequence

nextval('url_id_seq')
-> 7_481_209
Step 2

Sqids encode

sqids.encode([7481209])
-> "XbNkM3"
Result

Short URL

snipx.sbs/XbNkM3
unique · non-enumerable · reversible

the sequence is atomic at the database engine level. Sqids is a bijective function. Different integers never produce the same code.

Collision-free, by construction.

Most shorteners generate a random code, check if it exists, and retry on conflict. That works until you have enough links that collisions become frequent. Snipx skips the guessing entirely.

01

Why random codes break

With 6-character Base62 codes, you get ~56 billion possibilities. Sounds like plenty. But the Birthday Problem means collisions appear far sooner than intuition suggests: at just 100 million URLs, 83% of new codes will collide on the first try.

1M urls
<0.01%
50M
~24%
100M
~83%
02

Atomic database counter

Every short link starts with a call to nextval('url_id_seq'). PostgreSQL guarantees that even under thousands of concurrent connections, each call returns a different number. No application-level locks. No optimistic concurrency. Just an integer that only goes up.

nextval → 7_481_207
nextval → 7_481_208
nextval → 7_481_209
atomic · monotonic · zero contention
03

Bijective encoding

The raw integer is encoded through Sqids with a secret shuffled alphabet. The function is one-to-one: every integer maps to exactly one code, and every code maps back to exactly one integer. Uniqueness upstream guarantees uniqueness downstream. Codes are non-sequential and non-guessable.

7_481_207→kR9xJm
7_481_208→Qn4vBz
7_481_209→XbNkM3
one-to-one · non-enumerable · O(1) decode

Zero collision checks

Because the sequence only increments and Sqids is one-to-one, the INSERT can run without any prior SELECT to check for duplicates. There is no retry loop. The database schema does not even need a UNIQUE constraint on the short code for correctness (though one exists as a defensive measure).

Non-enumerable output

Sequential integers are predictable. If you know 42 exists, you know 43 probably does too. The Sqids encoding uses a secret shuffled alphabet that makes adjacent IDs produce unrelated codes. Knowing one valid code tells you nothing about the next.

56B
possible 6-char codes
0
collision checks per request
O(1)
generation time, always
1
sequence call per URL
telemetry inspector · live click counts

Every redirect writes to the ledger.

When a visitor resolves a short link, Snipx increments the click counter in atomic storage. Log in to monitor resolution counts, manage link lifecycles, and inspect your full portfolio.

telemetry stream active
Total Direct Resolutions
+ in the past 24 hours
Increment latency:0.2ms
Collision check:0ms (none needed)
24h Resolution DistributionUTC timeline
00:0006:0012:0018:0023:00
Peak resolution window: 15:00 UTC at 158 clicks/hr
Short URL
snipx.sbs/XbNkM3
Target Destination
docs.snipx.io/api/v1/spec
Registered
Sep 3, 2026
Atomic SQLite / PG counter
Sign in to monitor click telemetry and manage your shortened links.
developer API · REST endpoint

One POST. One short link.

Send a long URL, receive the encoded shortcode immediately. Optional Bearer auth links the record to your account for deletion and telemetry tracking.

curl-XPOSThttps://api.snipx.io/v1/urls\
-H"Content-Type: application/json"\
-d'{"originalUrl":"https://example.com/very/long/path"}'
POST /api/v1/urlsContent-Type: application/json

The short code is generated at the moment of creation from the sequence. No pre-allocation and no post-validation. The response is final.

Questions

How does Snipx guarantee zero collisions?

Two properties combine. First, a PostgreSQL sequence hands out monotonically increasing integers. Each call to nextval() is atomic at the database engine level, so no two connections ever receive the same number. Second, Sqids is a bijective (one-to-one) function: different integers always produce different strings. If the inputs are unique, the outputs are unique. There is no randomness anywhere in the pipeline and no uniqueness check before the INSERT.

Can someone guess valid short codes?

Not practically. The Sqids encoding uses a secret shuffled alphabet that acts as an encryption key. Consecutive sequence numbers produce codes that appear completely unrelated. Knowing "XbNkM3" tells you nothing about which code came before or after it. The encoding is reversible, but only if you know the full 62-character alphabet.

What analytics does Snipx track?

Currently, Snipx tracks an aggregate click count per link. Every time a short code is resolved, the counter on that URL record gets incremented. You can view your click counts, creation dates, and destination URLs through the dashboard. Per-click event data (referrer, device, geography) is on the roadmap but not yet shipped.

Can I use Snipx without creating an account?

Yes. The URL creation endpoint accepts requests without authentication. If you include an auth token, the link gets tied to your account, so you can list, manage, and delete it later. Without a token, the link is still created and works for redirection, but it is not associated with any user.

Give your links a code they'll never have to share.