English | 한국어
Shape your data once. Let the generator, not people and not AI, keep every language in line.
One schema → types and serializers for TypeScript, JavaScript, Python, C#, C++, Rust, and Go.
However many languages, whoever writes the code: one set of bytes.
Up to 21× faster than protobuf-compatible | up to 37× faster than JSON
7 languages × 6 formats cross-checked | zero runtime dependencies
- The more code AI writes, the more drift piles up at language and service boundaries
- Agents guess field names and types from memory →
Idforid,"1"for1 - That drift compiles. It breaks after release, in another language
- DeukPack gives the agent a contract, not a guess. The schema file is the answer key
- The agent's job: edit the schema, run
deukpack gen, write logic on the generated types. Done - AI never rewrites serializers or byte compatibility → the generator makes them the same every time
- A wrong field = a compile error. Runtime incidents move to build time
npm i deukpackregisters the DeukPack skill. Claude Code, Codex and Gemini CLI know how to use it
| Study | Finding | Where DeukPack fits |
|---|---|---|
| Mündler et al., PLDI 2025 | 94% of LLM compile errors are failed type checks | types come from the schema; nothing to guess |
| 〃 | Type constraints alone cut compile errors by over half | generated types constrain the agent |
| Zhang et al., ISSTA 2025 | Real-world code hallucinations: API, project context | the schema file is the answer key |
| Spracklen et al., USENIX Sec 2025 | 5.2% to 21.7% of AI-suggested packages do not exist | runtime ships inside; nothing to install |
| JSONSchemaBench, 2025 | Schema-constrained output: faster, better quality | schema-first is where the field is going |
- Major LLM APIs take JSON Schema for structured output → the schema becomes the contract for AI output
- Agent Skills: the standard for teaching agents a tool → DeukPack ships its skill; agents just run the CLI
- The shift: from "write better prompts" to "give the agent a contract"
| Debt that comes later | With DeukPack |
|---|---|
| Speed: JSON first, binary rewrite when traffic grows | Format = one argument. 'dpjson' → 'dppack', same calls |
| Languages: hand-port for every new client | one more --lang |
| Drift: hand-synced DTOs slowly diverge | edit schema + regenerate is the only path |
| Dependencies: serializer versions per language | runtime ships inside the output |
| AI code: agent-written serializers pile up | serializers belong to the generator |
| Lock-in: remove the tool, everything breaks | output is plain source; it still builds |
- C++ server, C# client, Python tools, TS web → four copies of the same
Hero - One new field = four edits. Miss one and it breaks at runtime, after release
- Each language brings its own serializer → integer widths, empty values, missing fields differ
- One schema is the source of truth. Code in each language is its shadow
- People and AI write logic. The generator writes types and bytes
- Same schema → same code, same bytes. Every run
- Output is plain source. Delete DeukPack and the project still builds
| Legacy system | AI-native project | |
|---|---|---|
| Start from | your .proto .thrift as they are |
your types as they are; .deuk optional |
| Existing peers | protobuf, Thrift bytes stay compatible | dppack at full speed |
| Adopt by | one message, one service at a time | agent edits schema → regenerate |
| Existing code | --no-serializer: swap in objects only |
generated types are the contract |
| You get | new languages, faster formats, no rewrite | no guessed types, reproducible output |
- Python serializes the pydantic models you already have (
python.models) - Generated code carries its runtime → no extra package, no versions to keep in step
- AI-native needs no
.deukeither: start from.proto, ordeukpack schemaon TS types, JSON Schema, pydantic .deukonly for extras: inheritance, required and defaults, small ints, sets..deukextras
dppackvs protobuf-compatible: pack ×3.3 to ×21, unpack ×3.2 to ×14 fasterdppackvs JSON: pack ×4.8 to ×37, unpack ×9.8 to ×26 faster- Size: a large tree record is 7,038 bytes as JSON, 2,780 as
dppack - Harness per language: tinybench, pyperf, Google Benchmark, BenchmarkDotNet, criterion
- Full tables: Performance
- Both directions against official implementations: Apache Thrift, protobufjs,
JSON.parse,csv-parse - Across seven languages: bytes from one language read by the other six and compared
- 42 directions, across supported formats; only passing cells get ✅. Support matrix
| Used to break | DeukPack |
|---|---|
| Types written per language | all generated from one schema |
| Missing fields, empty values | required optional in the schema |
| Integer width, sign | schema width; Python range-checks |
| Serializer library versions | runtime ships inside the output |
| Adding a language | one more --lang |
- Packets between a game server and its clients (Unity C#, web TS)
- Messages between services in different languages (queues, RPC, sockets)
- Save files, caches, logs: data kept as bytes
- DTOs that frontend and backend used to sync by hand
Made by deuklab. Homepage and manual: deuklab.com/deukpack. npm: deukpack.
npm i -D deukpack # per project (global CLI: npm i -g deukpack)
npx deukpack gen hero.deuk --lang typescript --out generatedhero.deuk:
namespace Dto
record Hero {
1> required int32 id
2> required string name
3> optional float hp
}
main.ts:
import { Hero } from './generated/dto'; // file = namespace (Dto → dto)
import { HeroCodec } from './generated/dto.codec';
const hero = new Hero();
hero.id = 1;
hero.name = 'Deuki';
const bytes = HeroCodec.pack(hero, 'dppack'); // Uint8Array
const back = HeroCodec.unpack(bytes, 'dppack'); // HeroPython: npx deukpack gen hero.deuk --lang python --out generated (pip install "pydantic>=2")
from generated.dto import Hero
from generated.dto_codec import HeroCodec
hero = Hero(id=1, name="Deuki")
data = HeroCodec.pack(hero, "dppack") # bytes
back = HeroCodec.unpack(data, "dppack") # HeroOther languages:
-
AI agent skill: installed with the package for Claude Code, Codex and Gemini CLI. AI agents
-
Node.js 18 or later, for the CLI only
-
generated/= objects, codecs and their runtime. The app installs nothing else -
Calls per language: Using the generated code
npm i -D deukpack@latest # per project (global: npm i -g deukpack@latest)
npx deukpack --version
npx deukpack gen # regenerate: deukpack.json, or the same gen arguments as before- Regenerate after every update. Generated runtime = the version that wrote it
- Commit the regenerated folder together with the version bump
- Releases and changes: GitHub releases
- Input IDL:
.deuk·.proto·.thrift - Output languages: C# · Python · JavaScript · TypeScript · C++
- Output languages: Rust · Go (byte slices)
- Formats: DeukPack native (
dppack) · protobuf-compatible (xpb) · Thrift-compatible (xtbinaryxtcompact) · JSON (dpjson) · CSV (dpcsv) - I/O: bytes · stream · file
- Source of truth: docs/public/architecture/TARGET_SCOPE.md
Only cells whose gate (npm run verify) passes are listed. An empty cell means unsupported.
| Format | TypeScript | JavaScript | Python | C++ | C# | Rust | Go |
|---|---|---|---|---|---|---|---|
dppack |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xpb |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xtbinary |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xtcompact |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
dpjson |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
dpcsv |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Go reads and writes all six formats. Cross-language checks use each format where the schema supports it.
- Go covers byte slices; the other six languages cover bytes, streams and files.
xpbalone carries one record per input and applies to records proto3 can express - Check 1, against official implementations in both directions: Apache Thrift, protobufjs,
JSON.parse,csv-parse, and a dppack decoder written separately from the spec - Check 2, across languages: one language packs, the other six unpack and compare (42 directions, across supported formats)
- Input schemas: fixtures, their proto and thrift conversions, and seed-generated schemas
- Platforms observed: Windows x64 (C++ on MSVC), Linux x64 (C++ on GCC). Clang and macOS are not observed
- Rust: observed on Windows x64 and Linux x64 (cargo 1.75 on the linux build agent)
- Measured performance: docs/public/BENCHMARK.md
Windows x64, i7-13700K, one worker. After 100,000 warm-up round trips, each language ran five batches of 100,000 for Point(x = −1, y = 256), checking both fields every time. Times are per batch; throughput uses the median batch.
| Language | Min ms | Median ms | Max ms | Round trips/s | Errors / attempts |
|---|---|---|---|---|---|
| TypeScript | 4.171 | 4.186 | 6.304 | 23,891,437 | 0 / 500,000 |
| JavaScript | 4.521 | 4.715 | 7.147 | 21,207,558 | 0 / 500,000 |
| Python | 327.320 | 331.455 | 335.042 | 301,700 | 0 / 500,000 |
| C++ | 4.497 | 4.548 | 4.630 | 21,985,270 | 0 / 500,000 |
| C# | 6.051 | 6.290 | 7.913 | 15,897,746 | 0 / 500,000 |
| Rust | 3.051 | 3.068 | 3.149 | 32,597,712 | 0 / 500,000 |
| Go | 3.566 | 4.099 | 5.112 | 24,396,194 | 0 / 500,000 |
Compatibility codec throughput by language (same wire format) · Six-language measurements against native dppack and official libraries · Compatibility throughput with dppack = 100
Run npm run bench:go:compare for the Go codecs and official libraries. The Go performance table and samples include the 3.2.0 compatibility codecs.
Same two int32 values. Paired metrics are pack / unpack, measured in separate Go benchmarks. Protobuf, Thrift and JSON are comparison implementations. These timings measure the 3.1.1 dppack codec.
| Go implementation | Wire bytes | Round trips/s | ns/op | Allocated B/op | Allocs/op |
|---|---|---|---|---|---|
| dppack | 17 | 24,396,194 | 27.52 / 19.91 | 32 / 8 | 2 / 1 |
| JSON | 16 | 2,372,704 | 149.1 / 232.6 | 32 / 8 | 3 / 1 |
| protobuf | 14 | 6,052,902 | 106.2 / 115.2 | 104 / 88 | 3 / 3 |
| Thrift-binary | 15 | 4,528,370 | 182.3 / 244.0 | 240 / 240 | 4 / 4 |
| Thrift-compact | 6 | 4,110,997 | 360.5 / 305.3 | 296 / 296 | 5 / 5 |
Each cell is the median paired ratio of peer time to dppack time (pack / unpack). Above 1 means dppack was faster. Three runs of ten batches used identical field values.
| Peer | Point | Event | Batch (16 events) |
|---|---|---|---|
| protobuf | 2.77× / 2.35× | 1.68× / 1.18× | 1.43× / 1.18× |
| Thrift-binary | 2.78× / 1.96× | 2.37× / 1.87× | 2.34× / 1.85× |
| Thrift-compact | 2.99× / 1.33× | 2.62× / 1.36× | 2.39× / 1.36× |
| JSON | 6.12× / 7.98× | 6.10× / 6.53× | 5.99× / 6.50× |
All 24 comparisons passed: the median in each run and the lower quartile of the 30 paired ratios exceeded 1. The smallest lower quartile was 1.12× for Batch decoding against protobuf.
Eight Go workers also completed 100,000 nested Bundles round trips and rejected 100,000 truncated inputs in 114.6368 ms. Methodology and Go implementation findings
One machine, one run. Written by npm run bench -- --write-doc.
Tools: each language's standard benchmark harness, the version this run used
| language | harness | runtime | memory |
|---|---|---|---|
| typescript | tinybench 6.2.5 | Node.js v22.17.0 | V8 sampling heap profiler |
| javascript | tinybench 6.2.5 | Node.js v22.17.0 | V8 sampling heap profiler |
| python | pyperf 2.11.0 | CPython 3.14.5 | tracemalloc peak |
| cpp | Google Benchmark 1.9.1 | MSVC 195136260 | operator new counter |
| csharp | BenchmarkDotNet 0.15.8.0 | .NET 11.0.0 | MemoryDiagnoser |
| rust | criterion 0.5.1 | rustc 1.96.0 (ac68faa20 2026-05-25) | GlobalAlloc counter |
| go | Go testing.Benchmark | go1.27.3 | testing.BenchmarkResult.AllocedBytesPerOp |
1. Speed: dppack operations per second, pack / unpack. Higher = faster
| dppack, ops/s (pack / unpack) | Point | Flat | Bundles | Tree |
|---|---|---|---|---|
| typescript | 42.7M / 79.4M | 2.63M / 2.50M | 698K / 556K | 150K / 94K |
| javascript | 41.6M / 78.2M | 2.62M / 2.50M | 704K / 588K | 147K / 103K |
| python | 1.01M / 569K | 272K / 142K | 32K / 20K | 11K / 3K |
| cpp | 32.3M / 54.3M | 16.4M / 9.61M | 3.17M / 540K | 831K / 208K |
| csharp | 57.3M / 82.9M | 12.4M / 13.8M | 2.67M / 1.36M | 431K / 233K |
| rust | 37.0M / 121.8M | 16.2M / 6.37M | 5.70M / 712K | 1.06M / 135K |
| go | 38.4M / 43.1M | 4.63M / 3.95M | 1.47M / 776K | 181K / 106K |
2. dppack vs other formats: ×N = dppack is N times as fast (geometric mean over records). Below ×1 = slower
| dppack speed vs (pack / unpack) | xpb | xtbinary | xtcompact | dpjson |
|---|---|---|---|---|
| typescript | ×22 / ×14 | ×7.9 / ×4.1 | ×9.8 / ×6.7 | ×11 / ×15 |
| javascript | ×21 / ×12 | ×6.9 / ×2.9 | ×8.9 / ×5.5 | ×9.3 / ×15 |
| python | ×4.0 / ×3.2 | ×2.4 / ×1.9 | ×2.9 / ×1.9 | ×4.9 / ×10 |
| cpp | ×3.7 / ×4.0 | ×2.5 / ×2.2 | ×2.8 / ×2.3 | ×6.4 / ×10.0 |
| csharp | ×3.8 / ×5.4 | ×2.7 / ×3.4 | ×3.2 / ×4.0 | ×9.9 / ×20 |
| rust | ×8.0 / ×5.0 | ×4.6 / ×2.7 | ×5.5 / ×3.3 | ×12 / ×8.6 |
| go | ×4.8 / ×4.9 | ×3.8 / ×6.6 | ×3.3 / ×6.7 | ×28 / ×37 |
3. Encoded size: bytes per record. Smaller = less network and disk
| bytes | dppack | xpb | xtbinary | xtcompact | dpjson |
|---|---|---|---|---|---|
| Point | 17 | 17 | 15 | 9 | 24 |
| Flat | 130 | 122 | 162 | 83 | 316 |
| Bundles | 596 | 722 | 483 | 1215 | |
| Tree | 2780 | 2839 | 4849 | 2851 | 7038 |
4. Memory: heap bytes per call, pack / unpack, and how many times less than other formats. Smaller = less GC. Python = peak held during the call, others = total allocated
| dppack heap bytes per call (pack / unpack) | Point | Flat | Bundles | Tree |
|---|---|---|---|---|
| typescript | 223 / 40 | 259 / 599 | 7K / 6K | 5K / 25K |
| javascript | 226 / 40 | 269 / 797 | 8K / 6K | 5K / 24K |
| python | 736 / 1K | 685 / 4K | 1K / 8K | 6K / 104K |
| cpp | 17 / 0 | 130 / 5 | 596 / 2K | 3K / 13K |
| csharp | 48 / 72 | 160 / 280 | 624 / 3K | 3K / 21K |
| rust | 17 / 0 | 130 / 26 | 596 / 2K | 3K / 12K |
| go | 24 / 8 | 160 / 192 | 1K / 2K | 6K / 12K |
| dppack uses N× less memory than (pack / unpack) | xpb | xtbinary | xtcompact | dpjson |
|---|---|---|---|---|
| typescript | ×16 / ×18 | ×2.9 / ×3.1 | ×4.3 / ×5.0 | ×8.8 / ×9.6 |
| javascript | ×16 / ×17 | ×2.7 / ×3.1 | ×4.1 / ×4.9 | ×8.3 / ×9.1 |
| python | ×1.0 / ×1.0 | ×1.2 / ×1.0 | ×1.0 / ×1.0 | ×1.7 / ×1.2 |
| cpp | ×15 / ×46 | ×2.1 / ×2.0 | ×3.5 / ×4.1 | ×12 / ×12 |
| csharp | ×2.2 / ×2.0 | ×1.5 / ×1.2 | ×1.5 / ×1.5 | ×23 / ×6.6 |
| rust | ×4.9 / ×5.4 | ×3.7 / ×2.5 | ×2.8 / ×2.2 | ×8.0 / ×4.6 |
| go | ×2.8 / ×2.3 | ×2.3 / ×3.3 | ×1.5 / ×3.3 | ×15 / ×24 |
- Machine, method and every format: docs/public/BENCHMARK.md
npm i deukpack(global or project) registers the DeukPack skill for three agents- Claude Code
~/.claude/skills/, Codex~/.codex/skills/, Gemini CLI~/.gemini/skills/ - Agents present in your home get it; none found = all three
- Agents that read Agent Skills (Claude Code, Codex, Gemini CLI) then know how to write IDL, generate and call codecs
- Register again:
deukpack skill. Skip at install:DEUKPACK_NO_SKILL=1 - Skill source: skills/deukpack/SKILL.md
- The CLI tells the agent:
npm ilog,deukpack --help, and everydeukpack gen - Ask: "Use the deukpack skill: define Hero, generate TypeScript and C#"
- Ask: "Add a
levelfield to Hero and regenerate every language" - Full guide: docs/public/AGENT_SKILL.md
namespace Dto
record Hero {
1> required int32 id
2> required string name
3> optional float hp
}
- Full grammar: docs/public/IDL.md
deukpack gen hero.deuk --lang csharp,python --out generated- PowerShell: quote the list,
--lang "csharp,python"
One codec per record. format = dppack xpb xtbinary xtcompact dpjson dpcsv.
| Language | Pack | Unpack |
|---|---|---|
| TypeScript, JavaScript | HeroCodec.pack(hero, 'dppack') |
HeroCodec.unpack(bytes, 'dppack') |
| Python | HeroCodec.pack(hero, 'dppack') |
HeroCodec.unpack(data, 'dppack') |
| C# | HeroCodec.Pack(hero, "dppack") |
HeroCodec.Unpack(bytes, "dppack") |
| C++ | dto::DpPack(hero, "dppack") |
dto::DpUnpack(hero, bytes, "dppack") |
| Rust | hero.dp_pack("dppack")? |
Hero::dp_unpack(bytes, "dppack")? |
| Go | data, err := deukpack.Pack(hero) |
err := deukpack.Unpack(data, &hero) |
- Files are named by namespace, not by IDL file:
MyGame.Dto→my_game_dto <ns>.codec.*holds the codecs,<ns>.*the objects. Python:<ns>_codec.py,<ns>.py- IDL files sharing a namespace generate one set of files
- C#: the namespace is PascalCase (
namespace Dto→Dto) - C++: build
dp_serializer.cppand<ns>.codec.cppwith your sources - Rust:
mod dp_serializer; mod dp_model; mod dp_codec;in your crate root
deukpack schema src/types.ts --out schema/app.deuk --namespace app # TS interface, type, enum
deukpack schema api.schema.json --out schema/api.deuk # JSON Schema
deukpack schema samples/*.json events.jsonl --out schema/events.deuk # JSON samples
deukpack schema app.models:Order --out schema/order.deuk # pydantic v2 model- Several sources → one
.deuk. Field ids = declaration order // infer:lines = choices to review: integer width, TSnumber, string unions, renamed keys- Stops on what
.deukcannot hold: unions, one key with two types across samples - String-valued JSON enums stay
string: dpjson carries enums as integers - C#, C++, Rust and other code: the agent skill writes the
.deuk,deukpack genchecks it .tsneedstypescriptin your project; pydantic:--python <exe>picks the interpreter
deukpack init --idl schema/hero.deuk --lang typescript=gen/ts --lang python=gen/py --lang rust=gen/rs
deukpack gen # every language deukpack.json names
deukpack gen --config <file> # another config fileinitwritesdeukpack.jsonin the current directory: the IDL, an output directory per language,--cpp-allocator,--enum-text,--no-serializer"enumText"picks the json text of enum members:snake_caseby default,namefor the member as written (see IDL.md)- An existing file is an error;
--forcereplaces it - Paths are relative to
deukpack.json. An unknown key, an unknown language or emptylanguagesis an error - Each language's output carries its own format runtime: no per-language DeukPack package to install
- Input: one
.deuk,.protoor.thriftfile --lang:typescriptjavascriptpythoncppcsharprustgo; several go to<out>/<language>/- Go generates package
deukpack. UseNew<Record>()for schema defaults,Pack(record)andUnpack(data, &record)for dppack. UsePackFormat(record, "xpb")andUnpackFormat(data, &record, "xpb")to select any of the six formats. All use the Go standard library. - Output: objects, codecs and the format runtime;
--no-serializeremits objects only - C++ arena:
--cpp-allocator pmrmakes generated objects usestd::pmrcontainers and propagates the memory resource you pass through every nested level. The default stays plain standard containers. Keep one arena per thread or per message - C# output builds for both netstandard2.1 and the installed .NET runtime, in C# 9 syntax
- Python objects are pydantic v2 models (
pip install "pydantic>=2"): strict, validated on assignment, integer widths range-checked python.modelsindeukpack.json: codecs read and write your own pydantic models, no object modulepython.scalarChoice: abool | int | float | strfield carried as one recordpython.native: true: adds a pyo3 crate (native/) anddp_native.py, the Rust codec over your modelspython.native: truewithoutpython.models: the pyo3 crate alone, moduledp_native_obj, no pydantic- Native objects:
Point(x=1),p.x,p.pack(),Point.unpack(data); each class holds the Rust record python.nativebuild: cargo, on the machine that runs Python
mise install
npm ci
npm run verify # every gate
npm run build # dist/
npm run dev:install # this checkout: build, pack, install globally
npm run bench -- --idl <file> # pack / unpack timings per format, all seven languages
npx tsx scripts/compile-gate/serializer-cross.ts # cross-language data integrity
npx tsx scripts/compile-gate/serializer-gate.ts <language> [--idl <file>] [--fuzz <seed>]- Tool versions:
.tool-versions - Gate inputs are fixture schemas, their proto and thrift conversions, and seed-generated ones;
--idlchecks any schema
| Kind | Location |
|---|---|
| IDL grammar | docs/public/IDL.md |
| Scope | docs/public/architecture/TARGET_SCOPE.md |
| Serializer contract | docs/public/architecture/SERIALIZER_CONTRACT.md |
| Generated object contract | docs/public/architecture/GENERATED_OBJECT_CONTRACT.md |
| Format specs | docs/public/protocol/specs/ |
| Releases | releases |
| Releasing | RELEASING.md |
| Document layout | docs/README.md |
| Measured performance | docs/public/BENCHMARK.md |
| Naming | docs/public/IDENTITY.md |
| Support | SUPPORT.md |
- Excel integration · Unity (UPM) · VS Code extension · DB
- Languages: Java, Elixir
Apache License 2.0 — LICENSE · NOTICE. Not an Apache Thrift subproject.
Made by deuklab, built together with AI.
Keywords: IDL code generator, schema-first, contract-first, serialization, serializer, binary serialization, protobuf alternative, Protocol Buffers compatible, Thrift compatible, Apache Thrift, MessagePack alternative, FlatBuffers alternative, cross-language, polyglot, TypeScript serializer, Python serializer, C# serializer, C++ serializer, Rust serializer, JavaScript serializer, pydantic, Unity, game server, packet, DTO, type-safe, codegen, AI agent, agent skills, Claude Code, Codex, Gemini CLI, LLM, structured output, JSON Schema, data contract, wire format, deukpack

