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 applicationpackages/web
: Customer-facing landing page, blogs, and documentationpackages/auth-frontend
: Login/signup UIpackages/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 thebun.lockb
that was introduced in Bun v1.2.
curl -fsSL https://bun.sh/install | bash
2. Configure Cloudflare Access
- Create a Cloudflare API token with the required permissions using this link.
- Add the token to your environment:
export CLOUDFLARE_API_TOKEN=your_token_here
3. Clone and Install
- 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
- Install dependencies:
bun i
- 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
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,
};
- Open
config.ts
and set up the following:devDomain
: Your development domainprodDomain
: Your production domainauthEmail
: 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:
- Create a temporary
.env
file with your required secretsResendApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX GithubClientID=XXXXXXXXXXXXXXXXXXXX GithubClientSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX GoogleClientID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX GoogleClientSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX OpenAIApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX StripeWebhookSecretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX StripeSecretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX PaddleApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX PaddleWebhookSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Load the secrets into SST:
bun sst secret load .env
- 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:
- 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)
- 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:
- Start your development server:
bun run app # for seeding the local dev instance # OR bun run app-remote # for seeding a remote instance
- Open the Nuxt Dev Tools
- Navigate to "Nitro Tasks"
- 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