{"id":24605273,"url":"https://github.com/nextjs/saas-starter","last_synced_at":"2025-05-16T01:00:15.452Z","repository":{"id":256305031,"uuid":"854894542","full_name":"nextjs/saas-starter","owner":"nextjs","description":"Get started quickly with Next.js, Postgres, Stripe, and shadcn/ui.","archived":false,"fork":false,"pushed_at":"2025-04-26T21:14:52.000Z","size":293,"stargazers_count":12215,"open_issues_count":8,"forks_count":1565,"subscribers_count":84,"default_branch":"main","last_synced_at":"2025-05-09T00:56:23.849Z","etag":null,"topics":["nextjs","postgres","shadcn-ui","stripe"],"latest_commit_sha":null,"homepage":"https://next-saas-start.vercel.app","language":"TypeScript","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/nextjs.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,"zenodo":null}},"created_at":"2024-09-10T00:18:56.000Z","updated_at":"2025-05-08T22:08:40.000Z","dependencies_parsed_at":"2024-09-16T00:34:57.422Z","dependency_job_id":"1065b342-6b94-4307-a2b2-a6bfbfb54250","html_url":"https://github.com/nextjs/saas-starter","commit_stats":{"total_commits":70,"total_committers":15,"mean_commits":4.666666666666667,"dds":0.2571428571428571,"last_synced_commit":"06b7fab31e291adddda8618ac0ac28bdf4b755eb"},"previous_names":["leerob/next-saas-starter","nextjs/saas-starter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjs%2Fsaas-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjs%2Fsaas-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjs%2Fsaas-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjs%2Fsaas-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextjs","download_url":"https://codeload.github.com/nextjs/saas-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448578,"owners_count":22072764,"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":["nextjs","postgres","shadcn-ui","stripe"],"created_at":"2025-01-24T16:02:01.959Z","updated_at":"2025-05-16T01:00:15.402Z","avatar_url":"https://github.com/nextjs.png","language":"TypeScript","readme":"# Next.js SaaS Starter\n\nThis is a starter template for building a SaaS application using **Next.js** with support for authentication, Stripe integration for payments, and a dashboard for logged-in users.\n\n**Demo: [https://next-saas-start.vercel.app/](https://next-saas-start.vercel.app/)**\n\n## Features\n\n- Marketing landing page (`/`) with animated Terminal element\n- Pricing page (`/pricing`) which connects to Stripe Checkout\n- Dashboard pages with CRUD operations on users/teams\n- Basic RBAC with Owner and Member roles\n- Subscription management with Stripe Customer Portal\n- Email/password authentication with JWTs stored to cookies\n- Global middleware to protect logged-in routes\n- Local middleware to protect Server Actions or validate Zod schemas\n- Activity logging system for any user events\n\n## Tech Stack\n\n- **Framework**: [Next.js](https://nextjs.org/)\n- **Database**: [Postgres](https://www.postgresql.org/)\n- **ORM**: [Drizzle](https://orm.drizzle.team/)\n- **Payments**: [Stripe](https://stripe.com/)\n- **UI Library**: [shadcn/ui](https://ui.shadcn.com/)\n\n## Getting Started\n\n```bash\ngit clone https://github.com/nextjs/saas-starter\ncd saas-starter\npnpm install\n```\n\n## Running Locally\n\n[Install](https://docs.stripe.com/stripe-cli) and log in to your Stripe account:\n\n```bash\nstripe login\n```\n\nUse the included setup script to create your `.env` file:\n\n```bash\npnpm db:setup\n```\n\nRun the database migrations and seed the database with a default user and team:\n\n```bash\npnpm db:migrate\npnpm db:seed\n```\n\nThis will create the following user and team:\n\n- User: `test@test.com`\n- Password: `admin123`\n\nYou can also create new users through the `/sign-up` route.\n\nFinally, run the Next.js development server:\n\n```bash\npnpm dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) in your browser to see the app in action.\n\nYou can listen for Stripe webhooks locally through their CLI to handle subscription change events:\n\n```bash\nstripe listen --forward-to localhost:3000/api/stripe/webhook\n```\n\n## Testing Payments\n\nTo test Stripe payments, use the following test card details:\n\n- Card Number: `4242 4242 4242 4242`\n- Expiration: Any future date\n- CVC: Any 3-digit number\n\n## Going to Production\n\nWhen you're ready to deploy your SaaS application to production, follow these steps:\n\n### Set up a production Stripe webhook\n\n1. Go to the Stripe Dashboard and create a new webhook for your production environment.\n2. Set the endpoint URL to your production API route (e.g., `https://yourdomain.com/api/stripe/webhook`).\n3. Select the events you want to listen for (e.g., `checkout.session.completed`, `customer.subscription.updated`).\n\n### Deploy to Vercel\n\n1. Push your code to a GitHub repository.\n2. Connect your repository to [Vercel](https://vercel.com/) and deploy it.\n3. Follow the Vercel deployment process, which will guide you through setting up your project.\n\n### Add environment variables\n\nIn your Vercel project settings (or during deployment), add all the necessary environment variables. Make sure to update the values for the production environment, including:\n\n1. `BASE_URL`: Set this to your production domain.\n2. `STRIPE_SECRET_KEY`: Use your Stripe secret key for the production environment.\n3. `STRIPE_WEBHOOK_SECRET`: Use the webhook secret from the production webhook you created in step 1.\n4. `POSTGRES_URL`: Set this to your production database URL.\n5. `AUTH_SECRET`: Set this to a random string. `openssl rand -base64 32` will generate one.\n\n## Other Templates\n\nWhile this template is intentionally minimal and to be used as a learning resource, there are other paid versions in the community which are more full-featured:\n\n- https://achromatic.dev\n- https://shipfa.st\n- https://makerkit.dev\n- https://zerotoshipped.com\n","funding_links":[],"categories":["TypeScript","前端开发框架及项目","Boilerplates \u0026 Starters","Open Source SaaS Boilerplates"],"sub_categories":["React工具库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextjs%2Fsaas-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextjs%2Fsaas-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextjs%2Fsaas-starter/lists"}