N
Nuxt3mo ago
VanishDark

project with MongoDB

Hello guys I’m recently new using Nuxt. And I’m having a hard time to deploy an app that uses mongo driver to connect to my mongodb. I read about it and I understand that is not possible without realmjs to deploy to cloudflare. Since realmjs is deprecated now I’m looking for a different solution to deploy my app. I have access to a was account. What do you suggest do deploy my application. I took a look in nuxt documentation but I’m confused which option should I use here. Thanks in advance for the help!
8 Replies
IceMeltAll
IceMeltAll3mo ago
Hi. Hope you find the answers you need. May I ask if you're using any module like mongoose or nuxt-mongoose?
VanishDark
VanishDarkOP3mo ago
Hi. I'm using mongodb driver. no module
IceMeltAll
IceMeltAll3mo ago
On the mongodb website they have two different courses. One for mongoose, which still is useless because nuxt recommends nuxt-mongoose which is set up differently (https://learn.mongodb.com/learn/course/mongoose-odm-with-mongodb/learning-byte/learn?client=customer&page=1) and one for standard mongo driver using Node.js. https://learn.mongodb.com/learn/course/connecting-to-mongodb-in-nodejs/lesson-3-troubleshooting-a-mongodb-connection-in-nodejs-applications/learn?client=customer This last one might be actually what can help you. You must be smarter than me to be brave enough to use standard library in nuxt. I am already lost in so many linked files and auto-imports, that I am either all-in nuxt or just go ahead and ditch it for vanilla js 🤣
Mongoose ODM with MongoDB - Learn | MongoDB
Discover our MongoDB Database Management courses and begin improving your CV with MongoDB certificates. Start training with MongoDB University for free today.
Connecting to MongoDB in Node.js - Learn | MongoDB
Discover our MongoDB Database Management courses and begin improving your CV with MongoDB certificates. Start training with MongoDB University for free today.
thorne51
thorne513mo ago
Hi @VanishDark , I'm guessing you meant AWS account 🙂 So what I can suggest is that you look at deploying to Amplify (https://docs.aws.amazon.com/amplify/latest/userguide/get-started-nuxt.html), seeing as it supports SSR now using Lambdas. Your MongoDB queries will probably be done server side as you don't want to expose your connection string and credentials publicly. I'd suggest setting up server api routes and look at deploying them with your Nuxt app on Amplify (worth noting that server routes are executed inline instead of a request with SSR). There are other alternatives like Vercel as well but I don't know enough about them to give any advice. If you're not keen on using Amplify and have an EC2 server available, you could also setup a Nginx reverse proxy to proxy requests to your nuxt app running on port 3000.
VanishDark
VanishDarkOP3mo ago
Yes correct. Aws account, with amplify and ec2. I think I’m gonna give it a go in amplify and see how it goes. To achieve the server using lambdas do I need a specific setting or something in nuxt or amplify? I’m gonna check the link you send and see if I can deploy. Otherwise I will move to ec2 Well some bad and good experiences and multiple projects with mongo lead me to use mongodb driver 😂
Shay Rosenfeld
Shay Rosenfeld2mo ago
isn't amplify supposed to support Nuxt SSR with zero config?
thorne51
thorne512mo ago
yeahp, SSR works with zero config. I'm personally having trouble converting an SSR app to a static one, but that's not on this discussion 😛 setting up nuxt ssr with amplify is dead easy, as you will see from the link posted, the only important thing is to enable the ssr logging (helps with debugging too) so that the amplify app is created with WEB_COMPUTE platform instead of WEB
Shay Rosenfeld
Shay Rosenfeld2mo ago
oh yea. And I always enable all possible logging, can never know where you'll find the issue 😉
Want results from more Discord servers?
Add your server