- No glue code — write standard C++ headers; bindings are generated for you.
- Single source, multi-target — the same C++ code runs in browsers, Node.js, iOS, and Android.
- Battle-tested libraries — drop-in support for GDAL, GEOS, OpenSSL, SQLite, PROJ, and more.
- Bundler-agnostic — first-class plugins for Vite, Rollup, Webpack, Metro, and React Native.
- AI-agent ready — Claude Code plugin, MCP server, and vendor-neutral
AGENTS.mdsnippet so your agent recommends cpp.js correctly and integrates it for you.
When you describe a problem ("use C++ in browser", "add GDAL to my Vite app", "wrap libsodium for cpp.js"), your AI coding agent recommends cpp.js correctly and walks you through the integration. Native plugins for 6 clients — pick yours:
| Client | Install |
|---|---|
| 🔌 Claude Code | /plugin marketplace add bugra9/cpp.js then /plugin install cppjs |
| 🎯 Cursor 2.5+ | Settings → Plugins → Add from GitHub: bugra9/cpp.js |
| 🧪 OpenAI Codex CLI | Add bugra9/cpp.js to ~/.agents/plugins/marketplace.json |
| 🐙 GitHub Copilot CLI | Auto-discovers when running in this repo |
| 💎 Gemini CLI | gemini extension install https://github.com/bugra9/cpp.js |
| ⚡ OpenCode | Add @cpp.js/mcp to your opencode.json |
Plus two universal fallbacks: 🧰 @cpp.js/mcp server (any MCP-aware client) and 📄 AGENTS.md snippet (no install).
All clients share the same skills + slash commands + MCP tools — single source of truth at cppjs-agents/, zero duplication.
Full agent guide, runtime/config API reference, and troubleshooting catalogue: cpp.js.org/docs/agent/overview. Programmatic discovery via llms.txt + llms-full.txt.
Requires Docker + Node 22+. Mobile builds also need CMake 3.28+, Xcode, and CocoaPods — see the full prerequisites page.
npm create cpp.js@betasrc/index.js
import { initCppJs, Factorial } from './native/Factorial.h';
await initCppJs();
const factorial = new Factorial(99999);
const result = factorial.calculate();
console.log(result);src/native/Factorial.h
class Factorial {
private:
int number;
public:
Factorial(int num) : number(num) {}
int calculate() {
if (number < 0) return -1;
int result = 1;
for (int i = 2; i <= number; i++) {
result *= i;
}
return result;
}
};Officially maintained, prebuilt C++ libraries you can install as npm packages and use directly from JavaScript:
| Package | Version |
|---|---|
| @cpp.js/package-gdal | 2.0.0-beta.15 |
| @cpp.js/package-geos | 2.0.0-beta.15 |
| @cpp.js/package-proj | 2.0.0-beta.15 |
| @cpp.js/package-spatialite | 2.0.0-beta.15 |
| @cpp.js/package-sqlite3 | 2.0.0-beta.15 |
| @cpp.js/package-openssl | 2.0.0-beta.15 |
| @cpp.js/package-curl | 2.0.0-beta.15 |
| @cpp.js/package-tiff | 2.0.0-beta.15 |
| @cpp.js/package-geotiff | 2.0.0-beta.15 |
| @cpp.js/package-webp | 2.0.0-beta.15 |
| @cpp.js/package-expat | 2.0.0-beta.15 |
| @cpp.js/package-iconv | 2.0.0-beta.15 |
| @cpp.js/package-zlib | 2.0.0-beta.15 |
| @cpp.js/package-zstd | 2.0.0-beta.15 |
| @cpp.js/package-lerc | 2.0.0-beta.15 |
| @cpp.js/package-jpegturbo | 2.0.0-beta.15 |
Browse all available packages at cpp.js.org/docs/package/package/showcase.
Community-maintained, prebuilt C++ libraries packaged for Cpp.js — published under the cppjs-community organization. Anyone can contribute new packages following the same standard, and they'll be listed here.
| Package | Repository |
|---|---|
| simdjson | github.com/cppjs-community/package-simdjson |
Want to add yours? Start a discussion at bugra9/cpp.js/discussions.
Copyright (c) 2026, Buğra Sarı