{"id":24943,"library":"avdl-compiler","title":"avdl-compiler","description":"AVDL (Avro IDL) compiler that generates Go, Python, and TypeScript source code from protocol definition files. Current stable version is 1.4.10, released infrequently as a Keybase internal tool. Key differentiators: supports multi-language output (Go, Python, TypeScript) from a single AVDL schema, implements the Avro interface description language, and is written in IcedCoffeeScript. Compared to other Avro tools like avro-tools or avrodoc, this compiler is specifically designed for generating bot SDK code across Keybase's supported languages.","status":"active","version":"1.4.10","language":"javascript","source_language":"en","source_url":"https://github.com/keybase/node-avdl-compiler","tags":["javascript","AVDL","Go"],"install":[{"cmd":"npm install avdl-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add avdl-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add avdl-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency; the compiler is written in IcedCoffeeScript and requires it to execute.","package":"iced-coffee-script","optional":false}],"imports":[{"note":"Package is CommonJS only; ESM import is not supported.","wrong":"import compile from 'avdl-compiler'","symbol":"default","correct":"const compile = require('avdl-compiler')"},{"note":"Named export available via require; ESM not supported.","wrong":"import { compileFile } from 'avdl-compiler'","symbol":"compileFile","correct":"const { compileFile } = require('avdl-compiler')"},{"note":"Compiles AVDL from a string variable.","wrong":"","symbol":"compileString","correct":"const { compileString } = require('avdl-compiler')"},{"note":"TypeScript interface; use with JSDoc or TypeScript types.","wrong":"","symbol":"CompileOptions","correct":"const { CompileOptions } = require('avdl-compiler')"}],"quickstart":{"code":"const { compileFile } = require('avdl-compiler');\nconst fs = require('fs');\n\n// Example AVDL content: protocol Example { record Person { string name; int age; } }\nconst avdlContent = `protocol Example {\n  record Person {\n    string name;\n    int age;\n  }\n}`;\n\nfs.writeFileSync('example.avdl', avdlContent);\n\nconst options = {\n  language: 'go',\n  packageName: 'main',\n  namespace: 'com.example',\n};\n\nconst result = compileFile('example.avdl', options);\nconsole.log(result);\n// Output: Go code representing the Person record\n\nfs.unlinkSync('example.avdl');","lang":"javascript","description":"Compiles an AVDL file to Go using compileFile and shows the output."},"warnings":[{"fix":"Use a separate Node environment or containerize your build.","message":"The compiler requires IcedCoffeeScript, which might conflict with other CoffeeScript versions in your project.","severity":"gotcha","affected_versions":"<=1.4.10"},{"fix":"Prefer Go or TypeScript output for production use.","message":"The Python code generation might be incomplete or experimental.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Pin to a specific version in your package.json.","message":"Output format can change between minor versions without notice.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Check the AVDL specification against supported schema features.","message":"Only supports a subset of Avro schema features (e.g., no unions with null).","severity":"gotcha","affected_versions":"<=1.4.10"},{"fix":"There is no fix; consider migrating to a different Avro compiler.","message":"The compiler is written in IcedCoffeeScript, which is an unmaintained fork of CoffeeScript.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install required peer dependency: npm install iced-coffee-script","cause":"Missing iced-coffee-script dependency.","error":"Error: Cannot find module 'iced-coffee-script'"},{"fix":"Use const { compileFile } = require('avdl-compiler'); not const compileFile = require('avdl-compiler');","cause":"Importing the package incorrectly; compileFile is a named export.","error":"TypeError: compileFile is not a function"},{"fix":"Ensure AVDL starts with 'protocol ProtocolName {' and follows Avro IDL syntax.","cause":"Invalid AVDL syntax, possibly missing protocol declaration.","error":"SyntaxError: Unexpected token on line 1 of AVDL file"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}