Documentation

Installation Guide

Complete setup guide for all features including database, authentication, payments, and email services.

1. Unpack & Install Dependencies

Every customer receives StartupKit as a downloadable .zip file ready to import into your own Git host (or keep private). Unzip it, enter the folder, then install dependencies:

unzip startupkit.zip cd startupkit npm install

2. MongoDB Setup

You’ll need a MongoDB database. We recommend MongoDB Atlas for production:

  1. Go to MongoDB Atlas
  2. Create a free account and a new cluster
  3. Click “Connect” and choose “Connect your application”
  4. Copy the connection string
  5. Replace <password> with your database user password

Your connection string should look like:

mongodb+srv://username:password@cluster.mongodb.net/dbname?retryWrites=true&w=majority

3. Environment Variables

Copy the example environment file:

cp .env.example .env

Required Variables

# Database
DATABASE_URL="your-mongodb-connection-string"

# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="generate-with-openssl-rand-base64-32"

Generate NEXTAUTH_SECRET

openssl rand -base64 32

4. Google OAuth Setup (Optional)

To enable Google authentication:

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to “APIs & Services” → “Credentials”
  4. Click “Create Credentials” → “OAuth client ID”
  5. Select “Web application”
  6. Add authorized redirect URI: http://localhost:3000/api/auth/callback/google
  7. Copy the Client ID and Client Secret

Add to your .env:

GOOGLE_CLIENT_ID="your-client-id"
GOOGLE_CLIENT_SECRET="your-client-secret"

5. Stripe Setup

For subscription billing and payments:

Create Stripe Account

  1. Sign up at Stripe
  2. Go to Developers → API keys
  3. Copy your Publishable key and Secret key

Create Products and Prices

  1. Go to Products in Stripe Dashboard
  2. Create a product for each plan (Starter, Foundation, Accelerate)
  3. Add a recurring price to each product
  4. Copy the Price ID for each plan

Add to your .env:

STRIPE_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..." # We'll get this in step 6

# Price IDs from your Stripe products
STRIPE_STARTER_PRICE_ID="price_..."
STRIPE_FOUNDATION_PRICE_ID="price_..."
STRIPE_ACCELERATE_PRICE_ID="price_..."

Update Stripe Configuration

Edit src/lib/stripe.ts and update the plan details to match your Stripe products:

export const STRIPE_PLANS = {
  STARTER: {
    id: "starter",
    name: "Starter",
    price: 29, // Your price in dollars
    priceId: process.env.STRIPE_STARTER_PRICE_ID!,
    // ... update features
  },
  // ... update other plans
};

6. Stripe Webhooks

Webhooks are required for subscription updates:

Local Development (Stripe CLI)

  1. Install Stripe CLI
  2. Login: stripe login
  3. Forward webhooks: stripe listen --forward-to localhost:3000/api/stripe/webhook
  4. Copy the webhook signing secret shown (starts with whsec_)
  5. Add it to your .env as STRIPE_WEBHOOK_SECRET

Production Webhooks

  1. Go to Developers → Webhooks in Stripe Dashboard
  2. Click “Add endpoint”
  3. Enter your endpoint: https://yourdomain.com/api/stripe/webhook
  4. Select these events:
    • checkout.session.completed
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
  5. Copy the webhook signing secret to your production environment

7. Resend Email Setup

For transactional emails:

  1. Sign up at Resend
  2. Go to API Keys and create a new key
  3. Add your domain in Settings → Domains (or use onboarding@resend.dev for testing)
  4. Follow the DNS verification steps

Add to your .env:

RESEND_API_KEY="re_..."
EMAIL_FROM="noreply@yourdomain.com"
ADMIN_EMAIL="admin@yourdomain.com"

⚠️ Email Deliverability

For testing, you can use onboarding@resend.dev as your EMAIL_FROM. For production, you must verify your domain to ensure email delivery.

8. Database Schema Setup

Initialize your database with Prisma:

npx prisma generate npx prisma db push

This will create all required tables and generate the Prisma client.

9. Run the Application

Start the development server:

npm run dev

Open http://localhost:3000 in your browser.

10. Test the Setup

Authentication:

  • Create an account at /register
  • Check your terminal for the verification email link
  • Verify your email and log in

Subscriptions:

  • Navigate to Billing in the dashboard
  • Select a plan and use Stripe test card: 4242 4242 4242 4242
  • Use any future expiry date and any CVC
  • Verify subscription appears in your Stripe Dashboard

✅ Setup Complete!

Your SaaS application is now fully configured with authentication, billing, and email services.

Troubleshooting

Database connection errors

Verify your MongoDB connection string and ensure your IP is whitelisted in MongoDB Atlas.

OAuth not working

Check that your redirect URIs match exactly in Google Cloud Console. For production, update them to your domain.

Stripe webhooks failing

Ensure Stripe CLI is running for local development. Check webhook signing secret matches your .env file.

Emails not sending

Verify your Resend API key is correct. Use onboarding@resend.dev for testing, or ensure your domain is verified for production.

Next Steps