{"id":31070865,"url":"https://github.com/george-swift/next-foundry","last_synced_at":"2026-04-08T23:34:51.785Z","repository":{"id":314803147,"uuid":"1053050125","full_name":"george-swift/next-foundry","owner":"george-swift","description":"Production-ready Next.js + TypeScript starter kit to build and launch faster. Best practices baked in. Ship in days, not weeks.","archived":false,"fork":false,"pushed_at":"2025-09-14T20:59:29.000Z","size":680,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-14T22:26:17.568Z","etag":null,"topics":["better-auth","framer-motion","leaflet","nextjs","nuqs","postgresql","prisma","react-email","resend","shadcn-ui","tailwindcss","typescript","upstash-ratelimit","vercel-ai-sdk","zod"],"latest_commit_sha":null,"homepage":"https://next-foundry.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/george-swift.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T23:27:04.000Z","updated_at":"2025-09-14T20:59:32.000Z","dependencies_parsed_at":"2025-09-14T22:26:22.745Z","dependency_job_id":"86598155-3376-4064-87d9-bbab73d983ec","html_url":"https://github.com/george-swift/next-foundry","commit_stats":null,"previous_names":["george-swift/next-foundry"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/george-swift/next-foundry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/george-swift%2Fnext-foundry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/george-swift%2Fnext-foundry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/george-swift%2Fnext-foundry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/george-swift%2Fnext-foundry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/george-swift","download_url":"https://codeload.github.com/george-swift/next-foundry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/george-swift%2Fnext-foundry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31579056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["better-auth","framer-motion","leaflet","nextjs","nuqs","postgresql","prisma","react-email","resend","shadcn-ui","tailwindcss","typescript","upstash-ratelimit","vercel-ai-sdk","zod"],"created_at":"2025-09-15T23:03:17.940Z","updated_at":"2026-04-08T23:34:51.758Z","avatar_url":"https://github.com/george-swift.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Next Foundry\n\n**Production‑ready Next.js + TypeScript starter. Skip the boilerplate. Start building.**\n\n\u003ca href=\"https://next-foundry.vercel.app\"\u003e\n  \u003cimg alt=\"Next.js + TypeScript starter\" src=\"./src/app/opengraph-image.png\"\u003e\n\u003c/a\u003e\n\n\u003c/div\u003e\n\n## Table of Contents\n\n1. [Why Next Foundry?](#why-next-foundry)\n2. [What You Get](#what-you-get)\n3. [Tech Stack](#tech-stack)\n4. [Quick Start](#quick-start)\n5. [Database \u0026 Prisma](#database--prisma)\n6. [Authentication (Better Auth)](#authentication-better-auth)\n7. [Email (Resend + React Email)](#email-resend--react-email)\n8. [Rate Limiting](#rate-limiting)\n9. [Security Posture](#security-posture)\n10. [Project Structure](#project-structure)\n11. [Contributing](#contributing)\n12. [License](#license)\n\n## Why Next Foundry?\n\nLaunching your next big idea shouldn’t start with a week of wiring auth, email, databases, and other repetitive scaffolding. **Next Foundry** gives you a _lean but production‑minded_ starting point:\n\n- Auth (Magic link + Google) already implemented\n- Transactional email templates + delivery\n- Rate limiting with Redis (Upstash)\n- Strong typing, validation, DX conveniences\n- A visual playground showcasing each integration\n\n## What You Get\n\n| Area                 | Included                                        |\n| -------------------- | ----------------------------------------------- |\n| Auth                 | Better Auth (Magic link + Google)               |\n| Database             | Prisma + Accelerate                             |\n| Emails               | Resend + React Email templates                  |\n| UI                   | Shadcn UI, Radix primitives, theming, dark mode |\n| Rate Limiting        | Upstash Redis based limiter                     |\n| Analytics / Metadata | Vercel edge functions                           |\n| Forms                | React Hook Form + Zod resolvers                 |\n| URL State            | nuqs                                            |\n| Time                 | day.js                                          |\n| Charts               | Recharts                                        |\n| Motion               | Motion (Framer)                                 |\n| Maps                 | Leaflet                                         |\n| AI                   | AI SDK + OpenAI adapter demo                    |\n\n## Tech Stack\n\n**Core**\n\n- Framework: `Next.js 15` (Turbopack)\n- Language: `TypeScript`\n- Styling: `Tailwind CSS v4` + utility composition (`class-variance-authority`, `tailwind-merge`)\n- Auth: `better-auth`\n- ORM: `Prisma` (+ optional Accelerate extension)\n- Database: `PostgreSQL`\n- Validation: `zod`\n- Forms: `react-hook-form`\n- Email templates: `@react-email/components`\n- Email delivery: `resend`\n- Rate limiting: `@upstash/ratelimit` + `@upstash/redis`\n- Icons: `lucide-react`\n- Charts: `recharts`\n- AI: `ai` + `@ai-sdk/react` + `@ai-sdk/openai`\n- Maps: `leaflet`, `react-leaflet`\n- Themes: `next-themes`\n- URL state: `nuqs`\n- Animation library: `motion`\n\n**Tooling**\n\n- Linting: `eslint` + `eslint-config-next` + `prettier`\n- Type checking: `tsc`\n- Dead code analysis: `knip`\n- Git hooks: `husky` + `lint-staged` (configure as needed)\n\n---\n\n## Quick Start\n\n### 1. Scaffold a New Project\n\n```bash\npnpm dlx degit george-swift/next-foundry my-app\ncd my-app\npnpm install\n```\n\n### 2. Copy and Configure Environment\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env` and fill all required values (see [Environment Variables](#environment-variables)).\n\n### 3. Generate Prisma Client \u0026 Push Schema\n\n```bash\npnpm db:generate\npnpm db:push\n```\n\n### 4. Start Dev Server\n\n```bash\npnpm dev\n```\n\nVisit: `http://localhost:3000/playground` to explore widgets.\n\n## Database \u0026 Prisma\n\nPrisma schema lives in `src/prisma/schema.prisma`. Generated client output is placed under `src/lib/generated/prisma` (custom output path). Common tasks:\n\n```bash\npnpm db:generate     # Regenerate client\npnpm db:push         # Push schema changes (development)\npnpm db:migrate      # Create migration with prompt\npnpm db:studio       # Open Prisma Studio\n```\n\nTo create a migration:\n\n```bash\npnpm db:migrate --name add_user_profile_fields\n```\n\n---\n\n## Authentication (Better Auth)\n\nMagic link + Google OAuth are pre-wired.\n\nKey files:\n\n- `src/lib/auth.ts` – server auth configuration (plugins, providers, magic link email sender)\n- `src/lib/auth-client.ts` – client utilities (`signIn`, `signOut`, `useSession`)\n- `src/app/api/auth/[...all]/route.ts` – Better Auth Next.js route handler\n- `src/app/playground/_widgets/auth.tsx` – Login widget in the playground to demo authentication\n\n### Adding Another Supported Provider\n\nFollow [the guide](https://www.better-auth.com/docs/concepts/oauth) on Better Auth\n\n### Magic Link Flow\n\n1. User submits email\n2. Server action called\n3. Email with time‑boxed token delivered via Resend\n4. Clicking verifies and establishes session\n\n## Email (Resend + React Email)\n\nSample Templates: `magic-link`, `delete-account`, `service-test` under `src/app/playground/_components/email-templates/`.\n\nSend test service email from the Playground UI (`resend` widget).\n\n## Rate Limiting\n\nSample setup located in `src/lib/rate-limit.ts`. Uses Upstash Redis token bucket via `@upstash/ratelimit`. [See the docs](https://upstash.com/docs/redis/overall/getstarted) to get started.\n\nApply in server actions or API routes:\n\n```ts\nawait rateLimit({ actionType: 'auth.magicLink', identifier: ip })\n```\n\nYou may define or centralize allowed `actionType` values to avoid typos.\n\n## Scripts\n\n| Script           | Purpose                           |\n| ---------------- | --------------------------------- |\n| `dev`            | Start Next.js dev (Turbopack)     |\n| `build`          | Production build                  |\n| `start`          | Run production server             |\n| `lint`           | Lint sources                      |\n| `lint:fix`       | Auto-fix issues                   |\n| `typecheck`      | TypeScript project check          |\n| `format`         | Prettier write all                |\n| `format:check`   | Prettier verify                   |\n| `db:generate`    | Prisma client generate            |\n| `db:push`        | Push schema to DB (no migration)  |\n| `db:migrate`     | Create/apply migration in dev     |\n| `db:studio`      | Prisma Studio UI                  |\n| `analyze`        | Dead code / unused exports (Knip) |\n| `security:audit` | Run `pnpm audit` (non‑failing)    |\n\n---\n\n## Security Posture\n\nBaseline features:\n\n- Session + cookie protections handled by Better Auth\n- Magic link tokens time‑scoped\n- Rate limiting on sensitive actions\n- Input validation via Zod\n\nRecommended enhancements (not included by default):\n\n- Add `middleware.ts` with strict security headers. Learn more [here](https://nextjs.org/docs/app/guides/production-checklist#security)\n- Structured logging\n- Audit trail table for sign‑ins \u0026 deletes\n\n\u003e This starter is **security‑aware**, but _not_ a compliance framework. Always threat model your own domain logic.\n\n---\n\n## Project Structure\n\n```\nsrc/\n\tapp/\n\t\tapi/auth/[...all]/route.ts   # Better Auth API catch-all\n\t\tplayground/                  # Interactive widgets showcase\n\tlib/\n\t\tauth.ts                      # Better Auth server config\n\t\tauth-client.ts               # Better Auth client\n\t\tprisma.ts                    # Prisma client\n\t\trate-limit.ts                # Upstash rate limiter config\n\tcomponents/ui/                   # Shadcn UI components\n\tcomponents/providers/            # Theme, Nuqs providers\n    prisma/                          # Prisma schema\n      schema.prisma\n```\n\n## Contributing\n\nPRs welcome. Please read the [Contributing Guidelines](CONTRIBUTING.md) for detailed information.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.\n\n---\n\nIf this starter saves you time, consider leaving a star ⭐️ on the repository\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorge-swift%2Fnext-foundry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorge-swift%2Fnext-foundry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorge-swift%2Fnext-foundry/lists"}