{"id":14957353,"url":"https://github.com/danybeltran/nextjs-typescript-and-mongodb","last_synced_at":"2025-04-04T18:09:01.264Z","repository":{"id":46578480,"uuid":"328868279","full_name":"danybeltran/nextjs-typescript-and-mongodb","owner":"danybeltran","description":"A very minimal Next.js template that uses server actions, Prisma, PostgreSQL, TailwindCSS, Shadcn, Zod and Next auth.","archived":false,"fork":false,"pushed_at":"2025-01-24T20:14:31.000Z","size":1802,"stargazers_count":162,"open_issues_count":0,"forks_count":23,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T17:11:09.180Z","etag":null,"topics":["mongodb","next","next-auth","next14","nextjs","nodejs","prisma","react","react-hooks","react-template","rsc","server-actions","server-components","tailwind","tailwindcss","typescript","useclient","useserver","useserveraction","zod"],"latest_commit_sha":null,"homepage":"https://nextjs-typescript-and-mongodb-psi.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danybeltran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-01-12T04:08:19.000Z","updated_at":"2025-03-08T12:41:51.000Z","dependencies_parsed_at":"2023-09-27T11:13:14.686Z","dependency_job_id":"534b3f16-ffc0-4ec3-b99c-2e2765de5649","html_url":"https://github.com/danybeltran/nextjs-typescript-and-mongodb","commit_stats":{"total_commits":95,"total_committers":4,"mean_commits":23.75,"dds":"0.33684210526315794","last_synced_commit":"971027496fb4074a9401738b48b42b95211b1992"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danybeltran%2Fnextjs-typescript-and-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danybeltran%2Fnextjs-typescript-and-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danybeltran%2Fnextjs-typescript-and-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danybeltran%2Fnextjs-typescript-and-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danybeltran","download_url":"https://codeload.github.com/danybeltran/nextjs-typescript-and-mongodb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226215,"owners_count":20904465,"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","next","next-auth","next14","nextjs","nodejs","prisma","react","react-hooks","react-template","rsc","server-actions","server-components","tailwind","tailwindcss","typescript","useclient","useserver","useserveraction","zod"],"created_at":"2024-09-24T13:14:46.933Z","updated_at":"2025-04-04T18:09:01.248Z","avatar_url":"https://github.com/danybeltran.png","language":"TypeScript","funding_links":[],"categories":["Boilerplates \u0026 Starters"],"sub_categories":[],"readme":"### A Next.js template\n\nA Next.js app that uses Shadcn, Prisma ORM, \u003cs\u003eMongoDB\u003c/s\u003e PostgreSQL and Next Auth\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fdanybeltran%2Fnextjs-typescript-and-mongodb)\n\n### Updating deps\n\nTo update the dependencies to their latest versions, run:\n\n```\n./scripts/update-deps.sh\n```\n\n---\n\n### Development\n\nYou need to pass an env. variable with the MongoDB connection string, as well as any variables required by `next-auth`:\n\n```\nNEXTAUTH_SECRET=\nGOOGLE_APP_CLIENT_ID=\nGOOGLE_APP_CLIENT_SECRET=\nNEXTAUTH_URL=http://localhost:3000\n# Connect to Supabase via connection pooling with Supavisor.\nDATABASE_URL=\n# Direct connection to the database. Used for migrations.\nDIRECT_URL=\n```\n\n(You don't need `NEXTAUTH_URL` if you are deploying to Vercel)\n\nHow to get these variables?\n\n---\n\n`DATABASE_URL` and `DIRECT_URL`: Visit the [Supabase documentation](https://supabase.com/partners/integrations/prisma)\n\n---\n\n\u003c!--\n- [`MONGO_URI`](https://www.mongodb.com/docs/manual/reference/connection-string/)\n\nThe connection string looks something like this:\n\n`mongodb+srv://\u003cuser\u003e:\u003cpassword\u003e@cluster0.\u003corg\u003e.mongodb.net/\u003cdatabase_name\u003e?retryWrites=true\u0026w=majority`\n\nIn your cluster, click **Connect**:\n\n![alt text](docs/connect-1.png)\n\nUnder the **Connect your application** section, click **Drivers**:\n\n![alt text](docs/drivers.png)\n\nClick the Copy button next to the connection string:\n\n![alt text](docs/connection-string.png)\n\nReplace `\u003cpassword\u003e` with the password for your user. Ensure any option params are [URL encoded](https://dochub.mongodb.org/core/atlas-url-encoding).\n\n--- --\u003e\n\n- [`GOOGLE_APP_CLIENT_ID` and `GOOGLE_APP_CLIENT_SECRET`](https://developers.google.com/identity/oauth2/web/guides/get-google-api-clientid)\n\n---\n\nUse your preferred tool to generate the `NEXTAUTH_SECRET` hash:\n\nUsing [This tool](https://generate-secret.vercel.app/32) is the quickest way to generate a hash. You can change the last segment of the url to get a hash of your preferred length, such as `https://generate-secret.vercel.app/44`\n\n**OpenSSL :**\n\n```bash\nopenssl rand -base64 32\n```\n\n**Urandom :**\n\n```bash\nhead -c 32 /dev/urandom | base64\n```\n\n**Python :**\n\n```py\nimport base64\nimport os\n\nrandom_bytes = os.urandom(32)\nbase64_string = base64.b64encode(random_bytes).decode('utf-8')\nprint(base64_string)\n```\n\n**JavaScript :**\n\n```js\nconst crypto = require('crypto')\n\nconst randomBytes = crypto.randomBytes(32)\nconst base64String = randomBytes.toString('base64')\nconsole.log(base64String)\n```\n\nYou can add those variables to a `.ENV` file (don't forget to add it to your `.gitignore` file!)\n\nRelated documentation:\n\n- [`nextjs`](https://nextjs.org/docs)\n\n- [`next-auth`](https://next-auth.js.org/getting-started/introduction)\n\n- [`http-react`](https://httpr.vercel.app/docs)\n\n[Live preview](https://nextjs-typescript-and-mongodb-psi.vercel.app)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanybeltran%2Fnextjs-typescript-and-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanybeltran%2Fnextjs-typescript-and-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanybeltran%2Fnextjs-typescript-and-mongodb/lists"}