๐ฑ Simple foundation library
npm install zeedA zero-dependency TypeScript utility library for universal JavaScript



Documentation โข GitHub โข Codeberg
---
> [!CAUTION]
> The main repository is now at
$3Strict TypeScript with full type inference $3Lightweight and completely tree-shakable $3Works in browsers, Node.js, Deno, and Bun | $3ES Modules with CommonJS fallback $3Comprehensive test coverage $3Compatible with tRPC, TanStack, Hono & more |
``sh`
npm install zeedor
pnpm add zeedor
yarn add zeed
---
Powerful, filterable logging for browser and terminal with colorful output and stack traces.
`ts
import { Logger } from 'zeed'
const log = Logger('demo')
log('Hello World')
log.info('Info')
log.warn('Warning')
log.error('Error')
`
Terminal output:

Browser output:

๐ Learn more about logging features
Filtering:
By default, logs are muted. Enable them with filters:
Browser:
`ts`
localStorage.zeed = '*'
Node.js:
`sh`
ZEED=* node myapp.js
You can use advanced filters compatible with debug syntax. Use ZEED or DEBUG environment variables (ZEED supersedes DEBUG).
Filter by level: ZEED_LEVEL=info to hide debug logs.
Write to file: ZEED_LOG=/path/to/file.log
Log Handlers:
- LoggerConsoleHandler(opt) - Plain console outputLoggerBrowserHandler(opt)
- - Colorful browser logsLoggerNodeHandler(opt)
- - Colorful Node.js logsLoggerFileHandler(path, opt)
- - File output with optional rotation
Log Rotation Example:
`ts
import { LoggerFileHandler } from 'zeed'
LoggerFileHandler('/var/log/app.log', {
rotation: {
size: '10M',
maxFiles: 5,
compress: 'gzip'
}
})
`
---
Powerful utilities for working with async operations:
`ts
// Wait for an event
await waitOn(emitter, 'action', 1000)
// Sleep for milliseconds
await sleep(1000)
// Timeout a promise
await timeout(asyncFn, 1000)
// Ensure a value is a Promise
await promisify(returnValue)
`
---
Multiple ID generation strategies for different use cases:
`ts
// UUID (Base62, 22 chars) - cryptographically secure
const id = uuid()
// Sortable UID with timestamp
const sortable = suid()
suidDate(sortable) // Extract timestamp
// Named incremental IDs (great for debugging)
uname('user') // => 'user-0'
uname('user') // => 'user-1'
// Classic UUID v4
const classic = uuidv4() // => 'a7755f8d-ef6f-45e9-8db3-d29347a4a2a1'
`
Available ID types: uuid, uuidB32, suid, quid, uuidv4
---
Type-safe, async event emitter with full TypeScript support:
`ts
interface MyEvents {
inc: (count: number) => number
}
const e = new Emitter
e.on('inc', async count => counter + 1)
await e.emit('inc', 1)
// Or use the .call proxy
await e.call.inc(1)
`
Global emitter for cross-module communication:
`ts
declare global {
interface ZeedGlobalEmitter {
test: (x: string) => void
}
}
getGlobalEmitter().call.test('Hello World')
`
---
Type-safe messaging infrastructure for client-server communication:
`ts`
const m = useMessageHub({ channel }).send
m.echo({ hello: 'world' })
> ๐ Full messaging documentation
---
๐ฏ Type-safe โข ๐ Standard Schema Compatible โข ๐ Zero Dependencies
Powerful schema validation with full TypeScript inference and Standard Schema support:
`ts
import { z } from 'zeed'
// Define and validate schemas
const userSchema = z.object({
name: z.string(),
email: z.string(),
age: z.number().optional(),
role: z.stringLiterals(['admin', 'user', 'guest']),
})
// Full type inference
type User = z.infer
// Parse and validate
const user = schemaParseObject(userSchema, data)
`
๐ Standard Schema Compatibility
Compatible with tRPC, TanStack Form/Router, Hono, and 40+ other libraries:
`ts
// Use with any standard-schema-compatible library
const schema = z.object({
name: z.string(),
count: z.number(),
})
const result = schema['~standard'].validate({ name: 'test', count: 42 })
if (result.issues) {
console.error('Validation failed:', result.issues)
}
else {
console.log('Valid data:', result.value)
}
`
Features:
- Primitives: string(), number(), int(), boolean(), any()object()
- Objects: , record(), pick(), omit(), extend(), partial(), required()array()
- Arrays & Tuples: , tuple()union()
- Unions & Literals: , literal(), stringLiterals().optional()
- Modifiers: , .default(), .describe()
> ๐ Complete schema documentation
---
๐ CRDT Sorting ๐ Binary Encoding | ๐ Deep Object Utils ๐งน Resource Disposal |
---
Zeed includes many more utilities - explore the full API documentation!
By the same author:
- zeed-dom - DOM manipulation utilities
- zerva - Modular server framework
Similar utility libraries:
- lib0 - Fundamental utility functions
- antfu/utils - Collection of common utilities
- vueuse - Vue composition utilities
- unjs - Unified JavaScript tools
MIT
---
Built with โค๏ธ by Dirk Holtwick
โญ Star on GitHub โข ๐ Documentation โข ๐ Report Issue