This is a Next.js boilerplate project bootstrapped with create-next-app
using mongoose for MongoDB database connection and schemas.
This project was developed by Nils-Christopher Wiesenauer (NurNils) to simply create new Next.js projects with SEO and an API connected to a MongoDB using mongoose.
⚙️ The project is created with Next.js with MongoDB. More info
📄 To create sitemap(s) and robots.txt the sitemap generator next-sitemap is used.
📈 mongoose is used for elegant mongodb object modeling
💬 JSend is used as a specification for a simple, no-frills, JSON based format for application-level communication
🎨 Prettier is used for code formatting
📝 Licensed under MIT: Do almost anything you want with this project files
MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era. This example will show you how to connect to and use MongoDB as your backend for your Next.js app.
If you want to learn more about MongoDB, visit the following pages:
Set up a MongoDB database either locally or with MongoDB Atlas for free.
Copy the env.local.example
file in this directory to .env.local
(which will be ignored by Git):
cp .env.local.example .env.local
Set each variable on .env.local
:
MONGODB_URI
- Your MongoDB connection string. If you are using MongoDB Atlas you can find this by clicking the "Connect" button for your cluster.
npm install
npm run dev
# or
yarn install
yarn dev
Your app should be up and running on http://localhost:3000
Ensure that you have provided the correct MONGODB_URI
environment variable.
When you are successfully connected, you can refer to the MongoDB Node.js Driver docs for further instructions on how to query your database.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.