Skip to content

Welcome to Vielzeug

Vielzeug (German for "many tools") is a collection of lightweight, framework-agnostic TypeScript utilities for modern web development. Each package is designed to solve one problem exceptionally well, with minimal dependencies and maximum type safety.

The Vielzeug Ecosystem

🔧 Core & Utilities

Perfect starting point for any project:

PackageDescriptionSize
Toolkit100+ essential utilities for arrays, objects, strings, async operations, and moreTree-shakeable
LogitBeautiful console logging with colors, timestamps, and log levels1.8 KB

💾 Data & State

Client-side data management made simple:

PackageDescriptionSize
DepositType-safe IndexedDB & LocalStorage wrapper with schemas, TTL, and migrations3.4 KB
FetchitModern HTTP client with smart caching, deduplication, and query management3.0 KB
StateitTiny reactive state management with subscriptions and async support0.9 KB

🎨 Frontend & Forms

Build better user interfaces:

PackageDescriptionSize
CraftitWeb Components framework with reactive state and DOM reconciliation3.4 KB
FormitForm state management with validation, dirty tracking, and file uploads2.4 KB
ValiditSchema validation with async support and detailed error messages2.4 KB
i18nitInternationalization with pluralization and locale-aware formatting1.6 KB

🏗️ Architecture & Security

Structure your application properly:

PackageDescriptionSize
PermitRole-Based Access Control (RBAC) with dynamic rules and wildcards1.0 KB
RouteitClient-side routing with middleware, nested routes, and type-safe params2.1 KB
WireitDependency injection container with async support and scoped instances1.4 KB

Quick Start

Installation

Each package can be installed independently:

sh
pnpm add @vielzeug/toolkit
sh
npm install @vielzeug/toolkit
sh
yarn add @vielzeug/toolkit

Your First Lines

typescript
import { debounce, groupBy } from '@vielzeug/toolkit';
import { createStore } from '@vielzeug/stateit';
import { createHttpClient } from '@vielzeug/fetchit';

// Debounce search input
const search = debounce((query: string) => {
  console.log('Searching for:', query);
}, 300);

// Reactive state management
const store = createStore({ count: 0 });
store.subscribe((state) => console.log(state.count));
store.set((s) => ({ count: s.count + 1 }));

// HTTP client with caching
const http = createHttpClient({ baseUrl: '/api' });
const users = await http.get('/users');

Common Use Cases

Building a Form

typescript
import { createForm } from '@vielzeug/formit';
import { v } from '@vielzeug/validit';

const userSchema = v.object({
  email: v.string().email(),
  age: v.number().min(18),
});

const form = createForm({
  fields: {
    email: { value: '', validators: (v) => userSchema.shape.email.parse(v) },
    age: { value: 0, validators: (v) => userSchema.shape.age.parse(v) },
  },
});

await form.submit(async (data) => {
  await fetch('/api/users', { method: 'POST', body: data });
});

Fetching & Caching Data

typescript
import { createHttpClient, createQueryClient } from '@vielzeug/fetchit';

const http = createHttpClient({ baseUrl: '/api' });
const queryClient = createQueryClient({ staleTime: 5000 });

// Cached and deduplicated
const user = await queryClient.fetch({
  queryKey: ['user', userId],
  queryFn: () => http.get(`/users/${userId}`),
});

// Invalidate cache when data changes
queryClient.invalidate(['user']);

Permission Management

typescript
import { createPermit } from '@vielzeug/permit';

const permit = createPermit();

permit.register('admin', 'posts', ['create', 'update', 'delete']);
permit.register('user', 'posts', ['create']);

const canDelete = permit.can(currentUser, 'posts', 'delete');

Reactive State

typescript
import { createStore } from '@vielzeug/stateit';

const store = createStore({ todos: [], filter: 'all' });

// Subscribe to specific values
store.subscribe(
  (state) => state.filter,
  (filter) => console.log('Filter changed:', filter),
);

// Update state
store.set((state) => ({
  todos: [...state.todos, { id: 1, text: 'Learn Vielzeug' }],
}));

Design Philosophy

1. Simple Over Clever

We prefer straightforward, readable code over clever abstractions. If you can understand what's happening at a glance, we've done our job.

2. TypeScript First

Every package is built with TypeScript from the ground up. Type inference works out of the box, and you get autocomplete everywhere.

3. Zero/Minimal Dependencies

Most packages have 0-1 dependencies. This means:

  • Smaller bundle sizes
  • Fewer security vulnerabilities
  • Less supply chain risk
  • Faster installs

4. Framework Agnostic

Use Vielzeug with any framework (or no framework):

  • ✅ React
  • ✅ Vue
  • ✅ Svelte
  • ✅ Angular
  • ✅ Vanilla JS/TS

5. Production Ready

All packages are:

  • ✅ Battle-tested in production
  • ✅ Fully tested (>95% coverage)
  • ✅ Actively maintained
  • ✅ Semantically versioned

Package Comparison

How does Vielzeug stack up?

FeatureVielzeugLodashZod + RHF + TanStackNative
Bundle Size0.1-1 KB per package24 KB (full)40+ KB combined0 KB
TypeScriptNative, first-classVia @typesGoodManual
Dependencies0-1 per package0ManyN/A
Tree-shakeableYes, by defaultlodash-es onlyVariesN/A
FrameworkAgnosticAgnosticReact-focusedAgnostic
Learning CurveLowLowMedium-HighLow

Getting Help

What's Next?

  1. Explore packages: Browse the navigation to find packages that solve your problems
  2. Try examples: Each package has real-world examples
  3. Check the REPL: Test packages in your browser without setup
  4. Start building: Install what you need and start coding

Ready to dive in? Start with Toolkit for general utilities, or pick a specific package for your current needs! 🚀