Pkl (by Apple) is a configuration language — write type-safe configs and generate JSON, YAML, XML, or any format.
What You Get for Free
- Type safety — catch config errors at build time
- Validation — constraints on values (ranges, patterns)
- Modules — reusable config templates
- Multi-format output — generate JSON, YAML, plist, properties
- IDE support — IntelliJ and VS Code extensions
- Packages — share config schemas as packages
- Templating — inheritance, composition, overrides
- CLI — evaluate, test, format Pkl files
Quick Start
brew install pkl
// server.pkl
host: String = "localhost"
port: Int(isBetween(1, 65535)) = 8080
database {
url: String = "postgres://localhost/mydb"
maxConnections: Int(isPositive) = 10
}
pkl eval server.pkl -f json
# {"host":"localhost","port":8080,"database":{"url":"postgres://localhost/mydb","maxConnections":10}}
pkl eval server.pkl -f yaml
# host: localhost
# port: 8080
# database:
# url: postgres://localhost/mydb
# maxConnections: 10
Why Developers Switch from Raw YAML
YAML has no types, no validation, and indentation bugs:
-
Type-safe —
port: Intcatchesport: "8080"at build time -
Validation —
isBetween(1, 65535)rejects port 70000 - Multi-format — one source, generate JSON, YAML, XML
- IDE support — autocomplete, error highlighting
A team deployed to production with
maxConnections: "10"(string, not int) in YAML — caused a 3-hour outage. After Pkl: type system would have caught it at build time.
Need Custom Data Solutions?
I build production-grade scrapers and data pipelines for startups, agencies, and research teams.
Browse 88+ ready-made scrapers on Apify → — Reddit, HN, LinkedIn, Google, Amazon, and more.
Custom project? Email me: spinov001@gmail.com — fast turnaround, fair pricing.
Top comments (0)