layerc
v0.3.2
Published
Extensible config loading and merge engine for Node 20+
Readme
LayerC 🧥
Extensible configuration infrastructure for modern applications.
LayerC is a configuration engine for modern applications, emphasizing type safety, audit tracing, and developer ergonomics. It provides a unified way to load, parse, merge, edit, and validate configuration from files, environment variables, and memory.
Key Features
- Fluent API: Declarative configuration using an object-oriented builder pattern.
- Format-Preserving Editor: Edit configuration files while preserving comments and structure.
- Cross-Source Transfer: Transfer configuration values between different sources.
- Audit Tracing: Precise tracking of the origin for every configuration value.
- Type Safety: Full TypeScript with generics and Zod schema validation.
- Multi-format: Native support for JSON, YAML, TOML, and INI.
- Plugin System: Custom loaders, parsers, writers, and merge strategies.
- Watch Mode: Automatic reload on file changes.
Quick Start
import { LayerC } from 'layerc';
const config = new LayerC({ schema: AppSchema })
.addFile('config.json')
.addEnv('APP_', 'app')
.addMemory('cli-overrides', { server: { port: 3000 } });
const { data } = await config.load();
console.log(data.server.port); // 3000Documentation
| Guide | Description | |-------|-------------| | 📖 Documentation Index | Start here | | 🚀 Getting Started | Installation & quick start | | 📚 API Reference | Full API documentation | | 🏗️ Architecture | Core design & pipeline | | 🎨 Design Principles | SICP-inspired philosophy | | 🔌 Plugin System | Custom loaders & parsers | | 👀 Watch Mode | File watching & subscriptions | | 🤝 Contributing | Development guide | | 🗺️ Roadmap | Future plans |
Packages
This monorepo contains:
| Package | Description |
|---------|-------------|
| @layerc/core | Core configuration engine |
| @layerc/cli | CLI tool & TUI editor |
| @layerc/web | Web Studio (HTTP server) |
| layerc | Umbrella package (all-in-one) |
Development
bun install # Install dependencies
bun run build # Build all packages
bun run typecheck # TypeScript type checking
bun run test # Run all testsLicense
MIT
