π¦₯ Sloth
Sloth is a modular Deno library designed to be lightweight, flexible, and adaptable for any environment: π REST APIs, π οΈ low-level utilities, βοΈ KV management, π middlewares, and much more.
π Why Sloth?
β
Pick only what you need β no bulky global mod.ts entry.
β
Environment- and feature-organized β clean separation by platform (deno, node) and domain (kv, utils, rest, β¦).
β
Strict TypeScript β full typings, safe autocompletion, fewer runtime surprises.
β
Minimal by design β no unnecessary bloat, no hidden dependencies.
π¦ Installation
Sloth does not expose a global mod.ts.
Instead, import only the modules you want:
ποΈ Project Structure
| Folder | Purpose |
|---|---|
src/deno |
Deno-specific modules (KV, .env helpers, system tools) |
src/utils |
Pure utilities (merge, clone, type helpers) |
src/apps |
Reusable app stacks (REST, WebSocket, CLI scaffolds) |
tests/ |
Full test suite, unit + integration |
(no mod.ts) |
Modules are standalone, import them individually |
π§ Code Examples
β Typed Deno KV slot
import { KvSlot } from 'https://deno.land/x/sloth@<version>/src/deno/kv/slot.class.ts'
import { z } from 'https://deno.land/x/zod/mod.ts'
const userSlot = new KvSlot('users', z.object({
id: z.string(),
name: z.string()
}))
await userSlot.set(['123'], { id: '123', name: 'Alice' })
const user = await userSlot.get(['123'])
console.log(user)β Deep merging objects
import { deepMerge } from 'https://deno.land/x/sloth@<version>/src/utils/deep-merge.ts'
const base = { a: 1, b: { c: 2 } }
const extra = { b: { d: 3 } }
const result = deepMerge(base, extra)
console.log(result) // { a: 1, b: { c: 2, d: 3 } }π§© Available Modules
| Module | Description |
|---|---|
src/deno/env |
.env file reading, environment tools |
src/deno/kv |
Typed abstraction over Deno KV |
src/utils/deep-merge.ts |
Deep object merge utility |
src/apps/rest (optional) |
Modular REST stack, domain-driven |
| (more coming soon) | Active micro-module development |
π Documentation
Full per-module documentation is hosted externally:
π Read the docs
Each module includes: β Public API β Practical examples β Real-world use cases
π Contributing
We welcome contributions! Please follow these simple rules:
β Use strict TypeScript typing. β Keep modules self-contained (one module = one file or folder). β Follow emoji-annotated commits (we use the π emoji-commit convention). β Provide examples + tests for every new feature.
Submit PRs, bug reports, or feature requests anytime!
πΊοΈ Roadmap
β Initial release π Publish on Deno Land with semantic versioning π Expand micro-module library π Strengthen test coverage + CI pipelines
π License
MIT