# @swift-rust/video

> Video component for swift-rust. HTML5, YouTube, Vimeo, lightbox, and background-video modes.

Latest version **0.2.2** (published 2026-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @swift-rust/video
pnpm add @swift-rust/video
yarn add @swift-rust/video
bun add @swift-rust/video
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2026-10-17 |
| First published | 2026-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 52.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | cole5689 |

## Links

- npm: https://www.npmjs.com/package/@swift-rust/video
- Repository: https://github.com/colesites/swift-rust
- Homepage: https://swift-rust.dev
- Issues: https://github.com/colesites/swift-rust/issues
- npm.io page: https://npm.io/package/@swift-rust/video

## Recent versions

- 0.2.2 (latest) — 2026-10-17
- 0.2.1 — 2026-06-04
- 0.2.0 — 2026-06-03

## README

# Swift Rust

The full-stack React framework powered with Rust + Bun. Inspired by Next.js. **10x faster than Next.js.** Write your UI in TSX, render on the server with Rust, and ship a single binary.

## Features

- **TSX-first** — Author components in TypeScript with first-class TSX syntax, just like TanStack Start. A custom SWC plugin transforms TSX into optimized Rust view templates.
- **Multi-target rendering** — Choose per project: full SSR, SSR + WASM hydration, server-rendered HTML with HTMX islands, or a fully client-rendered WASM SPA.
- **Built-in components** — `Image`, `Font`, and `Pdf` components handle optimization, loading, and document generation out of the box.
- **Zero-config dev server** — `swift-rust dev` starts a hot-reloading dev server with sensible defaults.
- **Single binary deployment** — Compile your entire app to one Rust binary. No Node.js required in production.
- **File-based routing** — Like Next.js: files in `app/` become routes automatically.

## Repository layout

```
swift-rust/
├── crates/        Rust workspace (framework core, compiler, server, bundler, runtime)
├── packages/      JS/TS packages (swift-rust, create-swift-rust, font, bundle-analyzer, eslint-*, env)
├── docs/          Documentation site
├── errors/        Error code reference and schemas
├── scripts/       Build, release, and CI scripts
├── test/          Integration and end-to-end tests
└── examples/      Example applications
```

## Quick start

```bash
# Scaffold a new project
bun create swift-rust@latest my-app
# or
bunx create-swift-rust@latest my-app

# Enter and start dev server
cd my-app
bun install
bun swift-rust dev
```

Open http://localhost:3000.

## Rendering modes

Swift Rust supports four rendering strategies. Pick the one that fits your project:

| Mode               | Use case                                                 |
| ------------------ | -------------------------------------------------------- |
| `ssr`              | Server-renders full HTML. Lightest. No client JS.        |
| `ssr-wasm`         | SSR first paint + WASM hydration for interactivity.      |
| `ssr-htmx`         | SSR with HTMX islands for progressive enhancement.       |
| `wasm`             | Full WASM SPA with optional SSR shell.                   |

Set the mode in `swift-rust.config.ts`:

```ts
import { defineConfig } from "swift-rust";

export default defineConfig({
  rendering: "ssr-wasm",
  components: {
    image: { domains: ["cdn.example.com"] },
    font: { subsets: ["latin"] },
  },
});
```

## Built-in components

### `<Image>`

```tsx
import { Image } from "swift-rust/image";

export default function Hero() {
  return <Image src="/hero.jpg" width={1200} height={600} priority alt="Hero" />;
}
```

### `<Font>`

```tsx
import { Inter } from "swift-rust/font/google";

const inter = Inter({ subsets: ["latin"], display: "swap" });

export default function RootLayout({ children }) {
  return (
    <html lang="en" className={inter.className}>
      <body>{children}</body>
    </html>
  );
}
```

### `<Pdf>`

```tsx
import { Document, Page, Text, View } from "swift-rust/pdf";

export default function Invoice({ items }) {
  return (
    <Document>
      <Page size="A4">
        <View>
          <Text>Invoice</Text>
          {items.map((it) => (
            <Text key={it.id}>{it.name}: ${it.price}</Text>
          ))}
        </View>
      </Page>
    </Document>
  );
}
```

## Running the examples

```bash
cargo build --release -p swift-rust
export PATH="$PWD/target/release:$PATH"
cd examples/hello-world && bun install && swift-rust dev
```

See [PUBLISHING.md](./PUBLISHING.md) for the full release flow.

## Project status

This is pre-alpha. The scaffold is in place; the framework core is under active development.

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md) and [AGENTS.md](./AGENTS.md).

## License

MIT

---
_Source: https://npm.io/package/@swift-rust/video · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
