explaingit

yywing/cel-go

Analysis updated 2026-07-14 · repo last pushed 2025-09-25

GoAudience · developerComplexity · 3/5QuietSetup · moderate

TLDR

A Go library that lets you embed a safe, lightweight expression language into your app so users or config files can define custom rules without full code execution.

Mindmap

mindmap
  root((repo))
    What it does
      Safe expression evaluation
      No loops or recursion
      Familiar syntax
    Key features
      Partial state evaluation
      Predictable performance
      Custom variables
    Use cases
      Access control rules
      Config validation
      Feature flag conditions
      Request filtering
    Tech stack
      Go
      Non-Turing complete
    Audience
      Backend developers
      Platform builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a custom access-control system where admins write rules like 'grant access if user email matches a pattern'.

USE CASE 2

Let users define alerting rules such as 'notify me if response time exceeds 500ms and endpoint starts with /api/'.

USE CASE 3

Validate configuration files against user-defined conditions without exposing the app to arbitrary code.

USE CASE 4

Evaluate feature flag conditions from config so non-developers can toggle features by writing simple expressions.

What is it built with?

Go

How does it compare?

yywing/cel-goaasheeshlikepanner/vasealexzielenski/controller-runtime
Stars0
LanguageGoGoGo
Last pushed2025-09-252022-04-20
MaintenanceQuietDormant
Setup difficultymoderatemoderatehard
Complexity3/54/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires familiarity with Go modules and an understanding of how to define the variable types and environment CEL evaluates against.

No license information was provided in the explanation, so the licensing terms are unknown.

In plain English

cel-go lets developers embed a safe, lightweight mini-language into their Go applications so end users or configuration files can express custom rules without giving them full programming power. Think of it as a way to let someone write a simple condition like "grant access if the user's email matches this pattern and the request is within business hours", without exposing the system to arbitrary code execution. At its core, a CEL program is a single expression, no loops, no functions that run forever. Developers define which variables are available (like a user object or a resource name), then compile and evaluate the expression against provided data. The syntax is deliberately similar to common languages like Java, Go, and TypeScript, so it looks familiar. One notable feature is "partial state" evaluation: if some data is missing, the expression can still produce a meaningful result or a simplified residual expression, which is useful in distributed systems where not all information is available at every layer. This is useful for teams building systems that need flexible, user-defined policies, access control rules, configuration validation, feature flag conditions, or request filtering. For example, a platform letting users define custom alerts ("notify me if response time exceeds 500ms and the endpoint starts with /api/") could use CEL to safely evaluate those rules. It's designed for situations where you want more power than a fixed set of checkboxes but less risk than letting people run JavaScript or Lua. The project makes a deliberate tradeoff: by keeping CEL non-Turing complete (no loops, no recursion), it avoids the security and performance costs of sandboxing a full language. Evaluation runs in time proportional to expression size, which makes it predictable. The README notes that JavaScript, Lua, and WASM are alternatives, but argues CEL is faster and simpler for this specific niche of lightweight expression evaluation.

Copy-paste prompts

Prompt 1
Using cel-go in a Go app, write a program that compiles and evaluates the CEL expression 'request.method == "GET" && request.path.startsWith("/public/")' against a request object with fields Method and Path, and prints whether access is allowed.
Prompt 2
Create a Go service using cel-go that accepts a user-defined CEL expression for an alert rule like 'latency_ms > 500 && endpoint.startsWith("/api/")', compiles it, and evaluates it against a sample telemetry payload, printing true or false.
Prompt 3
Using cel-go, implement a simple feature-flag evaluator that reads a CEL condition from a YAML config file and evaluates it against a feature-context struct with fields like user_tier, region, and rollout_percentage.
Prompt 4
Using cel-go, write a Go program that demonstrates partial-state evaluation by compiling an expression that references a variable that is not provided, and prints the residual expression instead of failing.

Frequently asked questions

What is cel-go?

A Go library that lets you embed a safe, lightweight expression language into your app so users or config files can define custom rules without full code execution.

What language is cel-go written in?

Mainly Go. The stack also includes Go.

Is cel-go actively maintained?

Quiet — no commits in 6-12 months (last push 2025-09-25).

What license does cel-go use?

No license information was provided in the explanation, so the licensing terms are unknown.

How hard is cel-go to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is cel-go for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.