- 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.
To begin building your project with Cpp.js, you'll first need to install a few dependencies:
- Docker
- Node.js version 22 or higher
- CMake version 3.28 or higher (only required for Mobile development)
- Xcode (only required for iOS development)
- Cocoapods (only required for iOS development)
To set up a new cpp.js project with a minimal starter structure, execute the following command in your terminal:
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.12 |
| @cpp.js/package-geos | 2.0.0-beta.12 |
| @cpp.js/package-proj | 2.0.0-beta.12 |
| @cpp.js/package-spatialite | 2.0.0-beta.12 |
| @cpp.js/package-sqlite3 | 2.0.0-beta.12 |
| @cpp.js/package-openssl | 2.0.0-beta.12 |
| @cpp.js/package-curl | 2.0.0-beta.12 |
| @cpp.js/package-tiff | 2.0.0-beta.12 |
| @cpp.js/package-geotiff | 2.0.0-beta.12 |
| @cpp.js/package-webp | 2.0.0-beta.12 |
| @cpp.js/package-expat | 2.0.0-beta.12 |
| @cpp.js/package-iconv | 2.0.0-beta.12 |
| @cpp.js/package-zlib | 2.0.0-beta.12 |
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ı