Frog is a lightweight framework for building Farcaster frames that enables developers to create interactive web experiences with smart contract integration. The framework allows frames to display custom images, handle user interactions through buttons and text inputs, and execute transactions with any smart contract on Ethereum or Layer 2 networks. Frames can be hosted at specific API routes within a Next.js application, and developers can co-locate frames with their main website routes so that when users share a link, the frame renders automatically. The framework supports transaction buttons that connect users' wallets and execute smart contract functions like minting NFTs, with all wallet connections handled by the frame itself.
Building Farcaster Frames with Frog: A Developer's Tutorial
Added:today I'm going to walk you through how you can build your very own frame and not only just a normal frame for warcast but also a frame that can transact with any smart contract on ethereum or any layer 2 as well as a frame that can link out to whatever website you want it to link to um and you can make it so that individual websites that you build when shared on warcast will share a specific frame we're going to go over all of this and we're going to do it by learning a little bit about frog which is a light workk uh lightweight framework for foraster frames it's made by the guys at WM uh which also make VM and wagi hooks um sort of Industry standards for building out uh web 3 compatible websites now you probably already know that frames can help you to navigate through different sort of displays here by clicking these buttons at the bottom but what I was talking about before is a sort of newer feature to frames which allows you to interact with any smart contract directly from your warp cast feed right here I have a simple nft contract and you can mint it right from the feed like I was saying it handles all of the wallet connect and allows the user to connect their own wallet um so that they can interact with whatever smart contract you want to point them towards and in case you want to build your own website that can look like whatever you want and have it so that when your user shares a link to that website a specific frame that you've built shows up when it's shared on a warcast feed well we're also going to go over that as well here's an example on this custom front end I'll just open up this is a custom front end and when you share it on warcast it's going to render whatever frame you want in this case it's that snail Jazz one that I was just showing you now if you're following along it would be best if you already know a little bit about how to build a nextjs website and how to deploy that via vercel and that's going to be super helpful for how we're going to deploy our frame and Link it up to that website but anyways let's get started we're going to navigate to Frog's docks here and because I'm most familiar with nextjs and using that framework that's what we're going to go with today I'll go down here to platforms nextjs and they tell you that you can scaffold a frog project with nextjs integrated via the command line interface so I'm going to use mpm as my package manager so I'm going to copy and paste this into my terminal and we'll get that project set up so we're here in my visual studio code uh terminal we're just going to paste in this command and we'll run it and we'll walk through the steps here to name our project um we're going to call this learning frog how about that um and it's all set up so we're just going to um go into that directory see the learning frog and we're going to npm Ida npm install all of the requirements for frog and once that's installed then we can start uh setting up our Dev server so we can see both the website that we're building as well as the frame that's going to be hosted on that website okay perfect so now we have this learning frog directory in Visual Studio code and we can look look in here to sort of see the different folders inside of this directory um inside of app okay so here we have our page and this is where um we're going to have information about the actual website that we're building of course and under the API route that's specifically where all of the frame information is going to live um the stuff that's going to be sort of controlling what the frame looks like all those individual buttons and all those details just a couple of small setup things here we're going to go to the package.json file uh and we're going to to make a couple of changes to the scripts that you can see up there so that we can get access to our our development environment for the website while also getting access to our development environment for the frame um because frog comes with fantastic Dev tools that make the whole development process of frames super simple so we can run the script Dev to uh open up our our website but we also need to add a script in here to open up these developer tools so we're going to uh call this fr frog Dev and it will be um frog Dev perfect so we'll go back to our terminal and making sure that we're in that directory that we created for our project learning frog then we can spin up our two development uh environments so we'll go npm uh run Dev this is going to spin up the sort of next web page uh and then we'll open up another terminal window we'll get into that directory and then we'll go mpm run frog Dev and this is what's going to spin up those developer tools I was talking about so that we can actually see our frame in action as we build it so the next page is going to be defaulting to a local host 3000 I'm going to control click it to um open it up on my other browser window here we'll go to the other one this is going to be on Local Host Port 5173 and again I'm going to control click that and that's going to be our one that can sort of see our new frame so here we are on Local Host 3 3,000 this is our our next web page you can see something here that the uh developers of frog put into this um next template uh it says head to localhost 3000 API for your frame endpoint this is where uh the information uh for your actual frame is going to be hosted and that's in particularly important when we take a look at our developers tool our developer tools sort of page here and flip over here it says enter frame address in order to get all of this information about the frame that we're building the developer tools need need to know okay hey where am I actually looking for this Frame how do I bring that in to this developer environment so we luckily we know where to look we're going to copy and paste Local Host 3000 paste that in here making sure we have HTTP col and we're going to add API to the end of it because we know that's where our frame lives and I press go here and it should pop up with fantastic this is the developer environment where we can help U sort of see the frame that we're building let let's talk about some of the details here so obviously there's a lot of information here might be a little bit uh overwhelming at first but all you really need to take a look at at first is right here this is the representation of the frame and what we're seeing here is actually represented in the code of the um the the sort of repo that we scaffolded earlier and this is probably a good time to talk about an important concept for developing frames uh with frog and that's two sort of different items the first one is the image and the second one is the intense okay image that's a little bit self-explanatory that is referring to whatever is displayed here in the image section of the frame but intents maybe a little bit less uh self-explanatory uh the intents are basically all the different ways that a user can interact with your frame represented down here with the different buttons that they can click and the different sort of text inputs that they can do here um with this basic frame that they've uh built here as the default if you click a button uh it'll come and say okay nice choice you've selected apples um we're sort of getting that information from the users selections we can reset it you can enter a custom fruit here let's say uh pineapple beautiful and we'll click a random button here and it okay I got my information pineapple um so all that to say this is the image for the frame and these are the intents but now let's flip back to our IDE for me that's a visual studio code and we'll take a look at where this code is that's actually rendering this Frame and you can find that for for this example underneath this API and Roots um directory so we'll go here to uh root. TSX and this is what's going to bring up all the information about this specific frame that we were just playing with that Returns the sort of Apple selection and has that text input um all of that logic and all that information is simply in this only like 70 lines of code it's pretty easy once you get the hang of it and we're going to go over exact how you can build out your own logic and your own functionality in this Frame now in the Frog docs it says that frog is a framework built on top of hono um I'm going to be honest with you before playing around with frog didn't even know what hono was but it's okay CU you don't really need to know uh it's pretty self-explanatory once we get into the code so just thought I'd share that with you let's go over this root file and really find out what all this is doing we start off with some imports and then um some boiler plate for setting up this app um you can ort of copy the screen here or if you follow the the same way I set this up you're not going to have to sort of play around with this too much but when we scroll down a little bit more we get the first sort of aptop frame H what's going on here this is the first uh actual frame in the code and that's where image and intense that those two concept we were talking about before um this is where it comes into play you can see here that this Frame returns a response that includes an image a whole bunch of details about that image and if you scroll down a little a little bit more we see that it's also returning intense the image that's returned is what's going to display in that image section and the intents are going to be the buttons and the different inputs that the user can interact with for the frame for this image part you can provide that with a link to an image that you want to use in the frame that's one option but you can see the second option here that allows you to sort of use these jsx components here to put together um your own sort of design that you want to be output as the image uh and uh you're probably familiar with how this looks if you've built any kind of front-end websites before and in the intent section there are only two different types of intents um there's the text input that we saw as well as the buttons that you can click um the only thing here is that for buttons there are a bunch of different sort of subactions that those buttons can do that you indicate by sort of accessing a property of that button um sort of component here that button intent um for example we're going to be playing around in a little bit with button. transaction and that's going to sort of indicate hey this button is supposed to actually uh do some sort of a transaction action on a smart contract that we're going to identify another common button option is button. link and this allows you to indicate a sort of separate website that you want the frame to redirect the user to um it will just take a um an href property um with the sort of website that you want to um go to at song. camp for example and it'll send the user to that website when you click that button now just to make sure our development environment is working let's make some changes here and make sure that they're reflected in the development environment instead of entering your custom fruit let's say enter your favorite movie you got to love the the Canadian spelling of favorite there um we'll go with uh first um let's hit up uh The Godfather then we'll go um Star Wars and we'll go Barbie let's go ahead and change the value properties here um we'll make that match and do the same here for Star Wars and do the same here for Barbie and we'll save it now we'll go back to our Dev tools and we'll hit the refresh button and those changes should be reflected and they are boom we've got enter your favorite movie The God father Star Wars and Barbie now let's see if they work they they should because we changed those value properties um inside of the example we'll Click The Godfather beautiful it it shows up in the display here we'll reset it let's go uh Barbie okay that works too we'll reset it and we'll go Oppenheimer Let's test my spelling and then we'll click and boom that got passed as well to the intent or not the intent the image of the next frame but how does our front end know to display the selection that we've selected or that custom text well actually frog makes it pretty easy because they allow you to provide all the context of the user's actions on the previous frame for the new frame that's being rendered so you can use those inputs um in your display for the next frame let me show you what I'm talking about let's go back to our route. TSX file again that's inside of our API folder um inside of our project and take a closer look at EX how this works we can see here for the frame that we have that it's provided with the this sort of argument of C which is that context that a context object and inside of that object we can get a whole bunch of different values and you can see us grabbing them here the button value and the input text and the status these are all properties of the uh context or the C object that we can sort of destructure here to use them inside of our our rendering of our next frame uh however we want to when I first started coding this whole object destructuring thing was a little bit confusing for me but essentially these are all just different properties of the C object that you can sort of instantiate um through this syntax but you could you could uh access it in a different way too like if we wanted to take out button value here um you could also sort of create that by saying uh const um button value equals c. button value boom and that would do the exact same thing as sort of destructuring it here and here we're just creating a variable that we're going to be using later on when we're coding um our image for the the the frame that renders after the fact um here we say fruit well let's change that now because it's not actually a fruit anymore now it's a movie uh and it's saying that that movie is going to be equal to the input text that the user uh input or the button value again both of those coming from the context of the pre of the user's actions before this rendering of the frame so let's just scroll down here and change wherever it says fruit so um it now it says movie so that the frame continues to function um but yeah that gives you a better idea of the context that's passed to the frame um just telling you what the user previously did uh it also has status here um which is used to sort of um conditionally render the image here you can see that okay if the status equals response then we want it to look a a little bit different um than if the status isn't response let's head back to the dev tool so we can get a better uh grasp on this so we already know all about this part of the dev tools but there's another helpful sort of section and you can see that right down here let's zoom in for a closer look um we're specifically going to go to the context because this provides the sort of context that's used to render the frame conditionally based on these different actions the users have taken here in the context section we can see all the information that frog puts together to actually render the frame um so that clients like warcast can read it um when we scroll down here we see a couple of important ones we see all the different button indexes for the different things that people can click on the frame um different State uh and uh also in here if we scroll in here um we can see that one we were talking about before which was status or status and you can see it's initial right now instead of response um that's because we actually haven't made any sort of selections here on uh on this frame yet this is the initial frame which sort of corresponds like you just saw to this initial status now if we instead interact with this Frame now I'll scroll back up here for you um then that context is going to change and so will the rendering of the image and we'll click Star Wars Boom the context changed and now if we scroll back down U we can sort of see okay look the status now it's respond and by using that status property of the context object we're able to render out different things different buttons based on the sort of type of frame that we're seeing right now so all of this Logic for the entire frame is inside of this app doopf frame um uh creation here uh and you can see that even when the user interacts with it by clicking the buttons and inputting text well it sort of um renders the same frame again just with a different context and using that different context you're able to have a different image and um different selections for the intents down here but what if we have different combinations of images and intents that we sort of want to switch between um for the user as they're using this one sort of a master frame that we've created they they've made that super easy to do with frog let me show you what I'm talking about because you can make it so if you click a certain button it goes to an entirely different frame uh that has different images and different intents as well I think it's going to make a lot more sense once you see what I'm talking about to make this example clearer let's clean all this stuff up we're going to take away all of the different styling of this div as well as this div uh we're going to close that up as well and we're going to um so even even take this out so just this Frame will um just return the uh the one div and we're going to say this is our first frame we'll clean up some of the intense as well um take out a lot of this stuff we're just going to only use one button to make this example super clear take out the text uh button here or the text input and we're just going to have one button and that button is going to say uh go to the next frame and because we're not using any of this we actually don't need any of the context anymore so we're going to back that out as well and here we have like the simplest representation of a frame and how you build it in frog we've got our image and we've got our intents now in the exact same route file we can copy and paste this and make a sort of second frame inside of our Master frame let me show you what I'm talking about we'll paste this in and now we have a uh a a new frame here and we're going to say this is slash second and that's going to be the path to our new frame so let's make these edits here this is our second frame um and uh we'll just leave go to the next frame there so we've got the only difference between these two frames right now is this is our first frame and this is our second frame now how do we make it so that when you click on this button it will actually take you to the next frame at the SLC route well we can do this by specifying something called an action in our first frame you know how I only said there was image in intense well there there's another one here in the response that we can include and that is an action boom U now for this action this is just telling uh the frame where the next sort of post request should be what frame should we be rendering next after you make a certain action on this first frame so we have this path down here that's SLC so that's what we're going to put here in this action and we're going to go slash second put our comma in so it uh looks all good now when we uh when we make that uh update and when we save this and go back to our Dev tools and click the button go to next frame it will know to go to this second route here um this action property is set to Second so it knows hey go to this other frame and render that one oh and you know how I said we didn't need all of that styling for this div in order to actually make this text show up in the dev tools I realized you kind of have to have the styling in there um just to tell the text how to render so we're going to put that back in there and now let's go take a look at our frame in the dev tools okay so once we refresh this just as we wanted it's going to show that new text this is our first frame and we've got go to the next frame as our button here one extra thing to note here take a look at the route remember that initial frame was hosted at Local Host 3000 API that's that first frame now when we click this go to next frame button that's route is going to change and it's going to show slash second uh like the name for that second frame that we made the the route path um so let's let's give that a try and hopefully that works we'll click go to next frame boom this is our second frame shows up and you can see okay this Frame and all of the information about it even though it's in that same route file um is actually hosted at a different location API SLC the name that we gave it okay let's play around with a different button option um we've got that standard button and it uh doesn't have any value right now because we're not using that for any context in another frame but like let's say we wanted to add another button here and let's add button. link this is what we're going to use in order to link a user to a different web page right so we'll close that off and U we'll say go to the video and you'll see it's saying uh the property HF is missing uh in this type so we're going to add that property HF equals and then a link to some web page I've got a YouTube video here we're going to put it in there um if you can see the end of that link act like you didn't so now we've got the um go to the next frame button and we've got that button. link it's should again if I haven't screwed this up uh take us to a new website and when we refresh it we see that new intend to this next link button you can see it indicates that with this sort of link out icon in the dev tools super helpful and when we click it it should give us a warning hey you're leaving warcaster you're you're leaving where you currently are we'll accept that um and we'll click continue and then it'll open up the link to whatever we wanted to open which I had to do it to you I'm sorry maybe this is a a boomer meme now at this point but it never gets old for me now while you're building even if your Frame Works in Dev tools it's pretty important to actually test if it's going to work on warp Caster uh proper and the only way to do that is if you deploy your uh your application your web page so that you can uh link the actual hosted web page p on warcaster and see if it renders correctly now I mentioned earlier that it would be helpful if you know already how to deploy an application on versell and that's what we're going to do right here I'm not going to explain it too thoroughly um but we're deploying our application to versel uh and so that we have an actual production uh web page that we can link in when we're actually validating that our frame is going to work on Warp cter for so I'm going to go back to my terminal going to go uh get nit uh initialize that and then we'll go use the GitHub uh command line and go GitHub repo create um follow these uh we're going to push our local repository to GitHub um this is the path learning frog is perfect um we'll make the description um we're learning how to make frames with frog beautiful we'll make this one public um and we'll add a remote and we'll call that remote origin fantastic now we can um go get add all um get commit um first commit perfect uh let me slide this up actually so you can see the final stuff and then we'll go get push set Upstream origin master and that will push all of our changes to this repo so that we can deploy it via versel we'll head to our versel dashboard add a new project we'll um add this newly created repo that learning frog import that all good all good deploy and now once that deployed it's going to give us an actual um uh web page that we can take the uh URL from and and check it on a special frame validator that's specific to warp cast and while that's deploying let's navigate there now you can see here in the bottom left hand corner of our Dev tools we've got um the Frog documentation which we've looked at and there's the GitHub repo but we're going to look at warp cast frame validator this is just going to make sure that our frame actually works on warp cast um just make sure that there's no problems with the dev tools um and that it is actually comparing properly to how it's going to look on warcast so we'll open that up and it'll take us here and it's going to ask us for uh a URL where that frame is hosted now we can't use Local Host um on this like we can with Dev tools so we're going to take that uh domain from versell that has just sort of been um just spun up we're going to add SL API to it remember because that's where it's actually hosted uh and then we should be all guda and boom our project is deployed so we're going to go to it we're going to take that U that URL learning dfrg dovel doapp we'll copy that and let's head back to this um where was it to the uh the frame validator of on warp cast um that we got to through our Dev tools I'm going to paste that in remember we're going to add API and when I hit refresh here hopefully we're going to see that frame and hopefully it's going to work and come on let's go this is our first frame we got go to our next frame we got our rck roll button here on go to the video we got go to the next frame boom this is our second frame it's got all of the proper information that we were looking for we've got a functioning frame and now if we were to post that on warcast it would be in our feed and we can even double check that I'll copy this and let's go actually over to a warp cast client here here I am here's my account follow me at Russ I only have like 10 followers 15 followers so hit me up there I I would appreciate it um but we'll go here and we'll go cast and then if we paste in that route then it'll recognize that this is our frame we can't play around with it in this sort of post but we can post the frame by just um dropping in that URL to the cast that we're about to put out there so already just with that you can see you can get pretty creative with these frames you can render anything as an image you can play around with those intents um just with redirecting and and sending to different frames and having different things pop up you can get really creative with it but um i' I'd say around with it a little bit but we're going to go on this is kind of like a part two an extra bonus content here because we're going to get into how you can actually execute a smart contract function right from a frame um this is the sort of Next Level maybe uh frames 102 for you as some of the little prerequisites for this one it would be helpful if you already know how to deploy a smart contract um we're going to use a simple 1155 nft contract we're going to deploy that we're going to take the ABI from that contract and we're going to use that to actually tell our frame hey what function do we want to call on this smart contract again we're not going to go super into depth in that we're going to go more into depth on how you can actually link up this contract by using the ABI and the contract address um to your frame so we're back in our same uh route. TSX file and we already know that you can have different frames hosted at different routes here and that they're indicated um what their names are uh right here now you can also have um individual not frames at a different route but a action at a different route in this case a transaction at a different route let me show you what I'm talking about um just like we would create a new frame uh by sort of copying and pasting this there's a different type here that I'm going to paste in you can find um some of these details at the uh or on the Frog docs under transactions um but you can see here if we go app. transaction well then we can actually host a transaction at a given route and just like a frame this transaction can take any of the users values that they've inputed uh through this context um and you can sort of deconstruct them to get access to them to to use inside of this response or this return that's coming from this transaction right here is where you include all of the information about um the smart contract that you're interacting with um the name of the function on that smart contract that you want to call as well as the contract address and the ABI let's go through these one by one so first you need to provide the ABI for the contract that we're going to be uh um interacting with I'm going to do that via creating a different file here let me slide this over so you can see um where I'm creating it I'm going to create it in this sort of same API SL routes folder and we'll go new file I'm going to name this api.js and I've got um the ABI sort of copied from the contract that I've uh written and deployed we're going to go export con ABI equals and then we'll paste that ABI um again you can get this uh either from uh your from whatever tool that you're using to deploy these smart contracts be it hard hat Foundry or maybe remix ethereum if you're using the sort of a uh web IDE so we'll go back to our route. TSX file and now we got to uh import that ABI so we can actually use it um inside of this transaction so we'll go back up here to our Imports and I'll go import ABI from.
slab. JS boom and now we should have access now that we've imported it to that ABI constant that we defined in our ABI file over here um so we're going to be able to use that and we don't have to mess up our route. TSX file and have the whole ABI there we'll just import it um beautiful that solved the error and now we've provided the ABI for our contract um The Next Step here is providing the chain ID uh using EIP 155 we can sort of just Define the ID so that um we we know what chain we're interacting on um like ethereum mainnet is chain ID one uh we have different uh different IDs for different layer twos um but so you can find that chain ID by just you can honestly just Google search um like optimism chain ID or uh or or what have you for us we're going to use uh the base aolia of test net here which is chain ID 84532 next up a little bit self-explanatory we we have a function name this is the name of the function that as it's represented in your smart contract again we're not going over how to deploy a smart contract how to write it that type of stuff outside of the scope of this video but I'll just give you a sample here I brought in this solidity file that I wrote and this is the contract we're interacting with super simple uh ERC 1155 token and you can see here we've got a function mint and that's the function that we're going to be calling it doesn't take any arguments you don't have to pay anything for it um it just mints uh one token to whoever uh calls the function um so we're not going to need to provide any arguments up to this function from within our frame and finally for our example we've got this uh two property and that is just where you define uh the the contract address wherever your contract was deployed what its address is so that we know hey what smart contract are we interacting with now there are a couple of other properties here that we can use um one that I said we're not going to need to use as args you can do um any arguments that you need to pass to the contract that you need to interact with um you can also uh do a value uh property here um that's just whatever amount of ether that you might want to sort of send um along with this transaction if it's a payable uh function um so you can use those as well but for our example we don't need them because there aren't any arguments you don't have to send any uh any funds to this function in order to me you just got to pck gas okay so now we have all the information for our transaction here but how do we actually trigger it um from our frame well it has to do with that button do transaction option that that button has right so we're going to go back up here we've got the button go to the next frame as you can see we've got the uh go to video the sort of redirect the link um button let's add another one here we've got button.
transaction and um that's what we're going to use uh to Mint uh mint the nft okay so we need a property called Target um this is just saying okay where am I actually going to get the information for this transaction you can see here maybe you couldn't maybe was behind me before a property Target is missing so that Target is just saying okay what is the route just like this frame has a route what is the route of the transaction and we Define that down here um in the same location and that's right here SL mint so we need to add that Target um easy we'll just add it because we know exactly what R we need and the target is/ mint so when we click this button it's going to go to this transaction um take all of the and it's going to provide our frame with all of this information about the contract and what function we're calling on it uh and all those details what chain we're calling it on uh with the chain ID so let's head over to Dev tools and see if that worked okay beautiful we refreshed it and we're seeing seeing everything we expect to see the two buttons the two intents that we had before on the Rick Roll video uh redirect link and now we have this new intent this transaction button it says mint the nft just like we thought and it indicates that it's a transaction with this little lightning bolt icon so let's see what happens when we click it uh let me zoom in here a little bit so maybe you can see more clearly I'll click mint the nft I'll slide this up uh so you have a better view of it and you can see okay now we can connect wallet the user brings their own wallet to transact it's not like an embedded wallet or anything like that and you can connect any of these uh wallets um that are sort of installed on your machine um so for me I'm going to connect my metamask this is going to pop up and I'm going to go to this first account here that has some sapoia eth on base we'll go next and connect boom I'm connected now when we go M the nft we see review transaction it shows the proper address that we indicated in our SL mint uh transaction route that we set up the proper chain through EIP 155 um the contract oh sorry this is the address that's connected rather uh and then the contract address uh that we indicated and the name of the function and now all we need to do is click Send transaction check wallet I'm going to sign this boom bo boom let's go metamask confirm trans transaction pending that'll just be baked into your frame and transaction confirmed it already has a pre-populated view button let's see what happens when we click it I'm going to click view I'm thinking it's going to oh yeah beautiful there's a base scan let me actually bring it in here so you can see it and we'll zoom in a little bit success we minted this nft from this contract uh awesome let's go take a look at it usually in testnet nfts like this show up fastest on rable so let's go over and look at that for this address and see if we actually minted anything so I went to rare's test net and you can see here it is popped up this is actually an audio nft um that can play some music and we got this picture this nice snail listening to his iPod Shuffle um yeah so it minted and there's your transaction happening right from the frame and if you deploy that then you can sort of validate it in that warp cast validator to make sure it'll actually work in the feed um and there you go you can mint directly from the warcast feed I think that's pretty cool all right let's take things just one step further I promise this is the last one you're not going to listen to me ramble for any longer than this uh right now what if you want to have a a different website um something that has any kind of functionality that you want do anything on it on the front end um and you wanted to share that link or have when users share that link to that website have that populate as a specific frame have a frame served at a specific website like right now it's it's not the best uh the way we have it set up so far let me show you what I'm talking about you'll remember that when we first started this video we had this sort of uh nextjs boilerplate front end set up let's just imagine that this uh boilerplate front end was something custom that you put together um something that you actually uh wanted um users to use uh and let's say that this web page goes viral and you have people talking about it on uh warcast and you want them to be able to share it so they they go to their browser bar they're going to copy that they're going to go over to uh warp cast um like we are right here they're going to try to cast it and they're going to paste it and then huh my frame's not there even though this is where my frame is hosted how come it's just a normal embed here like what's going on well you might remember that the frame actually lives at the API route of this page so if we went API here and we uh sort of repasted it in boom okay there's our frame but we don't really want our users to have to append that SL API route to the web page that we're sharing right like when they're on the browser they're just going they're just on this learning frog versell do apppp uh we don't want we want them to just be able to share that directly and not have to tell them to add/ API now luckily there's a way that you can take all of the frame information that's hosted at SL API and get your base route this this without this slash get that base route to actually serve up the frame exactly how you want it so that when users share it it actually uh defaults to that frame let me show you how to get that set up so we'll go back to our learning frog project and in the folder for it right here and you'll remember that okay we know that API and everything under here that's where all the frame information is but the actual web page that's hosted at that that at that base route uh is all inside this page. TSX file you'll be familiar with this um if you're familiar with the op router for nextjs so let's go take a look at this page. TSX and that's where we're going to see let me slide this over all of this uh boiler plate information about this uh this next page remember this I'll show you over here again uh this sort of next page in our development server that we've got set up um this is where all of this is so let's uh just get rid of all that we don't want that next boiler play Let's just um add some text in here saying um this is the web page I want to share my frame from actually we be a little more description than that just descriptive uh what it actually is is we want to uh co-locate my frame at this page route so that when the user shares it it populates the frame and when we check out our web page okay now all that next boiler plate is gone and we've got this text that that we've inputed fantastic but that isn't going to solve our problem yet now what's really going to solve our problem is up here in this generate metadata um this will already be set up for you if you scaffolded this project um using that uh that command from frog that set up our next application if you've been following along you should be set up like that um but we use this generate metadata function to actually grab all of the metadata of the frame from that API route so we can serve it up here now they've got some stuff in here that that makes it easier to go between production and in your development environment we're going to skip over this for now I'm just to keep things simple we're going to get rid of that and all you need to do is paste in the uh URL that your uh that your frame is hosted at uh so for us we deployed that at learning dfrg forell doapp and remember where the frame is actually hosted is SL API so that's going to be in there too now we just save this we're going to go back to Dev tools and we're we're going to check that if even at localhost SL nothing not/ API if it's serving up the frame as we want it to so we're back at our Dev tools and now up here at localhost 3000 API this is where it has previously been served and it's still being served but now that we've got that generate metadata function on our uh our next uh page uh our next JS page that is hosting our front endend well that page should also serve up this very same thing cuz we're grabbing the metadata from the/ API route so let's go in there and remove that API and when we uh navigate to it it should load the exact same thing boom there's our frame Local Host 3000 there's no/ API that means that once I deploy this with the changes that all we need to do is uh is copy and paste in to warcast the the base route for our website or our users could do that and it should render this Frame uh even though when users navigate to this route they're going to get whatever web page you build okay so I've uh pushed those updates and deployed them on verell um so now when we go back to this frame validator on warcast we can check to make sure this is all working this is where it was before right at the SL API route I'm going to refresh that that should work okay beautiful now let's get rid of that and just paste in without the API route just like a user would uh if they're trying to share your applic and we click refresh and just as we expected we've got our frame working up here in functional our rec roll function our go to next frame all this stuff is working just as we expected it to and as one last test we'll actually do it in the cast button on warp cast we'll go in here we'll paste it in without the API uh route appended to it and we've got our frame ready to post that means that you could have any kind of front end any functionality that you wanted hosted there and it would serve up whatever frame you specified in that generate metadata function when a user shares it on a frames compatible platform I hope all of this has been helpful for you I know that going through the process of making this video has been helpful for me and solidifying some of the concepts in my own mind um so happy frame building I hope you uh I hope you have some fun with that and have some fun using frog it's a a great set of tools here uh and something that I know is going to be supported going into the future given that it's coming from the the wagi and the VM guys uh and those those folks always build incredible developer tools so I'm I'm pumped to keep using it um and if you haven't already done so follow me over on warcast again we got to get this number up from 15 followers I've been slacking slacking hard so follow me if you have any questions hit me up over there uh but with all that said hope this video has been helpful and I'll see you next time
Up Next

Lens Protocol 101: Building Fullstack Social Apps with Digital Identity
@encodeclub
1.4K views•2023-09-14

Minting NFTs Inside Farcaster Frames: A Technical Tutorial
@pinatacloud
4.1K views•2024-02-16

Operational Security Essentials: A Guide for Hacktivists (OPSEC)
@hitbsecconf
157.4K views•2012-11-26

Understanding Ethereum: A Comprehensive Beginner's Overview
@99Bitcoins
3.1M views•2018-06-26
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Blockchain & Crypto

















![¿Desafío para novatos? Simple Poke API [ Card + Fetch + DOM + Template HTML ]](https://i.ytimg.com/vi/ydcm7GECaAI/maxresdefault.jpg)














![TON Smart Contracts | 10 | Telegram dapp [EN]](https://i.ytimg.com/vi/D6t3eZPdgAU/maxresdefault.jpg)
