Create the Next.js App
Initialize a new Next.js application:
bunx create-next-app@latest my-app --ts --tailwind --react-compiler --no-linter --src-dir --app --use-bun
cd my-appbunx create-next-app@latest my-app --ts --tailwind --react-compiler --no-linter --src-dir --app --use-bun
cd my-appThis command uses the following recommended options: TypeScript and Tailwind CSS for type safety and utility-first styling, enables the React Compiler for automatic optimizations, skips linter configuration (can be added later if needed), organizes code inside a src/ directory for cleaner project structure, uses the App Router, and bootstraps with Bun as the package manager.
Setup Vercel Configuration
Install the Vercel config package to programatically configure the Vercel project:
bun add -D @vercel/configbun add -D @vercel/configCreate the vercel.ts file:
import type { VercelConfig } from "@vercel/config/v1";
export const config: VercelConfig = {};import type { VercelConfig } from "@vercel/config/v1";
export const config: VercelConfig = {};Configure Bun as the Runtime on Vercel (Optional)
Using Bun both as the package manager and runtime provides a consistent development experience. To configure Bun as the runtime on Vercel, add the following to the vercel.ts file:
import type { VercelConfig } from "@vercel/config/v1";
export const config: VercelConfig = {
bunVersion: "1.x",
};import type { VercelConfig } from "@vercel/config/v1";
export const config: VercelConfig = {
bunVersion: "1.x",
};Add Bun types for better TypeScript support:
bun add -D @types/bunbun add -D @types/bunInstall GitHub CLI
Install the GitHub CLI to manage your GitHub repositories:
brew install ghbrew install ghLogin to your GitHub account:
gh auth logingh auth loginCreate GitHub Repository
Initialize git and create a new GitHub repository inside the project root:
# Create GitHub repository and push
gh repo create my-app --public --source=. --push# Create GitHub repository and push
gh repo create my-app --public --source=. --pushThe gh repo create command:
- Creates a new repository on GitHub
- Sets the remote origin
- Pushes your local code
Use --private instead of --public for a private repository.
Install Vercel CLI
Install the Vercel CLI globally to manage your Vercel projects:
bun add -g vercelbun add -g vercelAuthenticate with Vercel:
vercel loginvercel loginDeploy to Vercel
Link your project to Vercel and deploy:
# Deploy to Vercel (creates project on first run)
vercel# Deploy to Vercel (creates project on first run)
vercelOn first run, you'll be prompted to:
- Set up and deploy the project
- Link to an existing project or create a new one
- Configure project settings
Connect Git for Automatic Deployments
Connect your GitHub repository to enable automatic deployments on push:
vercel git connectvercel git connectThis links your local Git repository to your Vercel project, enabling:
- Automatic deployments on push to main branch
- Preview deployments for pull requests
- Deployment status checks on GitHub
Deployment Workflow
After initial setup, your workflow is:
- Develop locally:
bun run dev - Commit and push:
git push origin main - Automatic deployment: Vercel deploys on push