building-modern-app-with-nextjs-and-mongodb
building-modern-app-with-nextjs-and-mongodb copied to clipboard
Building a Modern App with NextJS and MongoDB
This codebase is the completed code for an article that covers how you can build a modern application with NextJs and MongoDB. The app you will build is called a Macro Compliance Tracker. The app allows you to track your calories and macros, as well as acceptable ranges to be in compliance. Read the article to find out how and why.

Prerequisites
- A recent version of Node.js.
- MongoDB. Try MongoDB Atlas for free. You can use code ADO200 for a $200 credit.
If you want to add sample data. You can find it in the included data.json file. Import it into your database.
Building the Application
- Clone the repo
- Navigate to the
mctdirectory. - Run
npm installin your terminal to install dependencies. - Run
npm run devto start the local development server. - Update the
{YOUR-MONGODB-CONNECTION-STRING}string in thedatabase.jsfile located in themiddlewaredirectory with your MongoDB connection string. - Ensure the
client.db('{DATABASE-NAME}')string in thedatabase.jsfile matches the database name you wish to use.
Navigate to localhost:3000 to see your application in action.