How to deploy MERN applications 🚨 (Heroku and Atlas)

Поділитися
Вставка
  • Опубліковано 3 жов 2024

КОМЕНТАРІ • 102

  • @the_full_stack_junkie
    @the_full_stack_junkie  3 роки тому +6

    Hope you enjoyed the video!😎
    Discord Link: discord.gg/JUHQpUh

  • @praveennair2119
    @praveennair2119 2 роки тому +1

    After 5 sleepless days of different trial, now my First MERN site gone live in heroku. Your video is perfectly working for me. Thanks a lot for uploading this video....

  • @_devParty
    @_devParty 2 роки тому +1

    Thanks so much for this beautiful work.

  • @CB-dp7sq
    @CB-dp7sq Рік тому

    Yes, definitely leave errors (and of course fix them up haha). Running into blockers and errors is part of the process and it's always helpful to see how others debug and find solutions.
    I went through the documentation and tried myself before watching this video. I was close but not quite, so it was really helpful to get a walkthrough on exactly how to do this as well as the explanations and examples. Thanks very much!

  • @giibbu
    @giibbu 2 роки тому +6

    Great tutorial! One issue I ran into: if your server also serves as a backend handling requests from the react app, it is import that the handler in line 18 of the server.js file be app.get('/', ... as opposed to app.get('*' ... This way it will still be able to send appropriate responses to specified endpoints.

    • @kolis706
      @kolis706 2 роки тому +1

      Incredible!!!

    • @hadassah001
      @hadassah001 2 роки тому +1

      Thank you so much for this tip ♡.

  • @parneetraghuvanshi8697
    @parneetraghuvanshi8697 3 роки тому +3

    Extremely Profitable Tutorial Bro

  • @shakil-the-coding-monster
    @shakil-the-coding-monster 2 роки тому +1

    Awesome tutorial. I spend a lot of time to deploy but failed to figure out where is the problem. But your tutorial fullfilled my reqirement. It forced me to thumbs up. Want more turtoril. Thank you so much.

  • @raphsan4694
    @raphsan4694 3 роки тому +2

    No video could have done a better job than this video, thank you, and more of these videos.

  • @raviya1444
    @raviya1444 2 роки тому +1

    good job bro awesome work

  • @markeem321
    @markeem321 3 роки тому +1

    Super cooool!!! I've created ur MERN + Redux project and pushed it now to Heroku. I'm so happy :) . Unfortunately, I must delete the backend folder instance, hope I can find a solution for that.
    You do an excellent job. Thank you!!!

  • @ashish_prajapati_tr
    @ashish_prajapati_tr 2 роки тому +2

    amazing.

  • @chaos299909
    @chaos299909 3 роки тому +1

    Great tutorial, I really liked the fact that you went into the "why" along with the "how". Subscribed!

  • @syedamahamfahim
    @syedamahamfahim 2 роки тому +1

    Thank you so much ☺

  • @KnowledgeRoad35
    @KnowledgeRoad35 3 роки тому +2

    Very nice explanation, Thank you so much you did really great help..

  • @olavictor6527
    @olavictor6527 2 роки тому +1

    Thanks a lot boss.

  • @himanshupatil8051
    @himanshupatil8051 3 роки тому +1

    You made this so easy to understand for beginners...i love the way you explain things and i liked the concept of showing the process of solving the errors also it helps.thank you so much

  • @andrewbrower4158
    @andrewbrower4158 3 роки тому +2

    Phenomenal tutorial. Thank you for providing such a clear, easy-to-follow process that actually provides learning and not just a how-to for a single situation. Will definitely be following your future videos

  • @lucianochiarelli4398
    @lucianochiarelli4398 3 роки тому +1

    Your explanations were really accurate yet easy to follow, definitly leave the errors, its helpful to see them being debugged. I would tipically deploy the backend to heroku and the frontend to netlify, so your aproach was really interesting to me, good work!

  • @rishengopaldass1103
    @rishengopaldass1103 2 роки тому

    Great Job. Thank you.

  • @maciejtomaszewicz1214
    @maciejtomaszewicz1214 2 роки тому +1

    THX! It works! :D

  • @mahendranath2504
    @mahendranath2504 3 роки тому +2

    Thank you so much I like your videos, as a full-stack I like your video I'm using it as a future reference

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      Thank man hope to keep making videos and keep learning more and more💪🤓

    • @mahendranath2504
      @mahendranath2504 3 роки тому +1

      @@the_full_stack_junkie Thank you so much for your reply , sure i will never stop learning

  • @meisammofidi13
    @meisammofidi13 2 роки тому +1

    Well done!

  • @MrKrzysztof13
    @MrKrzysztof13 3 роки тому +1

    omg thank you, honestly!!!!!!!!!!

  • @anilshresthaa8174
    @anilshresthaa8174 3 роки тому +1

    Awesome!!! Thanks.

  • @junjieyang7800
    @junjieyang7800 2 роки тому

    Thank you!

  • @syrineferjani8406
    @syrineferjani8406 3 роки тому +1

    awesome video
    thnx a looooot

  • @jashan0924
    @jashan0924 3 роки тому +1

    allow for everyone option is not showing up

  • @jobtadele9427
    @jobtadele9427 2 роки тому

    this is really a great video but am in a very headache situation,the problem is when i tried to check if my react app run in a production build ,the errors pop out saying "TypeError: path must be absolute or specify root to res.sendFile" pls help me out guys??

  • @bishnudas3562
    @bishnudas3562 3 роки тому +1

    hello sir, sometimes the client and server are created on diffrent folders, in that case how to deploy it?

  • @omkarkulkarni3644
    @omkarkulkarni3644 3 роки тому +1

    Solid video! is a tutorial on SQL with prisma/typeOrm on the cards ?

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      Glad you liked it and sorry not at the moment trying to focus solidly only on MERN

    • @omkarkulkarni3644
      @omkarkulkarni3644 3 роки тому +1

      @@the_full_stack_junkie Alright :D no problem

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      @@omkarkulkarni3644 sorry man I myself am learning as i go don't want to split my work to much

  • @mazorsharp
    @mazorsharp 3 роки тому +1

    I did your MERN e-commerce tutorial and I'm currently uploading it to heroku following this tutorial. I just deployed the app but I'm receiving a 503 error. Any suggestions on what I need to fix it? cheers

  • @salik619
    @salik619 3 роки тому +2

    Apparently this method does not work well when there are dev dependancies in your project. The only way to make it work would be shifting all you devDependancies to dependancies. Please show us a method to deploy if there are devDependancies in your project. Thank you !

  • @willpickering5829
    @willpickering5829 3 роки тому +1

    What if your backend is more than one file? do you put the client folder into the backend folder?

  • @biojk83
    @biojk83 2 роки тому

    Does anyone know why axios returns instead of JSON?

  • @libertydaniel6366
    @libertydaniel6366 3 роки тому

    Anyone know why my build folder is displaying a blank page in browser when I server it on an express server

  • @Vlad-us9xt
    @Vlad-us9xt 3 роки тому +1

    top

  • @venkatesh2788
    @venkatesh2788 3 роки тому

    Sir i know to create ecommerce website with react js, please tell how to connect with ( shiprocket ) or any other postal Service.

  • @lielinamulugeta7193
    @lielinamulugeta7193 3 роки тому

    can we deploy MERN application in a local area network? among different computers which have to be synced when the internet is not avalible

  • @mahmoud6858
    @mahmoud6858 2 роки тому

    may the folder structure affect the deploymemt process? I mean what if we have clinet folder and backend folder seperate, and not the backend as the root folder and client folder in it as ti is in this tutorial.

  • @chimagodspower1289
    @chimagodspower1289 3 роки тому

    Am not using Mongodb atlas, can I also deploy it from my locally installed mongogb

  • @milindujjawal7921
    @milindujjawal7921 2 роки тому

    const __dirname = path.resolve();
    for reference error in server.js file

  • @gauravmazumdar9965
    @gauravmazumdar9965 3 роки тому

    Where u put base URL to fetch post?

  • @venkatesh2788
    @venkatesh2788 3 роки тому

    Please make mern filtering and any video streaming app

  • @supercrunch3367
    @supercrunch3367 3 роки тому

    ! [remote rejected] master -> master (pre-receive hook declined) HELP

  • @kerrypierre-lys5687
    @kerrypierre-lys5687 3 роки тому

    This video was much needed! I was able to get my project deployed but my data is not showing up unless my server is running in the backend and that is after the deployment to heroku. the error I'm getting is: Failed to load resource: net::ERR_CONNECTION_REFUSED. I'm not sure why the database I'm pointing to is not running unless I run it in the terminal. please help! Thanks in advance

    • @kerrypierre-lys5687
      @kerrypierre-lys5687 3 роки тому

      also I'm using a proxy in my frontend package.json to help me send request to my backend

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      Make sure you add you IP address or alloe from anywhere when setting up mongodb cluster.
      And check if you added the password to te connection string you will see a space to enter it

  • @brainyexpert8221
    @brainyexpert8221 3 роки тому

    when i run this node utils/importData.js --import i am having this ERROR 💥: MongooseError: Operation `posts.insertOne()` buffering timed out after 10000ms

  • @kevgits
    @kevgits 3 роки тому +1

    Apparently, you can't use "__dirname" if you are using the ECMAScript module import syntax. Who else has experienced this. It gives you an error: __dirname is not defined. Still trying to figure out how to go about it.

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      To get past this do the following:
      import path from 'path'
      .
      .
      const __dirname = path.resolve( );
      Hope it helps🤘

    • @kevgits
      @kevgits 3 роки тому +2

      @@the_full_stack_junkie Thanks a lot. This worked to fix the mentioned error. Unfortunately, I encountered another one while pushing to heroku:
      remote: npm ERR! code ENOENT
      remote: npm ERR! syscall open
      remote: npm ERR! path /tmp/build_83dc69a8/client/package.json
      remote: npm ERR! errno -2
      remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_83dc69a8/client/package.json'
      remote: npm ERR! enoent This is related to npm not being able to find a file.
      remote: npm ERR! enoent
      I suspect it's from the Serve React snippet. Here is what it looks like:
      if (process.env.NODE_ENV === "production") {
      const __dirname = path.resolve();
      app.use(express.static(path.join(__dirname, '/client/build')));
      app.get('*', (req, res) => {
      res.sendFile(path.join(__dirname, 'client', 'build', 'index.html'));
      })
      } else {
      app.get('/', (req, res) => {
      res.send('API running');
      })
      }
      Ps: My folder structure is slightly different from yours, the client and server are in two separate folders. I have tried "../client" but I get the same error.

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      Try to run this setup locally where you just set the NODE_ENV to production in .env file.
      Then check if you get any error when trying this. I think you will get a better error response as to what is wrong with this startup process, "some file is not being found apparently", so if it runs smoothly on your local env with NODE ENV set to production then there is something else wrong but this way we can narrow down the search

    • @kevgits
      @kevgits 3 роки тому

      @@the_full_stack_junkie This is the error I'm getting when I try to access localhost:5000 with NODE_ENV = production:
      Error: ENOENT: no such file or directory, stat 'E:\P2P System Project\server\client\build\index.html'

    • @kevgits
      @kevgits 3 роки тому

      I think I have seen the issue. It's with the path. My client folder is not within the server folder. It's under the "System Project" folder.
      From this line: app.use(express.static(path.join(__dirname, '/client/build'))); how can I reference that? I tried "../client/build" to go a level back but it didn't work.

  • @venkatesh2788
    @venkatesh2788 3 роки тому +1

    Sir, how to upload videos in node js, is efficient in storing videos in mongo db,

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      No i would definitively not recommend saving static files like images,video, and files in the database. Rather store it in something like AWS S3 buckets

    • @venkatesh2788
      @venkatesh2788 3 роки тому +1

      @@the_full_stack_junkie thank u sir, I going to read AWS

  • @parikshitrawat8680
    @parikshitrawat8680 3 роки тому +1

    My project has seperate folders for client and server. I want my github repo to contain these 2 folders so i use git init inside this main folder(which contains client and server folders)
    But for deploying back-end to heroku i'll have to use git init inside server directory which means i'll be creating a new repo inside another repo. Can it cause any problems?
    What could be a better approach for deploying back-end from such repo(which contains seperate folders for client and server)?

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      Don't believe so i think anyways everytime you run git add .
      it does both directories anyways

    • @parikshitrawat8680
      @parikshitrawat8680 3 роки тому +1

      @@the_full_stack_junkie thanks for your response. Is it usually preferred to have a folder structure like the example you had in video instead of having contents of client and server in sibling directories?

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      Hey man like i would not be able to tell you whether is is used by big companies as I have learned to do it this way and seen many blog posts and courses outline it like this as well and I currently use this structure in my freelancing projects.

    • @parikshitrawat8680
      @parikshitrawat8680 3 роки тому +1

      @@the_full_stack_junkie got it. Really appreciate your help.

  • @AndyChamberlainMusic
    @AndyChamberlainMusic 3 роки тому

    why did mongodb allow access from your server? You never whitelisted the IP of the heroku app

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      You are right i never whitlisted IP for heroku during this tutorial I belief I gave access from anywhere.

    • @AndyChamberlainMusic
      @AndyChamberlainMusic 3 роки тому

      @@the_full_stack_junkie I thought that wasnt possible? Can you still allow from anywhere on Atlas today?

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      @@AndyChamberlainMusic Hey man so I went and checked out my mongodb atlas dashboard and I did see that the button to give access from anywhere is not there anymore, but you are still able to add this as any IP address range IP address for anywhere: 0.0.0.0/0. Maby try using that and let me know else you will need to add your server ip as whitelist

  • @divinehuman2732
    @divinehuman2732 3 роки тому

    and if the demo time ends the application will not work ( heroku )

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      Heroku has n paid tier that is 7dollars per month that allows you to ensure that the application never sleeps

  • @lewiswardita9902
    @lewiswardita9902 3 роки тому +1

    WE WANT MORE DEVOPS. DIGITAL OCEAN ETC AND GIT

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому +1

      Will do champ next video will show you how my deployment workflow works with git, github and linux server

  • @samuelsulo3782
    @samuelsulo3782 3 роки тому +2

    It will load the frontend if the website is accessed using the baseURL
    for example "www.example.com" will load the frontend but if I type any specific path
    for example typing "www.example.com/post" it won't redirect to the posts page, any fixes?

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 роки тому

      Hey man so the only solution I can think of from this comment is that you should make sure that your piece of middleware we code on around the 19:45 mark doesn't have the correct route value or you never added the NODE_ENV=production variable to your Heroku app. This route value should be a '*' as this allows you to access the site from any endpoint of the domain. Hope this helps.

    • @junjieyang7800
      @junjieyang7800 2 роки тому

      Hi, Samuel, so I am encountering the same problem. Have you gotten the fix?