UUID STANDARD · ENVIRONMENT AWARE

IDs that know
where they live. C0FFEE1D-E3a4-4f2a-b9c7-0a8e65f21034

A simple standard for environment aware UUIDs. One glance tells you the environment and that it's valid. Never route test data to production again.

$ npm install -g cofeid
latest on npm zero dependencies TypeScript ready
Live Generator
Click Generate to create an ID →
The Problem

You've been here before.

A plain UUID like f47ac10b-58cc-4372-a567-0e02b2c3d479 tells you nothing. Is it test data? A production user? Your DB logs will mix them silently. cofeid adds a prefix that makes environment context self-documenting.

✕ WITHOUT COFEID
// Which environment is this from? SELECT * FROM orders WHERE user_id = 'f47ac10b-58cc...' // No idea. Could be: // E3 user f47a... // E1 user f47a... ← same ID! // Oops. 🔥
✓ WITH COFEID
// Environment is explicit, always SELECT * FROM orders WHERE user_id LIKE 'C0FFEE1D-E3a4-%' // ✓ Unambiguous. Self-documenting. // Works in any SQL, any log, // any dashboard. Zero guessing.
The Specification

One format. Forever readable.

The entire spec fits in a single line. No new data types. No schema migrations. Drops directly into any system that accepts a string.

C0FFEE1D - xxxxxxxx-4xxx-yxxx-xxxxxxxxxxxx
C0FFEE1D
Human-readable magic prefix. Instantly recognizable in any log, DB dump, or debug session. Also a valid hex color: #C0FFEE.
UUID v4
Standard RFC 4122 UUID v4 for the remainder. Cryptographically random. No collisions. Compatible with every UUID library in every language.
Optional Env Segment
Insert an env slug (E3, E1, E2) followed by 2 random hex chars between prefix and UUID for full environment scoping — e.g. E3a4. Rejected at parse time if invalid.
Usage

CLI-first. Library-ready.

Install globally and start generating IDs immediately. Or import the library directly into your application for programmatic generation and validation.

Terminal
$ npm install -g cofeid
# Generate a bare ID
$ cofeid
C0FFEE1D-f3a2-4d1e-b9c7-0a8e65f21034
# Scope to an environment
$ cofeid --env E3
C0FFEE1D-E3a4-4a1b-9c2d-e5f678901234
# Validate an existing ID
$ cofeid C0FFEE1D-E1b2-4b2c-ad3e-...
✓ Valid cofeid [env: E1]
# Catch mistakes at the boundary
$ cofeid f47ac10b-58cc-4372-a567-...
✕ Expected C0FFEE1D prefix. Got: f47ac10b...
In Your Stack

Works everywhere strings work.

No schema changes. No new column types. Your DB, your ORM, your logs — all of them can filter, scope, and audit by environment using standard string operations.

SQL
JavaScript
Python
grep / logs
-- Filter only production data SELECT * FROM users WHERE id LIKE 'C0FFEE1D-E3%-%'; -- Audit: anything that's not E3 is E1/E2 SELECT id, created_at FROM payments WHERE id NOT LIKE 'C0FFEE1D-E3%-%' AND environment = 'production'; -- ↑ This query should always return 0 rows.
import { generate, validate } from 'cofeid'; // Generate a production ID const userId = generate({ env: 'E3' }); // → 'C0FFEE1D-E3a4-4f2a-b9c7-0a8e65f21034' // Validate at API boundaries function getUser(id) { const result = validate(id, { env: 'E3' }); if (!result.valid) throw new Error(result.error); return db.users.find(id); }
from cofeid import generate, validate # Generate a test ID user_id = generate(env="E1") # → 'C0FFEE1D-E1b2-4a1b-9c2d-e5f678901234' # Validate in your service layer result = validate(user_id, env="E3") if not result["valid"]: raise ValueError(result["error"]) # ✕ env mismatch: expected E3, got E1
# Filter production logs only $ grep 'C0FFEE1D-E3' app.log # Find test IDs that leaked into prod logs $ grep 'C0FFEE1D-E1' /var/log/E3/app.log # ↑ Should be empty. Alert if not. # Count IDs by environment $ grep -oE 'C0FFEE1D-[A-Za-z0-9]+' app.log \ | sort | uniq -c | sort -rn
Features

Production-ready out of the box.

🔍
Instantly Scannable
Spot environment in any log, dump, or Slack message. No decoding, no lookups — just read it.
🛡️
Validated at Boundaries
Reject IDs with the wrong prefix or wrong environment before they ever touch your database.
🔗
Drop-in Compatible
It's a string. Your ORM, your DB column, your API — nothing changes. No migrations required.
Zero Dependencies
The entire package weighs in at under 5KB. No bloat, no supply chain anxiety.
🌍
Any Language
The spec is just a string format. Implement a validator in any language in under 10 lines.
🎨
#C0FFEE is a Color
The prefix is a real hex color — a light mint. Your brand, your data standard, your vibe.
<5KB bundle size
0 dependencies
10s to first ID
unique IDs possible

Start in 10 seconds.

One command. Globally available. Your IDs will never be ambiguous again.

$ npm install -g cofeid