AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻譯準備中
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證現代的 Next.js 16 與 React 19 範本,整合 Better Auth、Prisma 與 Shadcn UI,用於建構安全、可擴展的網路應用程式。
AI 翻譯
Modern Next.js 16 & React 19 template integrated with Better Auth, Prisma, and Shadcn UI for building secure, scalable web apps.
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
This is a robust and modern template for Next.js applications, pre-configured with advanced authentication, database, and ready-to-use UI components. Designed to accelerate the development of secure and scalable web applications.檢視完整 README ↗A production-ready Next.js 16 SaaS starter: authentication, PostgreSQL, admin and user dashboards, and transactional emails, already wired with Better Auth, Prisma and shadcn/ui. Deploy it to Railway in one click, or run it locally in a few minutes.
One click → live app. The Railway button provisions PostgreSQL, wires
DATABASE_URL, applies migrations and gives you a public HTTPS URL. OnlyRESEND_API_KEYand Google OAuth keys are needed afterwards to enable emails and social login.
src/generated/prisma/api/health, restart on failure, and migrations applied on every start@prisma/adapter-pg driver adapterFollow these steps to set up the project in your local environment.
git clone https://github.com/laguillo/nextjs-better-auth-prisma-template.git
cd nextjs-better-auth-prisma-template
We recommend using Bun for a faster experience:
bun install
Create a .env file in the project root and configure the following variables:
# Database (PostgreSQL)
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
# Better Auth
BETTER_AUTH_SECRET="your_super_secure_secret" # Generate with: openssl rand -base64 32
BETTER_AUTH_URL="http://localhost:3000"
NEXT_PUBLIC_BASE_URL="http://localhost:3000" # In production: your public domain (also used for OG image, sitemap and robots URLs)
# OAuth Providers (Google)
GOOGLE_CLIENT_ID="your_google_client_id"
GOOGLE_CLIENT_SECRET="your_google_client_secret"
# Email (Resend)
RESEND_API_KEY="re_123456789"
EMAIL_SENDER_NAME="Your App"
EMAIL_SENDER_ADDRESS="[email protected]"
| Variable | What it is for |
|---|---|
DATABASE_URL | PostgreSQL connection string used by Prisma. |
BETTER_AUTH_SECRET | Secret Better Auth uses to sign sessions. |
BETTER_AUTH_URL | Public URL of the app (Better Auth's base URL). |
NEXT_PUBLIC_BASE_URL | Public URL used for the OG image, sitemap, robots and password-reset links. Resolved at build time; falls back to BETTER_AUTH_URL. |
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET | Google OAuth credentials. In Google Cloud Console add http://localhost:3000/api/auth/callback/google as an authorized redirect URI (use your production domain there when you deploy). |
RESEND_API_KEY | Resend API key, used for verification and password-reset emails. |
EMAIL_SENDER_NAME, EMAIL_SENDER_ADDRESS | The "From" of those emails. The address must be on a domain you have verified in Resend. |
Run Prisma migrations to create the tables:
bunx prisma migrate dev
This will also generate the Prisma client in src/generated/prisma automatically.
No PostgreSQL installed?
bunx prisma dev --detachstarts an isolated local Postgres without Docker. Copy thepostgres://…URL it prints intoDATABASE_URL, then run the command above.
bun dev
Open http://localhost:3000 in your browser.
There is no UI to promote a user, so do it once by hand:
/signup. Email/password accounts must verify their email before they can sign in. With a working RESEND_API_KEY you get the verification email; without one, open bunx prisma studio and set emailVerified to true on your user (signing in with Google skips this step).role to admin./admin.Route protection has two layers:
src/proxy.ts redirects visitors without a session cookie from /dashboard and /admin to /login. It only checks that the cookie exists, so it is a convenience, not a security boundary.src/app/(protected)/ in the gate of its panel:// src/app/(protected)/admin/reports/page.tsx
import { AdminGate } from '@/components/admin/auth-gate';
export default function ReportsPage() {
return <AdminGate>{/* admin-only content */}</AdminGate>;
}
Use DashboardGate (from @/components/dashboard/auth-gate) for pages under /dashboard.
A layout cannot protect its pages: Next.js renders route segments independently of the layout, and a page's output can still reach the browser in the RSC payload even if the layout replaces it with an error screen. That is why the check lives in the page.
Cache Components and Partial Prefetching are enabled in next.config.ts, so every route must be prerenderable. Reading cookies(), headers(), await params or await searchParams outside a <Suspense> boundary fails bun run build with "Next.js encountered uncached or runtime data during prerendering" (next dev only shows it in the browser overlay and still serves the page, so bun run build is the reliable check).
The fix is to move the request-time read into a small async component wrapped in <Suspense> with a skeleton fallback. The auth pages, reset-password and the protected layouts are working examples. See the caching guide and the error page.
src/lib/constants.ts. The deploy link carries the template author's referral code, so replace it with your own if you publish a fork.src/app/(public)/page.tsx and src/components/landing/. Every deploy button takes a placement that becomes utm_content, so Railway's stats show which button converts.defaultTheme in src/app/layout.tsx (dark by default; enableSystem keeps the "System" option working).src/components/emails/, sending in src/lib/auth.ts.src/lib/auth.ts. Email verification is required to sign in (requireEmailVerification).├── prisma/
│ ├── schema.prisma # Database schema
│ └── migrations/ # Migration history
├── public/ # Static files (favicons, tech-stack logo SVGs)
├── railway.toml # Railway healthcheck and restart policy
├── src/
│ ├── app/ # Application routes (App Router)
│ │ ├── (auth)/ # Authentication routes
│ │ │ ├── login/
│ │ │ ├── signup/
│ │ │ ├── forgot-password/
│ │ │ └── reset-password/
│ │ ├── (public)/ # Public landing page
│ │ ├── (protected)/ # Routes requiring a session
│ │ │ ├── dashboard/ # User panel
│ │ │ └── admin/ # Admin panel (requires role === "admin")
│ │ ├── api/ # API Routes (Better Auth handler, health check)
│ │ ├── opengraph-image.tsx # Generated social preview image
│ │ ├── robots.ts # robots.txt
│ │ └── sitemap.ts # sitemap.xml
│ ├── components/ # React components
│ │ ├── admin/ # Admin panel components (+ auth-gate and layout/ subfolder)
│ │ ├── dashboard/ # User panel components (+ auth-gate and layout/ subfolder)
│ │ ├── emails/ # Email templates (React Email)
│ │ ├── landing/ # Public landing page components
│ │ ├── shared/ # Shared components (theme toggle, skeletons, ...)
│ │ └── ui/ # Base components (Shadcn UI on Base UI)
│ ├── generated/ # Generated code
│ │ └── prisma/ # Generated Prisma client (gitignored)
│ ├── hooks/ # Custom React Hooks
│ ├── lib/ # Utilities and configuration
│ │ ├── auth.ts # Better Auth configuration (server-only)
│ │ ├── auth-client.ts # Better Auth client (Client Components)
│ │ ├── constants.ts # Site name/URL and tracked Railway deploy link
│ │ ├── prisma.ts # Prisma client singleton
│ │ └── utils.ts # Helper functions
│ ├── proxy.ts # Optimistic redirect for /dashboard and /admin
│ ├── server/ # Server Actions
│ └── types/ # TypeScript type definitions
bun dev: Starts the development serverbun run build: Generates the Prisma client and builds the application for production (use bun run build, not bun build, which is Bun's own bundler)bun start: Applies pending migrations (prisma migrate deploy) and starts the production serverbunx tsc --noEmit: Type-checks the projectbun lint: Runs ESLint. It currently fails because typescript-eslint does not support TypeScript 7 yet (tracking issue); use bunx tsc --noEmit in the meantimebunx prisma studio: Opens Prisma Studio to visually manage the databasebunx prisma migrate dev: Creates and applies database migrationsbunx prisma generate: Regenerates the Prisma client after schema changes without creating a migrationThe project includes the following models:
role defaults to userClick the Deploy on Railway button at the top. The template provisions PostgreSQL and wires DATABASE_URL; bun start applies pending migrations on every start, and railway.toml configures the /api/health healthcheck (it runs SELECT 1 against the database) and restarts the service on failure.
After the first deploy:
BETTER_AUTH_SECRET, BETTER_AUTH_URL and NEXT_PUBLIC_BASE_URL are set. The last one is read at build time, so redeploy after changing it.RESEND_API_KEY (and EMAIL_SENDER_NAME / EMAIL_SENDER_ADDRESS) to enable verification and password-reset emails.GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET, and register https://<your-domain>/api/auth/callback/google as a redirect URI in Google Cloud Console.This project is under the MIT license.