# s5 update #4

*龴ↀ◡ↀ龴 qcast 龴ↀ◡ↀ龴*

By [deca12x](https://paragraph.com/@deca12x) · 2024-06-30

---

**\_tldr\_**

*   studied & revised a lot of concepts and tools: neynar, nextjs vs express, fetch api, postman vs swagger.
    
*   building toy version = cast from script, no frontend
    
*   [last update](https://paragraph.xyz/@deca12x/s5-update-3)
    

**\_toy version\_**

1\. project setup  
\- set up nextjs repo  
\- structure folders like this [https://nextjs.org/docs/getting-started/project-structure  
  
](https://nextjs.org/docs/getting-started/project-structure￼￼￼2)2\. write logic to connect signer, neynar api key, neynar client and post cast  
\- first read docs for posting a cast [https://docs.neynar.com/reference/post-cast](https://docs.neynar.com/reference/post-cast) then write all logic in one file neynar.ts but use these 2 github links as examples:  
\- main logic will be similar to this (search createcast) [https://github.com/builders-garden/pulse-api/blob/main/src/modules/farcaster/farcaster.service.ts  
\-](https://github.com/builders-garden/pulse-api/blob/main/src/modules/farcaster/farcaster.service.ts￼-) get neynar client from neynar api key [https://github.com/builders-garden/pulse-api/blob/main/src/utils/neynar.ts  
  
](https://github.com/builders-garden/pulse-api/blob/main/src/utils/neynar.ts￼￼3)3\. test the api call with postman  
\- study this about fetching apis [https://developer.mozilla.org/en-us/docs/web/api/fetch\_api/using\_fetch  
\-](https://developer.mozilla.org/en-us/docs/web/api/fetch_api/using_fetch￼-) set an endpoint and test with postman or swagger [https://nextjs.org/docs/pages/building-your-application/routing/api-routes  
localhost3000/api/qcast](https://nextjs.org/docs/pages/building-your-application/routing/api-routes￼localhost3000/api/qcast) ... this will call route.ts inside api/qcast  

**\_later\_**  
4\. endpoint accept calls only from my frontend  
\- to protect endpoint: create a x-secret in the .env  
\- pass to the api - in postman headers (or in frontend headers later) set it to be the same  
  
5\. in my frontend, only specific farcaster user can call api  
\- in page body, use neynar authentication so it gets the signeruuid from the fid  
authentication [https://docs.neynar.com/docs/how-to-let-users-connect-farcaster-accounts-with-write-access-for-free-using-sign-in-with-neynar-siwn](https://docs.neynar.com/docs/how-to-let-users-connect-farcaster-accounts-with-write-access-for-free-using-sign-in-with-neynar-siwn)

---

*Originally published on [deca12x](https://paragraph.com/@deca12x/s5-update-4)*
