# Can a Web2 frontend (hosted on AWS/Vercel) call ICP canister methods directly?

**URL:** <https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767>\
**Category:** Developers\
**Created:** [April 24, 2025, 8:55pm UTC](https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767 "2025-04-24T20:55:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![successaje](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/successaje/32/7924_2.png) [@successaje](https://forum.dfinity.org/u/successaje)\
**Post date:** [April 24, 2025, 8:55pm UTC](https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767/1 "2025-04-24T20:55:22Z")

</div>

Hi everyone,  
Can a Web2 frontend call canister methods **directly** (e.g., `backend.greet()` ) using `@dfinity/agent` , or do I need to expose them via `http_request` in the canister?

Follow-up questions  
1 Are there security risks with this setup?  
2. Do I need to whitelist my frontend domain in the canister?  
3. Any working examples of Web2 frontends + ICP backends?

---

<div class="post-metadata">

**Author:** ![0x4d5a](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0x4d5a/32/15654_2.png) [@0x4d5a](https://forum.dfinity.org/u/0x4d5a)\
**Post date:** [April 24, 2025, 10:59pm UTC](https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767/2 "2025-04-24T22:59:34Z")

</div>

Your Frontend can make calls directly to your exposed canister methods.

---

<div class="post-metadata">

**Author:** ![h1teshtr1path1](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/h1teshtr1path1/32/24662_2.png) [@h1teshtr1path1](https://forum.dfinity.org/u/h1teshtr1path1)\
**Post date:** [April 25, 2025, 1:47am UTC](https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767/3 "2025-04-25T01:47:36Z")

</div>

Hello @successaje , yes you can call canister endpoints without exposing them via http request using dfinity/agent.  
To do that, you create a canister actor agent using its IDL file, canister id and delegation of user (if its an authenticated call from any user otherwise not).

And then this canister actor agent instance can call any canister endpoint. You can see example of calling canister endpoint from a typescript frontend here [GitHub - BoomDAO/game-launcher: A platform for discovering games, deploying game builds to smart contract canisters, creating NFT & Token collections, airdrops, payments, in-game minting & burning, configuring World smart contracts and more.](https://github.com/BoomDAO/game-launcher)

---

<div class="post-metadata">

**Author:** ![successaje](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/successaje/32/7924_2.png) [@successaje](https://forum.dfinity.org/u/successaje)\
**Post date:** [April 29, 2025, 1:44am UTC](https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767/4 "2025-04-29T01:44:50Z")

</div>

Thanks a lot @h1teshtr1path1! That makes sense now. I’ll check out the BoomDAO repo you shared. Quick question: if I want to interact with multiple canisters from the same frontend, would I just initialize multiple actor instances with their respective IDLs? I cant help but think about handling both authenticated and unauthenticated calls. Maybe when i start to hit those bugs, i will get clarity.

---

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [May 5, 2025, 5:09am UTC](https://forum.dfinity.org/t/can-a-web2-frontend-hosted-on-aws-vercel-call-icp-canister-methods-directly/44767/5 "2025-05-05T05:09:09Z")

</div>

> **[GitHub - samlinux-development/ic-vercel-sveltekit-2](https://github.com/samlinux-development/ic-vercel-sveltekit-2)**
>
> Trage zur Entwicklung von samlinux-development/ic-vercel-sveltekit-2 bei, indem du ein Konto bei GitHub erstellst.
