-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: simplify to minimal Next.js starter (remove auth/db, retain UI stack) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bd42193
79c8068
d537670
284d8d2
e120cdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,9 @@ | ||
| # Since .env is gitignored, you can use .env.example to build a new `.env` file when you clone the repo. | ||
| # Keep this file up-to-date when you add new variables to \`.env\`. | ||
| # Environment variables are optional for this starter. | ||
| # You can copy this file to `.env` and uncomment values if needed. | ||
|
|
||
| # This file will be committed to version control, so make sure not to have any secrets in it. | ||
| # If you are cloning this repo, create a copy of this file named `.env` and populate it with your secrets. | ||
| # Public base URL of your site (optional) | ||
| # NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
|
|
||
| # When adding additional environment variables, the schema in "/src/env.ts" | ||
| # should be updated accordingly. | ||
|
|
||
| # Database URL | ||
| # The database URL is used to connect to your database. It's used for commenting, and authentication. | ||
| DATABASE_URL="postgresql://postgres:<YOUR_PASSWORD>@localhost:5432/starter" | ||
|
|
||
| # Authentication | ||
| # You can generate the secret via 'openssl rand -base64 32' on Unix | ||
| # @see https://www.better-auth.com/docs/installation | ||
| BETTER_AUTH_SECRET="" | ||
|
|
||
| # CORS allowed origins for auth endpoints | ||
| # Accepts a comma-separated list OR a JSON array of URLs | ||
| CORS_ORIGIN="http://localhost:3000" | ||
|
|
||
| # Production URL | ||
| # Used for authentication and metadata generation | ||
| NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
| # Build-time / tooling (optional) | ||
| # ANALYZE=false | ||
| # SOURCE_MAPS=false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,129 +1,34 @@ | ||
| <p align="center"> | ||
| <img alt="" src="/.github/assets/cover.png" /> | ||
| </p> | ||
| # Next.js Starter | ||
|
|
||
| <h1 align="center"> | ||
| Better Auth Next.js Starter | ||
| </h1> | ||
| A minimal, clean Next.js starter that preserves a polished UI foundation without authentication or a database. | ||
|
|
||
| <p align="center"> | ||
| <a aria-label="Framework" href="https://nextjs.org"> | ||
| <img alt="" src="https://img.shields.io/badge/Next.js-000000.svg?style=for-the-badge&logo=Next.js&labelColor=000"> | ||
| </a> | ||
| <img alt="" src="https://img.shields.io/github/languages/top/techwithanirudh/better-auth-nextjs-starter?style=for-the-badge&labelColor=000"> | ||
| <a aria-label="License" href="https://github.com/techwithanirudh/better-auth-nextjs-starter/blob/main/LICENSE"> | ||
| <img alt="" src="https://img.shields.io/github/license/techwithanirudh/better-auth-nextjs-starter?style=for-the-badge&labelColor=000"> | ||
| </a> | ||
| </p> | ||
| Features | ||
| - Next.js (App Router) + TypeScript (strict) | ||
| - Tailwind CSS v4 with modern design tokens | ||
| - shadcn/ui components (Button, Card, Input, and more) | ||
| - Dark mode via next-themes | ||
| - Toasts with sonner | ||
| - Navigation progress bar with bprogress | ||
| - SEO metadata helpers and sensible security headers | ||
|
|
||
| ## Quickstart | ||
| Pages included | ||
| - `/` — Welcome page with quick links and stack overview | ||
| - `/about` — Example static page showing metadata usage | ||
| - `/components` — Simple gallery using shadcn/ui components | ||
| - `/api/health` — Minimal API responding with `{ status: "ok" }` | ||
|
Comment on lines
+5
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix markdownlint issues (blank lines + bare URLs). Add blank lines around lists and format URLs as Markdown links. -Features
+- Features
+
- Next.js (App Router) + TypeScript (strict)
@@
-Pages included
+- Pages included
+
- `/` — Welcome page with quick links and stack overview
@@
-Getting started
+- Getting started
+
This starter has zero required environment variables. Clone the repo and start building.
@@
-How to add Auth and DB later
+- How to add Auth and DB later
+
-- Auth: better-auth — https://better-auth.com/docs
-- UI: better-auth-ui — https://better-auth-ui.com
-- ORM/DB: Drizzle ORM — https://orm.drizzle.team/docs
+- Auth: better-auth — <https://better-auth.com/docs>
+- UI: better-auth-ui — <https://better-auth-ui.com>
+- ORM/DB: Drizzle ORM — <https://orm.drizzle.team/docs>
@@
-Notes
+- Notes
+
- The project intentionally excludes auth and database code to give you a clean base. Add your preferred solutions when you need them.Also applies to: 20-27, 28-35 🧰 Tools🪛 markdownlint-cli2 (0.17.2)6-6: Lists should be surrounded by blank lines (MD032, blanks-around-lists) 15-15: Lists should be surrounded by blank lines (MD032, blanks-around-lists) 🤖 Prompt for AI Agents |
||
|
|
||
| 1) Create a PostgreSQL database (local or hosted). | ||
| Getting started | ||
| This starter has zero required environment variables. Clone the repo and start building. | ||
|
|
||
| 2) Copy `.env.example` in the project root and fill in the variables below. | ||
|
|
||
| 3) Generate schema and run database migrations. | ||
|
|
||
| ```bash | ||
| bun run auth:generate | ||
| bun run db:generate | ||
| bun run db:push | ||
| ``` | ||
|
|
||
| 4) Start the dev server. | ||
|
|
||
| ```bash | ||
| bun run dev | ||
| ``` | ||
|
|
||
|
|
||
| ## Environment variables | ||
|
|
||
| All configuration is typed and validated in `src/env.ts`. Requiredness differs between development and production as described. | ||
|
|
||
| ```bash | ||
| # Runtime (server-only) | ||
|
|
||
| # PostgreSQL connection string (required) | ||
| # Format must be a valid URL | ||
| DATABASE_URL="postgresql://postgres:<YOUR_PASSWORD>@localhost:5432/starter" | ||
|
|
||
| # Better Auth secret (required in production; optional in development) | ||
| # You can generate via: openssl rand -base64 32 | ||
| # Docs: https://www.better-auth.com/docs/installation#set-environment-variables | ||
| BETTER_AUTH_SECRET="" | ||
|
|
||
| # CORS allowed origins for auth endpoints | ||
| # Accepts a comma-separated list OR a JSON array of URLs | ||
| # Examples: | ||
| # CORS_ORIGIN="http://localhost:3000,https://your-domain.com" | ||
| # CORS_ORIGIN='["http://localhost:3000","https://your-domain.com"]' | ||
| CORS_ORIGIN="http://localhost:3000" | ||
|
|
||
| # Google Gemini API key (required) | ||
| GOOGLE_GENERATIVE_AI_API_KEY=your_gemini_api_key_here | ||
|
|
||
|
|
||
| # Runtime (client-exposed) | ||
|
|
||
| # Public base URL of your site (required) | ||
| # Must be a full URL including protocol | ||
| # Example (dev): http://localhost:3000 | ||
| # Example (prod): https://your-domain.com | ||
| NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
|
|
||
|
|
||
| # Build-time / tooling (optional) | ||
|
|
||
| # Enable bundle analyzer for production builds | ||
| ANALYZE=false | ||
|
|
||
| # Emit production browser source maps | ||
| SOURCE_MAPS=false | ||
| ``` | ||
| How to add Auth and DB later | ||
| - Auth: better-auth — https://better-auth.com/docs | ||
| - UI: better-auth-ui — https://better-auth-ui.com | ||
| - ORM/DB: Drizzle ORM — https://orm.drizzle.team/docs | ||
|
|
||
| Notes | ||
| - `CORS_ORIGIN` may be a single URL, a comma-separated list, or a JSON array. All values must be valid URLs. | ||
| - `BETTER_AUTH_SECRET` is mandatory in production. In development it can be left empty to use the library defaults, but setting it early avoids surprises. | ||
| - `NEXT_PUBLIC_BASE_URL` is used for authentication, metadata, and sitemap generation. It must be the publicly reachable URL of your app. | ||
|
|
||
|
|
||
| ## Database and migrations | ||
|
|
||
| This starter uses Drizzle ORM with PostgreSQL. Common commands: | ||
|
|
||
| ```bash | ||
| # Generate SQL from schema | ||
| bun run db:generate | ||
|
|
||
| # Apply migrations | ||
| bun run db:push | ||
|
|
||
| # Open Drizzle Studio | ||
| bun run db:studio | ||
| ``` | ||
|
|
||
|
|
||
| ## Features | ||
|
|
||
| [Better Auth](https://better-auth.com) | ||
|
|
||
| [Better Auth UI](https://better-auth-ui.com) | ||
|
|
||
| [shadcn/ui](https://ui.shadcn.com) | ||
|
|
||
| [TailwindCSS](https://tailwindcss.com) | ||
|
|
||
| [Drizzle ORM](https://orm.drizzle.team) | ||
|
|
||
| [PostgreSQL](https://postgresql.org) | ||
|
|
||
| [Biome](https://biomejs.dev) | ||
|
|
||
| [Next.js](https://nextjs.org) | ||
|
|
||
| ## Deploy on Vercel | ||
|
|
||
| The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme). | ||
| - The project intentionally excludes auth and database code to give you a clean base. Add your preferred solutions when you need them. | ||
| - Type checking, linting, and formatting are configured via TypeScript and Biome. | ||
| - Sitemap generation is included via next-sitemap. | ||
|
|
||
| After creating a project, set the environment variables from the section above in the Vercel project settings and redeploy. | ||
| License | ||
| MIT | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Prefer .env.local and verify unused vars.
Next.js commonly uses .env.local for local overrides. Also, confirm
ANALYZE/SOURCE_MAPSare actually consumed.Run to verify usage:
🏁 Script executed:
Length of output: 431
Prefer .env.local; ANALYZE and SOURCE_MAPS are used.
next.config.ts reads process.env.ANALYZE (line 45) and process.env.SOURCE_MAPS (line 13) — change the .env.example instruction to copy to
.env.localand keep the ANALYZE/SOURCE_MAPS entries. Optionally add NEXT_TELEMETRY_DISABLED=1.📝 Committable suggestion
🤖 Prompt for AI Agents