Oxc: High-Performance JavaScript Tools Written in Rust

Summary
Oxc is a high-performance collection of JavaScript and TypeScript tools built in Rust, designed to be a unified and ultra-fast toolchain. It powers projects like Rolldown, Vite's future bundler, and offers modular components for linting, formatting, parsing, transforming, and minifying code, emphasizing performance and correctness.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Oxc is a high-performance collection of JavaScript and TypeScript tools written in Rust, designed to be a unified and ultra-fast toolchain. As part of VoidZero's vision, Oxc powers critical projects like Rolldown, Vite's future bundler, enabling the next generation of development tools that work seamlessly together.
The project emphasizes several core design principles:
- Performance: Achieved through rigorous engineering.
- Correctness: Ensured by conformance testing to standards.
- Developer Experience: Provided through clear APIs, comprehensive documentation, and sensible configuration.
- Modular Composability: Allowing individual components to be used independently or composed into complete toolchains.
Oxc offers a suite of tools including a linter, formatter, parser, transformer, minifier, and resolver, all built for speed and reliability.
Installation
Oxc provides various tools available as npm packages for Node.js environments and individual crates for Rust projects.
Linter (oxlint)
npx oxlint@latest
Formatter (oxfmt)
npx oxfmt@latest
Parser (oxc-parser)
Install the fastest JavaScript/TypeScript parser for Node.js:
npm install oxc-parser
Transformer (oxc-transform)
For TypeScript, React, and modern JavaScript transformation:
npm install oxc-transform
Minifier (oxc-minify)
Integrate the high-performance JavaScript minifier:
npm install oxc-minify
Rust Crates
For building your own JavaScript tools in Rust, individual crates are available:
[dependencies]
oxc = "0.x"
Examples
Here are quick examples demonstrating the usage of Oxc's core tools.
Linter Example
Linting a project is as simple as running:
npx oxlint@latest
Oxlint can process thousands of files in under a second, as demonstrated in the vscode repository.
Parser Example (Node.js)
Parse JavaScript code and get the Abstract Syntax Tree (AST):
import { parseSync } from 'oxc-parser';
const result = parseSync('const x = 1;');
console.log(result);
Transformer Example (Node.js)
Transform TypeScript or React code:
import { transform } from 'oxc-transform';
const code = 'const Component = () => <div />;';
const result = transform('source.tsx', code, { typescript: true, react: true });
console.log(result.code);
Minifier Example (Node.js)
Minify JavaScript code with optional mangling:
import { minify } from 'oxc-minify';
const code = 'function longFunctionName() { console.log("hello"); }';
const result = minify(code, { mangle: true });
console.log(result.code); // Expected: function a(){console.log("hello")}
Why Use Oxc?
Oxc stands out due to its commitment to performance, correctness, and developer experience. Written in Rust, it leverages the language's speed and safety features to deliver unparalleled execution times for common JavaScript development tasks. Its modular design allows developers to pick and choose the tools they need, integrating them seamlessly into existing workflows or building entirely new toolchains.
Major projects and companies are already adopting Oxc, including:
- Rolldown (Vite's future bundler) for parsing, transformation, and minification.
- Nuxt for parsing.
- Preact, Shopify, ByteDance, and Shopee for linting with
oxlint. - Nova,
swc-node, andknipfor module resolution usingoxc_resolver.
By choosing Oxc, you're investing in a future-proof, high-performance toolchain that is actively developed and supported by a growing community and industry leaders.
Links
- GitHub Repository: oxc-project/oxc
- Official Website: oxc.rs
- Documentation: oxc.rs/docs
- Discord Community: Join Discord
- Playground: playground.oxc.rs
- Sponsor Oxc: Sponsor Boshen