{"id":13423744,"url":"https://github.com/hoangvvo/nextjs-mongodb-app","last_synced_at":"2025-05-15T16:07:10.120Z","repository":{"id":39579449,"uuid":"201392697","full_name":"hoangvvo/nextjs-mongodb-app","owner":"hoangvvo","description":"A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.","archived":false,"fork":false,"pushed_at":"2024-03-20T03:28:34.000Z","size":247,"stargazers_count":1561,"open_issues_count":23,"forks_count":290,"subscribers_count":32,"default_branch":"v2","last_synced_at":"2025-05-14T13:11:08.581Z","etag":null,"topics":["boilerplate","full-stack","javascript","mongodb","nextjs","real-life"],"latest_commit_sha":null,"homepage":"https://nextjs-mongodb.now.sh/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoangvvo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2019-08-09T04:59:29.000Z","updated_at":"2025-05-13T22:19:45.000Z","dependencies_parsed_at":"2024-06-19T02:49:27.797Z","dependency_job_id":"8f68f706-4098-483c-a682-d9a5f617e108","html_url":"https://github.com/hoangvvo/nextjs-mongodb-app","commit_stats":null,"previous_names":[],"tags_count":6,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangvvo%2Fnextjs-mongodb-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangvvo%2Fnextjs-mongodb-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangvvo%2Fnextjs-mongodb-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangvvo%2Fnextjs-mongodb-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoangvvo","download_url":"https://codeload.github.com/hoangvvo/nextjs-mongodb-app/tar.gz/refs/heads/v2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374475,"owners_count":22060611,"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":["boilerplate","full-stack","javascript","mongodb","nextjs","real-life"],"created_at":"2024-07-31T00:00:41.614Z","updated_at":"2025-05-15T16:07:10.101Z","avatar_url":"https://github.com/hoangvvo.png","language":"JavaScript","funding_links":[],"categories":["Boilerplates","JavaScript","Nextjs Starter","Javascript"],"sub_categories":[],"readme":"[![Next.js](https://assets.zeit.co/image/upload/v1538361091/repositories/next-js/next-js.png)](https://nextjs.org)\n\n\u003ch1 align=\"center\"\u003eNext.js ❤️ MongoDB\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fhoangvvo%2Fnextjs-mongodb-app\u0026env=MONGODB_URI,CLOUDINARY_URL,NODEMAILER_CONFIG,WEB_URI\u0026envDescription=Environment%20Variables\u0026envLink=https%3A%2F%2Fgithub.com%2Fhoangvvo%2Fnextjs-mongodb-app%23environmental-variables\u0026demo-title=nextjs-mongodb-app%20demo\u0026demo-description=A%20demo%20deployed%20on%20Vercel\u0026demo-url=https%3A%2F%2Fnextjs-mongodb.vercel.app%2F)\n\nAn [**Next.js**](https://github.com/zeit/next.js/) and [**MongoDB**](https://www.mongodb.com/) web application, designed with simplicity for learning and real-world applicability in mind.\n\n:rocket: [Check out the demo](https://nextjs-mongodb.vercel.app/) :rocket:\n\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eFeatures\u003c/h2\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n🐇 Fast and light without [bulky](https://bundlephobia.com/result?p=express@4.17.1), [slow](https://github.com/fastify/benchmarks#benchmarks) Express.js.\n\n✨ Full [API Routes](https://nextjs.org/blog/next-9#api-routes) implementation and 👻 Serverless ready\n\n🤠 Good ol' Middleware pattern, compatible with Express ecosystem, powered by [next-connect](https://github.com/hoangvvo/next-connect)\n\n💋 [KISS](https://en.wikipedia.org/wiki/KISS_principle): No fancy stuff like GraphQL, SASS, Redux, etc.\n✍️ Come with explanatory blog posts\n\n📙 Can be adapted to any databases besides MongoDB (Just update [api-lib/db](api-lib/db))\n\n\u003c/div\u003e\n\n\u003ch3 align=\"center\"\u003e:lock: Authentication and Account\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n- [x] Session-based authentication ([Passport.js](https://github.com/jaredhanson/passport))\n- [x] Sign up/Log in/Sign out API\n- [x] Authentication via email/password\n- [ ] Authentication via OAuth (Google, Facebook, etc.)\n- [x] Email verification\n- [x] Password change\n- [x] Password reset via email\n\n\u003c/div\u003e\n\n\u003ch3 align=\"center\"\u003e:woman::man: Profile\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n- [x] Profile picture, username, name, bio, email\n- [x] Update user profile\n\n\u003c/div\u003e\n\n\u003ch3 align=\"center\"\u003e:eyes: Social\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n- [x] View others' profiles\n- [x] Posts and comments\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n\u003csup\u003eHave any features that interest you, [make an issue](https://github.com/hoangvvo/nextjs-mongodb-app/issues). Would like to work on a feature, [make a PR](https://github.com/hoangvvo/nextjs-mongodb-app/pulls).\u003csup\u003e\n  \n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eGuide\u003c/h2\u003e\n\nThis project accompanies the following posts:\n\n- [User authentication (using Passport.js)](https://hoangvvo.com/blog/next-js-and-mongodb-app-1)\n- [User profile and Profile Picture](https://hoangvvo.com/blog/next-js-and-mongodb-app-2)\n- [Email Verification, Password Reset/Changee](https://hoangvvo.com/blog/next-js-and-mongodb-app-3)\n- [Posts and comments](https://hoangvvo.com/blog/next-js-and-mongodb-app-4)\n\nAlso check them out on [dev.to](https://dev.to/hoangvvo).\n\nAlthough the project is written to be secure, its simplicity requires careful considerations for usage in sensitive productions. [File an issue](https://github.com/hoangvvo/nextjs-mongodb-app/issues/new/choose) if you spot any security problems.\n\n\u003ch3 align=\"center\"\u003eDependencies\u003c/h3\u003e\n\nThis project uses the following dependencies:\n\n- `next.js` - v9.3 or above required for **API Routes** and new [**new data fetching method**](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering).\n- `react` - v16.8 or above required for **react hooks**.\n- `react-dom` - v16.8 or above.\n- `swr` - required for state management, may be replaced with `react-query`\n- `mongodb` - may be replaced by `mongoose`.\n- `passport`, `passport-local` - required for authentication.\n- `next-connect` - recommended if you want to use Express/Connect middleware and easier method routing.\n- `next-session`, `connect-mongo` - required for session, may be replaced with other session libraries such as `cookie-session`, `next-iron-session`, or `express-session` (`express-session` is observed not to work properly on Next.js 11+).\n- `bcryptjs` - optional, may be replaced with any password-hashing library. `argon2` recommended.\n- `validator` - optional but recommended, to validate email.\n- `ajv` - optional but recommended, to validate request body.\n- `multer` - may be replaced with any middleware that handles `multipart/form-data`\n- `cloudinary` - optional, **only if** you are using [Cloudinary](https://cloudinary.com) for image upload.\n- several other optional dependencies for cosmetic purposes.\n- `nodemailer` - optional, **only if** you use it for email. It is recommended to use 3rd party services like [Mailgun](https://www.mailgun.com/), [AWS SES](https://aws.amazon.com/ses/), etc. instead.\n\n\u003ch3 align=\"center\"\u003eEnvironmental variables\u003c/h3\u003e\n\nEnvironmental variables in this project include:\n\n- `MONGODB_URI` The MongoDB Connection String (with credentials and database name)\n- `WEB_URI` The _URL_ of your web app.\n- `CLOUDINARY_URL` (optional, Cloudinary **only**) Cloudinary environment variable for configuration. See [this](https://cloudinary.com/documentation/node_integration#configuration).\n- `NODEMAILER_CONFIG` (optional, if using nodemailer **only**) JSON stringified nodemailer config. eg. `{\"service\":\"Gmail\",\"auth\":{\"user\":\"hoangvvo.02@gmail.com\",\"pass\":\"aHR0cHM6Ly95b3V0dS5iZS9kUXc0dzlXZ1hjUQ==\"}}`\n\n\u003ch3 align=\"center\"\u003eDevelopment\u003c/h3\u003e\n\nStart the development server by running `yarn dev` or `npm run dev`. Getting started by create a `.env.local` file with the above variables. See [Environment Variables](https://nextjs.org/docs/basic-features/environment-variables).\n\n\u003ch2 align=\"center\"\u003eDeployment\u003c/h2\u003e\n\nThis project can be deployed [anywhere Next.js can be deployed](https://nextjs.org/docs/deployment). Make sure to set the environment variables using the options provided by your cloud/hosting providers.\n\nAfter building using `npm run build`, simply start the server using `npm run start`.\n\nYou can also deploy this with serverless providers given the correct setup.\n\n\u003ch2 align=\"center\"\u003eContributing\u003c/h2\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \nPlease see my [contributing.md](CONTRIBUTING.md).\n\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003e\n  License\n\u003c/h2\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n  [MIT](LICENSE)\n  \n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoangvvo%2Fnextjs-mongodb-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoangvvo%2Fnextjs-mongodb-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoangvvo%2Fnextjs-mongodb-app/lists"}