{"id":18398749,"url":"https://github.com/mongodb-developer/nextjs-with-mongodb","last_synced_at":"2025-04-07T05:33:38.239Z","repository":{"id":57567020,"uuid":"524944843","full_name":"mongodb-developer/nextjs-with-mongodb","owner":"mongodb-developer","description":"nextjs-with-mongodb","archived":false,"fork":false,"pushed_at":"2025-04-04T16:36:49.000Z","size":95,"stargazers_count":48,"open_issues_count":1,"forks_count":33,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-04T17:32:31.233Z","etag":null,"topics":["mongodb","nextjs","nextjs-example","nextjs-mongodb"],"latest_commit_sha":null,"homepage":"https://nextjs-with-mongodb-mauve.vercel.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongodb-developer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-15T10:32:11.000Z","updated_at":"2025-04-04T16:36:50.000Z","dependencies_parsed_at":"2024-02-28T09:38:01.197Z","dependency_job_id":"17e5ca99-443e-47d5-9edf-70162544202d","html_url":"https://github.com/mongodb-developer/nextjs-with-mongodb","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fnextjs-with-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fnextjs-with-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fnextjs-with-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2Fnextjs-with-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongodb-developer","download_url":"https://codeload.github.com/mongodb-developer/nextjs-with-mongodb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601378,"owners_count":20964861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mongodb","nextjs","nextjs-example","nextjs-mongodb"],"created_at":"2024-11-06T02:24:15.175Z","updated_at":"2025-04-07T05:33:37.462Z","avatar_url":"https://github.com/mongodb-developer.png","language":"TypeScript","readme":"## Example app using MongoDB\n\n[MongoDB](https://www.mongodb.com/) 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.\n\nTutorial Link: [How to Integrate MongoDB Into Your Next.js App](https://www.mongodb.com/developer/languages/javascript/nextjs-with-mongodb/)\n\nIf you want to learn more about MongoDB, visit the following pages:\n\n- [MongoDB Atlas](https://mongodb.com/atlas)\n- [MongoDB Documentation](https://docs.mongodb.com/)\n\n## Deploy your own\n\nOnce you have access to the environment variables you'll need, deploy the example using [Vercel](https://vercel.com?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=next-example):\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?project-name=with-mongodb\u0026repository-name=with-mongodb\u0026repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fnext.js%2Ftree%2Fcanary%2Fexamples%2Fwith-mongodb\u0026integration-ids=oac_jnzmjqM10gllKmSrG0SGrHOH)\n\n## How to use\n\nExecute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:\n\n```bash\nnpx create-next-app --example with-mongodb mflix\n```\n\n```bash\nyarn create next-app --example with-mongodb mflix\n```\n\n```bash\npnpm create next-app --example with-mongodb mflix\n```\n\nAfter that navigate to the project directory by running\n```\ncd mflix\n```\n\nAnd then install all the npm dependencies by running:\n```\nnpm install\n```\n\n## Configuration\n\n### Set up a MongoDB database\n\nSet up a MongoDB database either locally or with [MongoDB Atlas for free](https://mongodb.com/atlas).\n\n### Set up environment variables\n\nCopy the `env.local.example` file in this directory to `.env.local` (which will be ignored by Git):\n\n```bash\ncp .env.local.example .env.local\n```\n\nSet each variable on `.env.local`:\n\n- `MONGODB_URI` - Your MongoDB connection string. If you are using [MongoDB Atlas](https://mongodb.com/atlas) you can find this by clicking the \"Connect\" button for your cluster.\n\n### Run Next.js in development mode\n\n```bash\nnpm install\nnpm run dev\n\n# or\n\nyarn install\nyarn dev\n```\n\nYour app should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).\n\nYou will either see a message stating \"You are connected to MongoDB\" or \"You are NOT connected to MongoDB\". Ensure that you have provided the correct `MONGODB_URI` environment variable.\n\nWhen you are successfully connected, you can refer to the [MongoDB Node.js Driver docs](https://mongodb.github.io/node-mongodb-native/3.4/tutorials/collections/) for further instructions on how to query your database.\n\n## Deploy on Vercel\n\nYou can deploy this app to the cloud with [Vercel](https://vercel.com?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).\n\n#### Deploy Your Local Project\n\nTo deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and [import to Vercel](https://vercel.com/new?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=next-example).\n\n**Important**: When you import your project on Vercel, make sure to click on **Environment Variables** and set them to match your `.env.local` file.\n\n#### Deploy from Our Template\n\nAlternatively, you can deploy using our template by clicking on the Deploy button below.\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?project-name=with-mongodb\u0026repository-name=with-mongodb\u0026repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fnext.js%2Ftree%2Fcanary%2Fexamples%2Fwith-mongodb\u0026integration-ids=oac_jnzmjqM10gllKmSrG0SGrHOH)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb-developer%2Fnextjs-with-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongodb-developer%2Fnextjs-with-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb-developer%2Fnextjs-with-mongodb/lists"}