Rust Library Brings File-Based Routing to Internet Computer Canisters

A new open-source Rust library aims to simplify how developers build and deploy web applications on the Internet Computer Protocol, offering a familiar routing structure while keeping everything fully on-chain.

Developer Kristofer Lund has released ic-asset-router v0.1.1, a personal project designed to introduce file-based HTTP routing to Internet Computer (ICP) canisters. Inspired by frameworks such as Next.js and SvelteKit, the library allows developers to create certified web endpoints by placing handler files directly into a routes directory, removing much of the manual setup traditionally required for ICP applications.

The release arrives as developers continue exploring ways to build full-stack applications entirely on-chain, where both front-end delivery and backend logic operate within a single canister. According to Lund, the project grew out of practical frustrations faced while building React single-page applications on ICP, particularly around search engine visibility and social media previews.

Single-page applications typically return identical HTML across all routes, which prevents crawlers from generating accurate previews or metadata. The new library addresses this limitation by dynamically generating route-specific index.html files at the canister level, embedding customised meta tags and Open Graph images while allowing the application to function normally in the browser.

This approach enables developers to maintain a standard SPA experience while improving discoverability without relying on external servers or off-chain rendering services.

Beyond search optimisation, ic-asset-router attempts to reduce boilerplate code associated with ICP HTTP handlers. Tasks such as routing logic, response certification, cache handling, and endpoint wiring are automated, allowing developers to focus on application features rather than infrastructure setup. Each file placed inside the src/routes directory automatically becomes an endpoint during compilation, with typed parameters and middleware applied through a structured hierarchy.

The library supports multiple certification modes, including authenticated responses designed to prevent cached data from being shared between users. Developers can selectively disable certification for endpoints such as health checks, which may benefit from faster query-style execution.

Middleware functionality mirrors patterns common in modern web frameworks. A middleware file placed within a directory wraps all nested routes, enabling developers to manage tasks such as CORS handling or security headers with minimal configuration.

A working example of the system is already live through the Promptathon Showcase application, which uses a single canister to serve both a React front end and a JSON API. The setup resembles a traditional full-stack framework, except the application runs entirely on-chain after being compiled to WebAssembly.

The project includes ten deployable examples ranging from server-rendered HTML templates to authenticated APIs and cache invalidation workflows, offering developers reference implementations for common use cases.

Lund said the library was largely developed using an AI coding agent guided by the “RALPH loop” workflow, a structured development process introduced by Geoffrey Huntley that breaks projects into tightly scoped tasks executed sequentially. Documentation outlining the method, prompts, and development specifications has been published alongside the codebase.

While ic-asset-router is not an official DFINITY release, it reflects a growing trend of independent tooling emerging around the Internet Computer ecosystem as developers experiment with new ways to host applications without traditional cloud infrastructure.

Early feedback will likely determine whether the library becomes a broader standard within the ICP developer community, particularly among teams seeking simpler deployment patterns without sacrificing on-chain guarantees. Contributions and issue reports are currently being accepted through the project’s public repository.


Dear Reader,

Ledger Life is an independent platform dedicated to covering the Internet Computer (ICP) ecosystem and beyond. We focus on real stories, builder updates, project launches, and the quiet innovations that often get missed.

We’re not backed by sponsors. We rely on readers like you.

If you find value in what we publish—whether it’s deep dives into dApps, explainers on decentralised tech, or just keeping track of what’s moving in Web3—please consider making a donation. It helps us cover costs, stay consistent, and remain truly independent.

Your support goes a long way.

🧠 ICP Principal: ins6i-d53ug-zxmgh-qvum3-r3pvl-ufcvu-bdyon-ovzdy-d26k3-lgq2v-3qe

🧾 ICP Address: f8deb966878f8b83204b251d5d799e0345ea72b8e62e8cf9da8d8830e1b3b05f

Every contribution helps keep the lights on, the stories flowing, and the crypto clutter out.

Thank you for reading, sharing, and being part of this experiment in decentralised media.
—Team Ledger Life

0

Community Discussion

Loading discussion…

LEAVE A REPLY

Please enter your comment!
Please enter your name here

More like this

Chinese Gold ETFs Hold Firm as North America Sees...

Investor behaviour in gold funds has split along regional lines, with fresh data showing a clear divergence...

ICP rolls out ckBTC skill to simplify native Bitcoin...

A new developer-focused release tied to Internet Computer is aiming to make working with Bitcoin on-chain more...

Cloudly Aims to Cut Platform Fees with Web3 Creator...

A new project shared by Paul is positioning itself as an alternative to traditional creator platforms, with...