Modular programming paradigm for Rust

Modular component system

Highly expressive macros

Type-Safe composition

No-Std friendly

Zero-Cost abstraction

Explore More ⇩

Announcement

I'm excited to announce the release of v0.4.0 of the cgp crate. This update includes significantly improved developer experience, improved debuggability, and many more new features!

Read the blog post for more details: CGP v0.4.0 is Here: Unlocking Easier Debugging, Extensible Presets, and More!.

Overview

Context-generic programming (CGP) is a new programming paradigm for Rust that allows strongly-typed components to be implemented and composed in a modular, generic, and type-safe way.

To learn more about the high level overview of CGP, check out the overview page.

Current Status

As of 2025, CGP remains in its early stages of development. While promising, it still has several rough edges, particularly in areas such as documentation, tooling, debugging techniques, community support, and ecosystem maturity.

As such, adopting CGP for serious projects comes with inherent challenges, and users are advised to proceed at their own risk. The primary risk is not technical but stems from the limited support available when encountering difficulties in learning or applying CGP.

At this stage, CGP is best suited for early adopters and potential contributors who are willing to experiment and help shape its future.

Getting Started

There are several places where you can get started learning and using CGP.

Hello World Tutorial

The Hello World Tutorial gives a high level walkthrough of various CGP features using a hello-world style example.

Book

To better understand CGP, the best approach is to dive into our book, Context-Generic Programming Patterns. It provides a comprehensive guide to understanding and working with CGP.

Applications

You can also explore real-world applications and projects that use CGP, such as Hermes SDK, to gain a deeper understanding of its practical uses.

Resources

Check out the Resources page for more materials and learning tools to help you get up to speed with CGP.