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.
However many languages, whoever writes the code: one set of bytes.
Up to 21× faster than protobuf-compatible | up to 37× faster than JSON
6 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 six languages: bytes from one language read by the other five and compared
- 30 directions × 6 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
struct 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 language: Rust
- 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 |
|---|---|---|---|---|---|---|
dppack |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xpb |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xtbinary |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
xtcompact |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
dpjson |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
dpcsv |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
- Every cell covers 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 five unpack and compare (30 directions × 6 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
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 |
1. Speed: dppack operations per second, pack / unpack. Higher = faster
| dppack, ops/s (pack / unpack) | Point | Flat | Bundles | Tree |
|---|---|---|---|---|
| typescript | 39.8M / 79.4M | 2.62M / 2.50M | 711K / 556K | 149K / 92K |
| javascript | 39.1M / 78.5M | 2.79M / 2.50M | 696K / 556K | 146K / 103K |
| python | 1.01M / 572K | 270K / 141K | 32K / 20K | 11K / 3K |
| cpp | 32.6M / 60.8M | 17.2M / 10.5M | 3.31M / 556K | 835K / 199K |
| csharp | 49.7M / 86.4M | 11.6M / 14.0M | 2.44M / 1.52M | 421K / 247K |
| rust | 35.9M / 116.6M | 16.8M / 6.10M | 5.66M / 696K | 1.07M / 125K |
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 | ×21 / ×14 | ×7.6 / ×4.2 | ×9.8 / ×7.0 | ×37 / ×26 |
| javascript | ×21 / ×12 | ×6.7 / ×3.0 | ×8.8 / ×5.5 | ×35 / ×25 |
| python | ×4.0 / ×3.2 | ×2.4 / ×1.9 | ×2.9 / ×1.9 | ×4.8 / ×10.0 |
| cpp | ×3.6 / ×3.8 | ×2.3 / ×2.1 | ×2.7 / ×2.3 | ×6.4 / ×9.8 |
| csharp | ×3.3 / ×5.0 | ×2.7 / ×3.1 | ×2.8 / ×3.6 | ×9.1 / ×22 |
| rust | ×8.0 / ×4.5 | ×5.0 / ×2.6 | ×5.5 / ×3.1 | ×16 / ×17 |
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 | 224 / 40 | 257 / 610 | 7K / 6K | 5K / 24K |
| javascript | 225 / 40 | 272 / 791 | 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 |
| dppack uses N× less memory than (pack / unpack) | xpb | xtbinary | xtcompact | dpjson |
|---|---|---|---|---|
| typescript | ×16 / ×18 | ×2.8 / ×3.1 | ×4.3 / ×5.2 | ×19 / ×18 |
| javascript | ×16 / ×17 | ×2.7 / ×3.1 | ×4.1 / ×5.0 | ×17 / ×17 |
| 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.9 / ×6.8 |
- 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
struct 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")? |
- 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,--no-serializer- 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:typescriptjavascriptpythoncppcsharprust; several go to<out>/<language>/- 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 six 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

