app/
├── layout.rs the frame around every page
├── page.rs /
├── about/page.rs /about
└── blog/[slug]/page.rs /blog/anything
// app/page.rs
use *;
That file is the whole route. There's no router to register it with and no
config to update. Save it, and next-rust dev serves it at /.
Early days. Next Rust is pre-1.0 (0.0.x releases). It works: the examples run, the tests pass, and a fresh project builds into a single deployable binary. But APIs will still move before 1.0, and some pieces are missing. The honest list is the "Status & roadmap" page of the documentation. If something you need is on it, that's a great place to start contributing.
The idea
If you've built a site with a file-based JavaScript framework, you already know how this feels. You create a folder, drop in a page, wrap things in layouts, and put an API handler next to the pages that use it.
We wanted that workflow without leaving Rust. So there's no Node.js, no
bundler, and no React. A build script reads your app/ folder and generates
ordinary Rust code that wires everything together. The compiler checks all of
it, so a page that asks for data the framework can't give it doesn't build.
You find out at your desk instead of in production.
What comes out the other end is a single native server binary.
A slightly bigger taste
A blog post that's pre-rendered at build time and refreshed every hour:
// app/blog/[slug]/page.rs
use *;
pub const REVALIDATE: u64 = 3600;
pub async
pub async
An API endpoint living right next to it:
// app/api/posts/route.rs
use *;
pub async
And a form that works with JavaScript turned off, then gets smoother when it's on:
pub async
Getting started
1. Install Rust (skip this if you already have it)
Next Rust needs Rust 1.88 or newer. To check what you have:
If that prints "command not found", or a version older than 1.88, install Rust with rustup, the official installer.
macOS and Linux:
|
Windows: download and run rustup-init.exe. If it asks, also install the Visual Studio C++ Build Tools.
Then open a new terminal and confirm:
If you had an older Rust already, update it with rustup update stable.
2. Install the Next Rust CLI
This installs the next-rust command from crates.io, and takes a minute or
two the first time. To use the newest code from main instead, install from
GitHub:
Check it worked:
If your terminal can't find next-rust, make sure ~/.cargo/bin (on Windows,
%USERPROFILE%\.cargo\bin) is on your PATH, then open a new terminal.
3. Create a project
New projects use the Next Rust version published on crates.io. Pass --git
to track the GitHub repository instead.
Adding Next Rust to an existing Cargo project instead? cargo add next-rust
and cargo add --build next-rust-build, then see
"Installation → Adding to an existing Cargo project" in the
documentation.
4. Run it
Open http://localhost:3000 and edit app/page.rs. The browser reloads when
the build finishes. If you save something broken, the last good version keeps
running and the compiler error shows up in the page.
The first build downloads and compiles the framework, so give it a moment. After that, rebuilds are fast.
When you're ready to ship:
Staying up to date
New projects follow this GitHub repository, so updating is one command. Run it inside your project:
That does two things:
- moves your project's framework to the latest commit on GitHub (the exact
version stays pinned in
Cargo.lockuntil you upgrade again); - reinstalls the
next-rustcommand from GitHub.
To update just one of them:
You don't need to remember to check. Once a day, next-rust dev and
next-rust new quietly ask GitHub whether something newer exists, and print a
short note if it does. Nothing is installed without you running
next-rust upgrade, so an update never lands in the middle of your work. The
check sends no information about you or your project. Turn it off with
NEXT_RUST_NO_UPDATE_CHECK=1.
Prefer plain Cargo? cargo update -p next-rust -p next-rust-build updates the
project, and running the install command from step 2 again with --force
updates the CLI.
Working on the framework itself
If you want to change Next Rust while building an app with it, point the app at your own clone instead:
That project uses your local copy, so git pull in the clone updates it.
What's in the box
You don't have to learn all of this on day one, but it's there when you need it:
- Routing: nested layouts, route groups like
(marketing), dynamic and catch-all segments, parallel@slots, intercepting routes, and plainpage.htmlfiles for the pages you don't want to rewrite. - Rendering: server-side rendering, static generation, timed and
on-demand revalidation, and streaming with
loading.rs. Next Rust works out which pages can be static, andnext-rust routestells you why the others aren't. - Backend: API routes, middleware at any level of the tree, cookies, sessions, CORS, rate limiting, server-sent events and WebSockets.
- Frontend: HTML is escaped unless you explicitly ask for raw output. CSS modules are scoped at compile time. Pages ship zero JavaScript unless they use client navigation or an interactive island, and even then it's a single ~4 KB script. Navigating between pages that share layouts renders and sends only the part below them; the layouts stay on screen.
- Tooling:
new,dev,build,start,routes,check,doctor,generateanddocker.
Each of the 13 projects in examples/ comes with its own tests.
They're the quickest way to see how the pieces fit.
How the repository is laid out
crates/
├── next-rust what applications depend on
├── next-rust-cli the `next-rust` command
├── next-rust-build turns app/ into generated Rust (runs in build.rs)
├── next-rust-router scanning, validation, route matching
├── next-rust-view the HTML macros and the streaming renderer
├── next-rust-server HTTP, middleware, rendering pipeline, caching, actions
├── next-rust-macros #[client], #[server_action], css_module!, asset!
├── next-rust-cache cache stores
├── next-rust-core config, .env loading, diagnostics
└── next-rust-assets hashing, MIME types, CSS processing
examples/ small runnable apps, each with tests
website/ the documentation site, built with Next Rust
benchmarks/ the benchmark harness
To see how a request travels through all of that, read the Architecture page of the documentation.
Contributing
Next Rust is built in the open, and it only gets good if people other than its first authors shape it. Every kind of contribution helps: a bug report, a confusing error message you ran into, a docs fix, an example, or a whole feature.
Some good places to jump in:
- Automated WASM builds for client components. The protocol exists;
running
cargoandwasm-bindgenfor you doesn't yet. - Image resizing and WebP output behind the existing
Image!component. - Native TLS, so small deployments don't need a proxy.
- Browser tests for client-side navigation and islands.
- Windows. Nobody has verified it yet.
- Error messages. If one confused you, it will confuse someone else. Tell us, or improve it.
Getting set up:
Read CONTRIBUTING.md before opening a pull request. It covers how changes are proposed, what we look for in reviews, and how to report security issues privately.
If you're unsure whether an idea fits, open an issue and ask. Questions are contributions too.
Documentation
The documentation is a website built with Next Rust itself, in
website/. It covers installation, routing, rendering, server
actions, deployment and every configuration option, with search. To read it
locally:
next-rust build in that folder produces the whole site as one binary, ready
to deploy. The site is pure Rust: each page is a module in
website/src/content/ written with the same view
macros your app uses.
License
Next Rust is available under either the MIT license or the Apache License 2.0, at your option. Unless you say otherwise, any contribution you submit is licensed the same way.
Next Rust is inspired by the file-based routing popularized by Next.js. It's an independent project, not affiliated with Vercel, and it contains no code from Next.js or React.