Backend Setup Guide

Learn how to set up MongoDB+NextAuth or Supabase for your SuperFast application.

MongoDB + NextAuth Setup

Follow these steps to set up MongoDB and NextAuth for authentication in your SuperFast application.

1. Create a MongoDB Database

First, you need to create a MongoDB database. You can use MongoDB Atlas, which offers a free tier:

  1. Sign up for a MongoDB Atlas account
  2. Create a new project and deploy a cluster (the free tier is sufficient for development)
  3. Set up database access with a username and password
  4. In your project on MongoDB Atlas, click Network Access then + Add IP Address. Enter 0.0.0.0/0 in Access List Entry. This allows connections from your computer and your production deployment(s) (Vercel for instance).
  5. Get your connection string from the "Connect" button
  6. Run a local database for your dev setup so you can work offline and it's faster

2. Set Up Google OAuth

To enable Google authentication, follow these steps:

  1. Add these essential environment variables to your .env.local file:
  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to APIs & Services then Credentials
  4. Click Configure Consent Screen and fill in the required information
  5. Go back to Credentials and click + Create Credentials then OAuth Client ID
  6. Choose Web Application as the application type
  7. Add these to Authorized JavaScript origins:
    • http://localhost:3000
    • https://your-site.com
  8. Add these to Authorized redirect URIs:
    • http://localhost:3000/api/auth/callback/google
    • https://your-site.com/api/auth/callback/google
    • Note: If you're using a subdomain like www, make sure to add that too
  9. Click [Create] and copy the Client ID and Client Secret
  10. Add these to your .env.local:
  1. Go to OAuth Consent Screen and click Publish App then submit for verification
  2. Click Prepare for verification and fill in any missing information
  3. Important: Google will email you and you'll need to reply to start the verification process. You'll also need to have your domain verified with Google Search Console.
SuperFast - Go From Idea to Revenue in Just Days | Product Hunt