
Neon Postgres Vercel Marketplace Template
A minimal template for building full-stack React applications using Next.js, Vercel, and Neon, shipping with Tailwind CSS, Shadcn UI and better-auth.
Getting Started
Click the "Deploy" button to clone this repo, create a new Vercel project, setup the Neon integration, and provision a new Neon database:
Once the process is complete, you can clone the newly created GitHub repository and start making changes locally.
Demo
View live demo: vercel-marketplace-neon.vercel.app
Local Setup
Installation
Install the dependencies:
npm installYou can use the package manager of your choice. For example, Vercel also supports bun install out of the box.
Development
Create a .env file in the project rootcp .env.example .envRun vercel env pull to fetch the environment variables from your Vercel project.
Alternatively, obtain the database connection string from the Connection Details widget on the Neon Dashboard and add it to the .env file:
DATABASE_URL=<postgres://user:pass@host/db>Run openssl rand -base64 32 to generate a secret and add it to .env:
BETTER_AUTH_SECRET=<generated-secret>Set the base URL of your application to your local development URL:
BETTER_AUTH_URL=http://localhost:3000Note: Make sure to set the base URL to your production Vercel URL for your production environment.
Start the development servernpm run devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project includes the Neon MCP server and neon-postgres agent skill for AI-assisted development with Neon Postgres. Both are configured for Cursor, Claude Code, VS Code, OpenCode, and Codex.
Shadcn/ui
This project uses shadcn/ui for building accessible and customizable UI components.
Configuration
Shadcn/ui is configured in components.json. The project uses:
- Style: New York
- Base Color: Neutral
- Icon Library: Lucide React
- CSS Variables: Enabled for theming
Adding Components
To add new shadcn/ui components:
npx shadcn@latest add [component-name]For example:
npx shadcn@latest add cardnpx shadcn@latest add dialogTheme Support
The project includes a theme provider and selector:
- Theme Provider:
src/components/themes/provider.tsx - Theme Selector:
src/components/themes/selector.tsx
Themes are managed using next-themes and support light, dark, and system preferences.
Existing Components
Button-src/components/ui/button.tsxDropdownMenu-src/components/ui/dropdown-menu.tsx
Learn More
Drizzle ORM
This project uses Drizzle ORM for type-safe database operations with PostgreSQL.
Configuration
Drizzle is configured in drizzle.config.ts. The database client is set up in src/lib/db/client.ts.
Schema
Database schemas are co-located with their features. Auth-related schemas (auto-generated by better-auth) are in src/lib/auth/schema.ts. You can add additional schema files for other features and they will be automatically detected by Drizzle Kit.
Database Scripts
npm run db:generate- Generate migration files from your schemanpm run db:migrate- Apply migrations to your databasenpm run db:studio- Open Drizzle Studio (visual database browser)
Usage Example
import { db } from "@/db/client";import { user } from "@/auth/schema";import { eq } from "drizzle-orm";
// Select all usersconst allUsers = await db.select().from(user);
// Insert a userawait db.insert(user).values({ id: "123", name: "John Doe", email: "john@example.com",});
// Update a userawait db.update(user) .set({ name: "Jane Doe" }) .where(eq(user.id, "123"));Running Migrations
- Update your schema files (e.g.,
src/lib/auth/schema.tsor other feature-specific schema files) - Generate migrations:
npm run db:generate - Review the generated SQL in the
drizzle/folder - Apply migrations:
npm run db:migrate
Learn More
Learn More
To learn more about Neon, check out the Neon documentation:
- Neon on Vercel Fluid Compute - learn about differnet datatabase connection methods on Fluid.
- Neon Documentation - learn about Neon's features and SDKs.
- Neon Discord - join the Neon Discord server to ask questions and join the community.
- ORM Integrations - find Object-Relational Mappers (ORMs) that work with Neon.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
Deploy on Vercel
Commit and push your code changes to your GitHub repository to automatically trigger a new deployment.
