Quick Start Guide

Get started with Nuxflare Pro.

This guide will help you get started with setting up your development environment and deploying Nuxflare Pro to your Cloudflare account.

Prerequisites

Before you begin, you'll need:

  • A Cloudflare account
  • A domain configured with Cloudflare nameservers
  • GitHub access to the Nuxflare repository (nuxflare/pro)

Repository Structure

Nuxflare Pro is organized as a monorepo with multiple packages:

  • packages/app: Main Nuxt application
  • packages/web: Customer-facing landing page, blogs, and documentation
  • packages/auth-frontend: Login/signup UI
  • packages/functions: Cloudflare Workers code (auth server, email worker, websockets server)
  • packages/emails: Email templates using React Email

Setup Steps

1. Install Bun

Nuxflare Pro uses Bun as its package manager for speed and developer experience:

Note: It's recommended to always use the latest version of Bun. We use the bun.lock file instead of the bun.lockb that was introduced in Bun v1.2.

curl -fsSL https://bun.sh/install | bash

2. Configure Cloudflare Access

  1. Create a Cloudflare API token with the required permissions using this link.
  2. Add the token to your environment:
    export CLOUDFLARE_API_TOKEN=your_token_here
    

3. Clone and Install

  1. Clone the repository
    # Using HTTPS
    git clone https://github.com/nuxflare/pro.git your-project-name
    # Or using SSH
    git clone git@github.com:nuxflare/pro.git your-project-name
    
    cd your-project-name
    
  2. Install dependencies:
    bun i
    
  3. Generate D1 migrations
    # we can use the -F flag to run a script
    # inside the functions package from the root
    bun -F '*' generate-migrations
    # alternatively, you can cd into the package manually
    cd packages/functions
    bun run generate-migrations
    

4. Configure Your Environment

config.ts
export const prodDomain = "prodemo.nuxflare.com";
export const devDomain = "dev.nuxflare.com";
export const authEmail = {
  name: "Tanay Karnik",
  address: "auth@pro.nuxflare.com",
};
export const authEmailDomain = "pro.nuxflare.com";
export const flags: {
  stripe?: boolean;
  paddle?: boolean;
  googleAuth?: boolean;
  githubAuth?: boolean;
  resend?: boolean;
  mailgun?: boolean;
  ses?: boolean;
  sparkPost?: boolean;
  smtp?: boolean;
  websockets?: boolean;
  cron?: boolean;
  jobsQueue?: boolean;
  openai?: boolean;
} = {
  stripe: true,
  paddle: true,
  githubAuth: true,
  googleAuth: true,
  resend: true,
  websockets: true,
  jobsQueue: true,
  openai: true,
};
  1. Open config.ts and set up the following:
    • devDomain: Your development domain
    • prodDomain: Your production domain
    • authEmail: Authentication email
    • Feature flags:
      • Disable websockets and queues if you don't have Cloudflare Workers Paid
      • Configure your preferred email provider

5. Set Up Secrets

Nuxflare Pro uses SST.dev for secret management instead of .env files. To set up your development secrets:

  1. Create a temporary .env file with your required secrets
    ResendApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    GithubClientID=XXXXXXXXXXXXXXXXXXXX
    GithubClientSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    GoogleClientID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    GoogleClientSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    OpenAIApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    StripeWebhookSecretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    StripeSecretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    PaddleApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    PaddleWebhookSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    
  2. Load the secrets into SST:
    bun sst secret load .env
    
  3. You can now remove the temporary .env file

6. Deploy Your Instance

Deploy your development instance:

bun run deploy

This will deploy to your development stage (e.g., if your devDomain is dev.nuxflare.com, it will deploy to username.dev.nuxflare.com).

7. Development Workflow

You have two options for local development:

  1. Local Development Server:
    bun run app    # Run the main app locally
    bun run web    # Run the web frontend locally
    
    • Local development uses wrangler/miniflare for Cloudflare services (D1, KV, R2)
  2. Remote Development:
    bun run app-remote    # Connect to remote infrastructure
    
    • Useful for debugging deployed instances using NuxtHub dev tools

8. Seed Initial Data

After deployment, you'll need to seed your database/KV with initial data:

  1. Start your development server:
    bun run app        # for seeding the local dev instance
    # OR
    bun run app-remote # for seeding a remote instance
    
  2. Open the Nuxt Dev Tools
  3. Navigate to "Nitro Tasks"
  4. Run the seed task to create:
    • Roles
    • Plans
    • OpenAI assistant
    • Stripe cancel configuration

Deployment Stages

Nuxflare Pro supports multiple deployment stages:

  • Development: Uses your username as the stage name by default
  • Production: Deploy using:
    SST_STAGE=production bun run deploy
    
  • Custom development stages: Set SST_STAGE to any name you choose