init

Initialize a new VexBlocks project

Usage

npx @vexblocks/cli init [options]

Description

The init command creates a new VexBlocks project with a complete Turborepo monorepo structure. It sets up all necessary configuration files and prepares your project for development.

What It Does

Running this command will:

  • Detect if you're in an existing Turborepo project
  • Create a new project directory (if creating a new project)
  • Set up the monorepo structure with apps and packages folders
  • Generate configuration files (package.json, turbo.json, pnpm-workspace.yaml)
  • Create a vexblocks.json manifest file
  • Set up environment variable templates

Interactive Setup

When you run init, you'll be guided through an interactive setup:

Choose Project Type

Select whether to create a new Turborepo project or add VexBlocks to an existing one.

If the CLI detects an existing turbo.json file, it will automatically skip to initializing in the current directory.

Enter Project Name

If creating a new project, you'll be prompted for a project name. The name must contain only lowercase letters, numbers, hyphens, and underscores.

Confirm Setup

Review the setup and confirm to proceed. The CLI will create all necessary files and directories.

Options

OptionTypeDescription
--yes, -ybooleanSkip all prompts and use defaults
--cwdstringWorking directory for the command

Examples

Create a New Project

npx @vexblocks/cli init

This will prompt you to create a new Turborepo project.

Initialize in Current Directory

If you already have a Turborepo project, navigate to its root and run:

npx @vexblocks/cli init

Skip All Prompts

npx @vexblocks/cli init --yes

Generated Structure

After initialization, your project will have this structure:

my-vexblocks-project/
├── apps/                      # Application packages
├── packages/                  # Shared packages
├── .gitignore
├── .env.example              # Environment variables template
├── package.json              # Root package.json
├── pnpm-workspace.yaml       # pnpm workspace config
├── turbo.json                # Turborepo configuration
└── vexblocks.json            # VexBlocks manifest

Environment Variables

The CLI creates an .env.example file with all required environment variables:

# Convex
CONVEX_DEPLOYMENT=
NEXT_PUBLIC_CONVEX_URL=

# Better Auth
SITE_URL=http://localhost:3001

# Cloudflare Images (optional)
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_SECRET_TOKEN=

# Revalidation (optional)
REVALIDATE_SECRET=
FRONTEND_URL=http://localhost:3000

Important: Copy .env.example to .env.local and fill in your actual values before running the project.

Next Steps

After initialization, you should:

  1. Navigate to your project directory: cd my-vexblocks-project
  2. Install dependencies: pnpm install
  3. Add VexBlocks packages: npx @vexblocks/cli add all
  4. Set up your Convex project
  5. Start development: pnpm dev

Related Commands