Single canister Dapps

Hey all,

Is it possible to have a single canister serve the frontend via http_request query function and provide the backend methods at the same time?

So can we have single canister app that stores both the frontend assets and the backend logic and data?

Ps: The IC is amazing

Hey bobbylingus,

I actually happened to post a starter template for that exactly that today Show IC forum: Alternative to asset canister.

For other examples you can check out the NNS frontend dapp GitHub - dfinity/nns-dapp: The Dapp of the Internet Computer's Network Nervous System. and the Internet Identity repo GitHub - dfinity/internet-identity: Internet Identity, a blockchain authentication system for the Internet Computer

3 Likes

Yeah you can, but there are benefits of a multi-canister approach:

  • increased parallelism may lead to greater overall query/update throughput (each canister is single-threaded… multiple canisters means multiple threads of execution)
  • increased stable memory storage (max 8 GB per canister * number of canisters)
  • modular upgrades may save cycles (if you only need to upgrade A data, then upgrade A canister instead of a single canister with both A and B)
  • more flexible configuration (maybe you want to blackhole canister A but retain control of canister B… canonical example is a token canister)

I’m sure there are more, but those are the ones that come to mind first.

5 Likes

Thank you for both replies. I now better understand the tradeoffs

I am so excited for the future of the internet