{"id":26368553,"url":"https://github.com/prisma/nextjs-prisma-postgres-demo","last_synced_at":"2025-10-18T01:39:20.623Z","repository":{"id":273598943,"uuid":"920255727","full_name":"prisma/nextjs-prisma-postgres-demo","owner":"prisma","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-06T12:34:33.000Z","size":4217,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T00:11:21.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/prisma.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":"2025-01-21T20:39:19.000Z","updated_at":"2025-03-15T15:49:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e7a2b24-4dee-4018-b438-169d3cd3e02d","html_url":"https://github.com/prisma/nextjs-prisma-postgres-demo","commit_stats":null,"previous_names":["jharrell/nextjs","prisma/nextjs-prisma-postgres-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Fnextjs-prisma-postgres-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Fnextjs-prisma-postgres-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Fnextjs-prisma-postgres-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Fnextjs-prisma-postgres-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prisma","download_url":"https://codeload.github.com/prisma/nextjs-prisma-postgres-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945530,"owners_count":20372894,"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":[],"created_at":"2025-03-16T22:44:57.174Z","updated_at":"2025-10-18T01:39:15.557Z","avatar_url":"https://github.com/prisma.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js + Prisma Postgres Example\n\n![nextjs demo logos](https://github.com/user-attachments/assets/878d39b7-ca99-4dc5-a095-94ca9d010486)\n\nThis example demonstrates how to build a full-stack web application using [Next.js](https://nextjs.org/), [Prisma Client](https://www.prisma.io/docs/orm/overview/introduction/what-is-prisma), and [Prisma Postgres](https://www.prisma.io/postgres).\n\n\u003e **TL;DR:** Prisma Postgres is a new kind of Postgres database that's optimized for developer productivity. It offers instant provisioning, built-in connection pooling, edge caching, and seamless integration with Prisma ORM.\n\u003e\n\u003e [Learn more about Prisma Postgres →](https://www.prisma.io/postgres)\n\n## Getting started\n\n### 1. Fill out .env file\n\nIf you just want to run the app locally, rename `.env.example` to `.env` and fill in the values.\n\n#### 1.1 Create a Prisma Postgres instance\n\nGo to [the Console](https://console.prisma.io) and create a new Prisma Postgres instance. Use the `DATABASE_URL` value from the new instance to fill out the `.env` file.\n\n#### 1.2 Create a GitHub OAuth app\n\nGo to [the GitHub Developer Settings](https://github.com/settings/developers) and create a new OAuth app.\n\nFor the required fields:\n\n- Application name and homepage URL can be whatever you want.\n- Authorization callback URL should be `http://localhost:3000/api/auth/callback/github`\n\nAfter creating the app, you'll be redirected to the app's page. Copy the `Client ID` and `Client Secret` values and use them to fill out `AUTH_GITHUB_ID` and `AUTH_GITHUB_SECRET` in the `.env` file.\n\n#### 1.3 Fill out Auth.js secrets\n\nRun `npx auth secret --copy` to generate a new `AUTH_SECRET` value. Fill out the `.env` file with the new value.\n\n### 2. Install dependencies\n\nInstall npm dependencies:\n\n```\nnpm install\n```\n\n### 3. Create and seed the database\n\nRun the following command to create your database. This also creates the needed tables that are defined in [`prisma/schema.prisma`](./prisma/schema.prisma):\n\n```\nnpx prisma migrate dev --name init\n```\n\nWhen `npx prisma migrate dev` is executed against a newly created database, seeding is also triggered. The seed file in [`prisma/seed.ts`](./prisma/seed.ts) will be executed and your database will be populated with the sample data.\n\n**If you switched to Prisma Postgres in the previous step**, you need to trigger seeding manually (because Prisma Postgres already created an empty database instance for you, so seeding isn't triggered):\n\n```\nnpx prisma db seed\n```\n\n### 4. Start the Next.js server\n\n```\nnpm run dev\n```\n\nThe server is now running on `http://localhost:3000`.\n\n\u003cdetails\u003e\n\u003csummary\u003e📸 Expand for a tour of the app\u003c/summary\u003e\n\n### Homepage\n\nLogged out view:\n![Homepage](/public/logged-out-homepage.png)\n\nLogged in view:\n![Homepage](/public/logged-in-homepage.png)\n\n### User Profile\n\n![User Profile](/public/user-profile.png)\n\n### Creating Posts\n\n![Create Post](/public/create-post.png)\n\n### View your posts and drafts\n\n![View Posts](/public/view-posts.png)\n\n\u003c/details\u003e\n\n## Next Steps\n\nHere are some ways to learn more and expand upon this example:\n\n1. 🚀 [Deploy your app to Vercel](https://vercel.com/docs/frameworks/nextjs) in just a few clicks\n2. 📚 Learn more about [Prisma ORM](https://www.prisma.io/docs/orm/overview/introduction/what-is-prisma) and database workflows.\n3. 🔍 Explore the [Prisma Client API](https://www.prisma.io/docs/orm/reference/prisma-client-reference) to add more database features.\n4. ⭐ Check out more [Prisma examples](https://github.com/prisma/prisma-examples) for inspiration.\n\n## Join our community!\n\n- [Discord](https://pris.ly/discord)\n- [Twitter](https://twitter.com/prisma)\n- [Bluesky](https://bsky.app/profile/prisma.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprisma%2Fnextjs-prisma-postgres-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprisma%2Fnextjs-prisma-postgres-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprisma%2Fnextjs-prisma-postgres-demo/lists"}