[SOLVED] How do I deploy Dex?

Hi, I have successfully completed the new DEX tutorial and everything seems to be working fine locally in localhost, but I was just curious, how do I deploy the dapp successfully to netfily?

PS: Someone else may have asked this question in the forum, but it seems the thread was abandoned

Hi @W3CS

If you login to your netlify account you will find an option to connect to your github account. Select the project which you want to deploy from github and proceed with the deployment by adding the required .env variables.

You can find some youtube tutorials related to this.

Oh, ok. So it’s just the normal way I would deploy any other app? Thanks for the quick reply. I’ll give it a try shortly, and update if everything works smoothly.

1 Like

Yeah, its a normal deployment you might also have to select the frontend framework which you using(
mostly it is auto recognised)

Try checking any tutorial for deploying so you don’t miss anything.

1 Like

OK, so I tried to deploy the app on Netlify through GitHub options, and everything seemed fine on netlify, but when I go to the provided published URL, I get this error:

Page Not Found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

Back to our site

If this is your site, and you weren’t expecting a 404 for this path, please visit Netlify’s “page not found” support guide for troubleshooting tips.

I’m not sure where exactly things went wrong. Any ideas would be much appreciated.

OK, never mind, I just manually redeployed it the way I normally do, with npm run build, but now I got a different problem…

My swap inputs and swap button are disabled, even though my wallet is connected and I added my .EVN variables. When I hover over swap input to try to enter a number, the input field is completely disabled :arrow_upper_left::no_entry_sign:

Any idea what I could be doing wrong?

I would appreciate any pointers to help me fix this. Just a pointer would be helpful. Thank you

OMG! Please ignore my last message. I think I’m being a bit ridiculous, lol. I forgot to deploy my backend. And I forgot, Netlify doesn’t support node backend deployment. So I need to do that with Render or something else.

I will update the steps I took to resolve this issue to help others, if I get it working, and if I have the time!

2 Likes

OK, I got it working. As promised, I have added instructions below for anyone that might need

Here’s how to deploy your Web3 DEX from the Moralis Full Course Tutorial

  1. Push your completed code/project to GitHub (easiest way)

  2. Deploy backend first (dexBack). Go to render .com and create an account (You know what to do)

  3. Once you are logged in to your dashboard, go to the top right corner, click on “New +”… and select “Web Service”

  4. Now connect your GitHub account, find the repository for your DEX and click “Connect”

  5. Give your web service a unique name, and follow the rest in the image below:


  6. Scroll down and click the Advanced button and add your ENV variables (see image below):

  7. Click the Create Web Service button and wait…

  8. Once successfully deployed, copy the deployed URL (see image below):

  9. Now go back into your VSCode and paste this render URL in the async function fetchPrices… where you have const res = await axios.get(http://localhost:3001/tokenPrice, {

Replace only the “http://localhost:3001” with your url you copied from render, leaving everything else the same. So it will look something like this: ‘https://my-web3-dex-xhwn.onrender.com/tokenPrice

Save and push your changes to GitHub.

No more screenshots from here on, but follow along :woozy_face:

  1. Now, go to Netlify sites tab. Let’s deploy the frontend. Go to Add new site button >> Import an existing project >> Connect to GitHub >> Choose your repository from GitHub >> …

OK, one last screenshot (see image below for the rest)

Lastly, also very important BEFORE you hit “Deploy site”. Click the “Show advanced” button, and add the following Environment variables

Key = CI
Value = false

Now, you can click the deploy site and everything should be up and running smoothly.

Hope that helps!

PS: You can deploy your frontend on render .com as well instead of using Netlify, but I just chose to do it this way for now.

2 Likes

Hi @W3CS

Thanks for sharing.

Hey can you tell how to do it for the etherscan project? I did followed your steps and did everything and stuck at changing the deployed render url, where do i need to update that render link in my code? Do i need to change the port?

Hi @maheshbabu

Please create a new post and share the errors which you are seeing. Thank You

1 Like