Back to directory

cog

A schema-driven code generator, built by Grafana, that reads CUE, JSON Schema or OpenAPI definitions and emits typed classes and builder libraries in Go, Java, PHP, Python or TypeScript.

cog

cog generates both plain data types described by a schema and developer-friendly builder libraries for constructing complex objects as code, across several target languages from one schema source. It runs either as a standalone command-line binary driven by a YAML pipeline configuration, or as a Go library for embedding code generation into another tool.

Grafana uses cog internally to generate its own Foundation SDK from schemas it exposes, and to implement a schema-first approach where resources such as dashboards are defined as schemas first and code is generated from them for both frontend and backend; a related project, grafana-app-sdk, uses cog as a library for some of its own code-generation needs. Despite originating at Grafana, the tool itself is schema-agnostic and not tied to Grafana's own schemas.

It is written in Go, licensed under Apache-2.0, and is currently in public preview.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.