Jump to content

Hosting a full web app on ICP canisters

From IdeaWazaWiki

Hosting a full web app on ICP canisters means running a website's pages, its server logic and its stored data inside canisters on the Internet Computer, a network of independently operated nodes, so that no separate web host or database server is needed. A canister bundles WebAssembly code with its own persistent state, and canisters can serve web pages over HTTP, hold gigabytes of data and call outside APIs.[1] The messaging app OpenChat and the social publishing platform TAGGR both run this way, and their histories show what the model makes easy and what it changes.

What a canister is

Each canister runs on a single thread and handles one message at a time, following the actor model. Update calls change state and go through consensus among the nodes of a subnet, typically completing in one to two seconds. Query calls only read state, run on one node and return in milliseconds, but their answers are unverified unless the canister uses certified data.[1] OpenChat's architecture notes describe subnets as typically made of 13 node machines, each in an independent data center.[2]

Memory comes in two regions. Heap memory is limited to 4 GiB for 32-bit WebAssembly and 6 GiB for 64-bit, and it is cleared when the code is upgraded. Stable memory can grow to 500 GiB per canister and survives upgrades.[1]

Serving the frontend

For the visible website, the documented route is a certified static site canister. A developer points the command line tool at a build folder and runs one deploy command, which uploads the files and syncs only what changed on later deploys. Every response carries a cryptographic proof that a verifying gateway checks before passing the page to the browser, and clean URLs, compression and caching headers come by default.[3]

Each canister is reachable at an address under icp.net. To use a custom domain, the owner adds three DNS records, serves a small file at /.well-known/ic-domains listing the domain, and registers it through an HTTP request. The gateway then obtains and renews the TLS certificate automatically, so the site works over ordinary HTTPS links.[4]

Backend and data in one place

On a traditional stack, an application talks to a database. ICP documentation describes the shift as the app being the database: in Motoko, variables in a persistent actor survive upgrades automatically, and in Rust, developers store data in stable structures such as StableBTreeMap.[5] The documentation warns against an older pattern of copying the whole heap into stable memory just before an upgrade, because a large enough dataset exceeds the instruction limit, the upgrade fails, and recovery may lose data.[5]

Who may upgrade the code is also a design choice. A canister can be controlled by one developer, by a multi-signature wallet, by a governance system that requires a vote, or by no one at all, in which case its code can never change.[1]

OpenChat and TAGGR

OpenChat's canisters provide its API and serve the assets of its web app.[2] Its original design gave every user their own canister, which kept access control simple because only that user could reach it. In September 2026 its developers explained on the DFINITY forum that a yearly base fee per canister, introduced in mid 2026, made roughly 250,000 canisters too costly, and that they were moving users into shared canisters of about 10,000 users each.[6] The episode shows how much the platform's resource rules shape an application's structure.

TAGGR publishes its code on GitHub under the GPL 3.0 license.[7] Its release process is built for outside checking: anyone can check out the commit named in an upgrade proposal, run one build command in a container, and confirm that the printed hash matches the binary being proposed.[8] Reproducible builds like this let users verify that the code running in a canister matches the published source.

What changes when moving ordinary backend code

A conventional frontend usually moves with little change, since it is just a folder of built files. The backend is different.

  • No database server. Tables and queries become data structures in stable memory, designed with upgrades in mind.[5]
  • One message at a time. Long-running background processes give way to short message handlers and timers.[1]
  • Outside API calls. HTTPS outcalls let a canister call web services, but by default every node in the subnet sends the same request, so a POST that creates an order may arrive 13 times unless the API honors idempotency keys. Responses are capped at 2 MB, only HTTPS is allowed, and streaming and WebSockets are not supported.[9]
  • The app pays, not the user. Canisters pay for compute, storage and messages in cycles, while query calls are free and users pay nothing to use the app. A canister that runs out of cycles freezes, and if it is not topped up in time the network deletes it along with its data, so watching balances becomes part of operations.[10]

For a decentralized code or model hub, this model suits a registry, permissions and discussion threads well. Very large files fit better elsewhere, since each canister and each subnet has finite storage.[5]

  • What does it mean for an application to be its own database, and what problems does that remove or create?
  • Why would giving each user a separate canister simplify security, and why did it become hard to sustain?
  • How do reproducible builds help ordinary users trust code they cannot read themselves?
  • Which kinds of backend code would be easiest and hardest to move into canisters?
  • How should a team decide between a single developer, a multi-signature wallet, governance voting or no controller at all?
  • What risks follow from an app paying for its own resources instead of its users, and how could a project plan for them?
  • Design the canister layout for a small decentralized model registry with users, repositories and comments.
  • How do certified responses differ from ordinary HTTPS, and when does that difference matter?

Readings from Wikipedia

See also

References