Skip to content

Deploy To Netlify

LaunchFast Starter Kits can be deployed to Netlify with 0-config setup. Following are the steps to ensure a hassle-free experience of deployment of LaunchFast to Netlify.

Terminal to Netlify Deployments

  • Locally, set .env to contain DEPLOYMENT_PLATFORM as netlify.
  • Perform the build of the app using npm run build and make sure to check if the terminal outputs @netlify being used as the Astro adapter used to build.
  • Once done, verify if your app now has a .functions-internal directory.
  • Great! Now do a deploy to Netlify with netlify deploy --prod.
  • Once done, go to Netlify settings and paste your whole .env file in the Environment Variables section.
  • With that done, deploy again with netlify deploy --prod and you are good to go.
  • GitHub for Netlify Deployments

  • Go to app.netlify.com, and then click on create a new site.
  • Select Deploy from GitHub, and then select your repository.
  • Update the build command to be npm run build.
  • Update the functions directory to be .netlify/functions-internal.
  • Update the publish directory to be dist.
  • The most important step here would now be to add all of your Environment Variables from the local .env file by clicking the button Add environment variable below the publish directory field. Make sure to have an Envrionment Variable named DEPLOYMENT_PLATFORM set to netlify, and in general use ... as the value for the environment variables that are not being used but set them anyways to not encounter build time errors (ofcourse, that won’t run in production and this is just to test the system out). Rest, below are some of the values that can be used for just deploying and then iterating.
  • Terminal window
    # Deployment Platform Environment Variable
    DEPLOYMENT_PLATFORM="netlify"
    # Emails
    ## "resend" or "nodemailer"
    EMAIL_PROVIDER="resend"
    ## Resend Environment Variables
    RESEND_KEY="..."
    ## SMTP2GO Environment Variables
    SMTP2GO_USERNAME="..."
    SMTP2GO_PASSWORD="..."
    ## When a user will sign up using credentials,
    ## Visiting this URL will allow them to register them as verified in your db
    ## An email is sent to the user with the following url appended with a randomly generated token query parameter
    EMAIL_VERIFICATION_ENDPOINT_URL="https://launchfast-astro-ts.vercel.app/api/email/verify"
    EMAIL_PASSWORD_RESET_URL="https://launchfast-astro-ts.vercel.app/forgot-password"
    # Database
    ## "pg" OR "redis" OR "mongodb" OR "sqlite" OR "firestore"
    DATABASE_TYPE="pg"
    ## Redis (/Upstash) Environment Variable
    REDIS_URL="redis://default:...@...upstash.io:..."
    ## Postgres (/Neon) Environment Variable
    POSTGRES_URL="postgresql://neondb_owner:...@...-pooler.us-east-2.aws.neon.tech/neondb?sslmode=require"
    ## MongoDB Environment Variable
    MONGODB_URL="mongodb+srv://<username>:<password>@<prefix>.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
    ## SQLite Environment Variable
    SQLITE_URL="libsql://....turso.io"
    SQLITE_AUTH_TOKEN="..."
    # Storage
    ## "s3" or "supabase" or "firebase"
    STORAGE_PROVIDER="firebase"
    ## Supabase
    SUPABASE_BUCKET_NAME="..."
    SUPABASE_URL="https://....supabase.co"
    SUPABASE_ANON_KEY="............"
    ## AWS S3 (/Cloudflare R2)
    AWS_KEY_ID="..." # Set to Cloudflare's R2 Secret Key if using Cloudflare R2
    AWS_SECRET_ACCESS_KEY=".../...+" # Set to Cloudflare's R2 Secret Access Key if using Cloudflare R2
    AWS_S3_BUCKET_NAME="...-bucket-0" # Set to Cloudflare's R2 Bucket Name if using Cloudflare R2
    AWS_REGION_NAME="eu-north-1" # Set to us-east-1 only if using Cloudflare R2
    CLOUDFLARE_R2_ACCOUNT_ID="..."
    ## Firebase
    FIREBASE_PROJECT_ID="..."
    FIREBASE_PRIVATE_KEY_ID="..."
    FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
    FIREBASE_CLIENT_EMAIL="firebase-adminsdk-..@...iam.gserviceaccount.com"
    FIREBASE_CLIENT_ID="..."
    FIREBASE_STORAGE_BUCKET="gs://...appspot.com"
    # Authentication
    ## Twitter Environment Variables
    TWITTER_CLIENT_ID="..."
    TWITTER_CLIENT_SECRET="..."
    TWITTER_AUTH_CALLBACK_URL="http://127.0.0.1:3000/api/auth/callback/twitter"
    ## Google OAuth 2.0 Environment Variables
    GOOGLE_AUTH_ID="....apps.googleusercontent.com"
    GOOGLE_AUTH_SECRET="...-...-..."
    GOOGLE_AUTH_CALLBACK_URL="http://localhost:3000/api/auth/callback/google"
    # Payments
    ## Stripe Environment Variables
    STRIPE_SECRET_KEY="sk_live_..."
    STRIPE_WEBHOOK_SIG="..."
    # AI
    ## OpenAI Environment Variable
    OPENAI_API_KEY="sk-..."
    # Social Media
    ## Telegram Bot Environment Variables
    TELEGRAM_BOT_TOKEN="..."
    # Website
    ## Website URL
    SITE="https://launchfast-nextjs-ts.vercel.app"
    ## Admin Request Verification Key
    PRIVATE_ACCESS_KEY="..." # generate using `openssl rand -base64 32`
    ## JWT Verification Key
    SECRET_KEY="..."
    ## Server Specific Configurations
    NODE_VERSION="18"
    HOST="0.0.0.0"
    PORT="3000"