swift-rust
v1.10.2
Published
The full-stack React framework powered with Rust + Bun. TSX-first, Rust rendering, 10x faster than Next.js, single binary deploy.
Maintainers
Readme
swift-rust
The main swift-rust npm package. Installing it in a project gives you:
- A
swift-rustbin onPATH(or vianpx swift-rust). - Imports for
<Image>,<Font>,<Document>,<Head>,<Link>, etc. - A
defineConfighelper forswift-rust.config.json.
The framework binary is downloaded at install time from GitHub Releases. If no prebuilt binary is available for the user's platform, cargo build is run as a fallback.
Install
npm install swift-rust
# or
bun add swift-rust
# or
yarn add swift-rustUsage
CLI
npx swift-rust dev # start dev server
npx swift-rust build # production build
npx swift-rust start # start production server
npx swift-rust info # print environmentIn code
import { Image, Inter, Document, Page, Text, View } from "swift-rust";
const inter = Inter({ subsets: ["latin"] });
export default function Home() {
return (
<html lang="en" className={inter.className}>
<body>
<Image src="/hero.jpg" width={1200} height={600} alt="Hero" priority />
</body>
</html>
);
}Subpath exports
| Path | What it exposes |
| ----------------------- | -------------------------------------------------------- |
| swift-rust | Everything (config, components, types). |
| swift-rust/image | <Image> component + types. |
| swift-rust/font | Font helpers + types. |
| swift-rust/font/google| Google Fonts families. |
| swift-rust/font/local | localFont for self-hosted fonts. |
| swift-rust/pdf | <Document>, <Page>, <Text>, <View>. |
| swift-rust/env | Env loading + SWIFT_RUST_PUBLIC_* helpers. |
| swift-rust/router | Route handler types. |
| swift-rust/head | <Head> metadata. |
| swift-rust/link | <Link> client navigation. |
Publishing
This package is built from packages/swift-rust/ in the monorepo.
# 1. Build native binaries for all platforms
SWIFT_RUST_VERSION=0.1.0 bun run scripts/package-native.ts
# 2. Publish to npm
cd packages/swift-rust
bun publishThe prepublishOnly script runs both steps automatically.
