Getting Started with RankThis Template

Complete setup guide for the RankThis SaaS template - from installation to deployment

8 min readby RankThis Team
getting-startedsetuptutorialdeployment

This comprehensive guide will walk you through setting up the RankThis template from scratch, customizing it for your needs, and deploying it to production.

Prerequisites

Before you begin, make sure you have:

  • Node.js 18+ installed
  • pnpm package manager
  • A code editor (we recommend Cursor!)
  • Git for version control

Step 1: Project Setup

Clone and Install

# Clone the repository
git clone <your-repo-url>
cd RankThis

# Install dependencies
pnpm install

Environment Configuration

Create a .env file based on the example:

cp .env.example .env

Fill in your environment variables:

# Database
DATABASE_URL="postgresql://..."
PREVIEW_DATABASE_URL="postgresql://..."

# Authentication
NEXTAUTH_SECRET="your-secret-here"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

# Stripe
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
STRIPE_PRICE_ID_MONTHLY="price_..."
STRIPE_PRICE_ID_YEARLY="price_..."

# Email (Optional)
RESEND_API_KEY="re_..."

Step 2: Database Setup

Local Development

# Start local database (optional)
./start-database.sh

# Generate Prisma client and run migrations
pnpm db:generate
pnpm db:push

Production Database

For production, we recommend using Neon for PostgreSQL:

  1. Create a Neon account
  2. Create a new project
  3. Copy the connection string to your environment variables

Step 3: Authentication Setup

Google OAuth

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable Google+ API
  4. Create OAuth 2.0 credentials
  5. Add your domain to authorized origins
  6. Copy Client ID and Secret to your .env

Magic Link (Optional)

The template includes magic link authentication. Configure your email provider (Resend recommended) for production use.

Step 4: Stripe Configuration

Create Products and Prices

  1. Go to Stripe Dashboard
  2. Create products for your subscription tiers
  3. Create prices for monthly and yearly billing
  4. Copy the price IDs to your environment variables

Webhook Setup

# Install Stripe CLI
stripe listen --forward-to localhost:3000/api/webhooks/stripe

For production, configure webhooks in the Stripe dashboard pointing to your domain.

Step 5: Customization

Branding and Design

The template uses a well-structured design system. Customize it in tailwind.config.ts:

colors: {
  background: {
    primary: "#YOUR_BRAND_COLOR",
    card: "#FFFFFF",
  },
  foreground: {
    primary: "#1F2937",
    muted: "#6B7280",
  },
  primary: {
    DEFAULT: "#YOUR_PRIMARY_COLOR",
    foreground: "#FFFFFF",
  },
}

Content Customization

  • Update the homepage in src/app/page.tsx
  • Modify the navigation in src/app/layout.tsx
  • Customize the blog content in src/content/blog/

Feature Toggles

The template includes several features you can enable/disable:

  • Blog system (already configured)
  • Analytics (PostHog)
  • Email notifications
  • Subscription management

Step 6: Development

Start Development Server

pnpm dev

Visit http://localhost:3000 to see your application.

Using Cursor for Development

This template works excellently with Cursor AI. Check out our Cursor Guide for tips on rapid development.

Step 7: Testing

Run Quality Checks

# Type checking
pnpm typecheck

# Linting
pnpm lint

# Format code
pnpm format:write

Test Key Features

  1. Authentication: Test sign-in with Google and magic link
  2. Subscriptions: Test Stripe checkout flow
  3. Blog: Verify MDX rendering and navigation
  4. Responsive Design: Test on mobile and desktop

Step 8: Deployment

Vercel (Recommended)

  1. Connect your GitHub repository to Vercel
  2. Add environment variables in Vercel dashboard
  3. Deploy automatically on push to main

Environment Variables for Production

Make sure to set all environment variables in your deployment platform:

  • Database URLs
  • Authentication secrets
  • Stripe keys
  • Email configuration

Database Migrations

The template includes GitHub Actions for safe database migrations:

  • Preview environment auto-migrates on push
  • Production requires manual confirmation
  • Includes backup verification

Common Issues and Solutions

Database Connection Issues

# Check if database is accessible
pnpm db:studio

# Reset database if needed
pnpm db:reset

Authentication Problems

  • Verify Google OAuth credentials
  • Check redirect URIs in Google Console
  • Ensure NEXTAUTH_SECRET is set

Stripe Integration Issues

  • Verify webhook endpoints
  • Check price IDs in environment variables
  • Test with Stripe CLI locally

Next Steps

Now that you have the template set up, consider:

  1. Customizing the design to match your brand
  2. Adding your own features using the existing patterns
  3. Setting up monitoring with PostHog
  4. Configuring email templates for better user experience
  5. Adding more blog content to showcase your expertise

Resources


Ready to build something amazing? Start customizing the template and bring your SaaS idea to life! 🚀