DocumentationGetting StartedInstallation

Installation

Get started with this T3 + Cloudflare starter template in just a few minutes.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 20.x or later
  • npm 10.x or later (comes with Node.js)
  • Git for version control

Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/yourusername/yourproject.git
cd yourproject

Install Dependencies

Install all required dependencies using npm:

npm install

This will install all packages listed in package.json, including:

  • Next.js framework
  • Drizzle ORM for database
  • NextAuth.js for authentication
  • Stripe for payments
  • shadcn/ui components

Environment Setup

Create a .env file in the root directory by copying the example:

cp .env.example .env

Open .env and configure the following essential variables:

# Database
DATABASE_URL="file:./local.db"

# Authentication
AUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"

# Stripe (optional for development)
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."

# Email (optional for development)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_USER="your-email@gmail.com"
SMTP_PASSWORD="your-app-password"

Generate AUTH_SECRET

Generate a secure random string for AUTH_SECRET:

openssl rand -base64 32

Database Setup

Initialize your database with Drizzle:

# Generate migrations
npm run db:generate
 
# Apply migrations
npm run db:push

Run Development Server

Start the development server:

npm run dev

Open http://localhost:3000 in your browser to see your application.

Verify Installation

To verify everything is working correctly:

  1. Visit http://localhost:3000 - you should see the home page
  2. Navigate to /register - you should see the registration page
  3. Check the console for any errors

Next Steps

Now that you have everything installed, proceed to:

Troubleshooting

Port Already in Use

If port 3000 is already in use, you can start the dev server on a different port:

npm run dev -- -p 3001

Database Connection Errors

If you encounter database connection errors:

  1. Ensure DATABASE_URL is correctly set in .env
  2. Delete local.db and run npm run db:push again
  3. Check file permissions

Module Not Found Errors

If you see “module not found” errors:

  1. Delete node_modules and package-lock.json
  2. Run npm install again
  3. Restart your development server