Skip to main content
The flash init command creates a new Flash project with a complete project structure, including example and , and configuration files. This gives you a working starting point for building Flash applications. Use flash init whenever you want to start a new Flash project, fully configured for you to run flash run and flash deploy.

Create a new project

Create a new project in a new directory:
flash init PROJECT_NAME
cd PROJECT_NAME
Or initialize in your current directory:
flash init .

Project structure

flash init creates the following structure:
PROJECT_NAME
lb_worker.py
gpu_worker.py
cpu_worker.py
.env.example
.flashignore
.gitignore
pyproject.toml
requirements.txt
README.md

Key files

lb_worker.py: An example load-balanced worker with HTTP routes. Contains @Endpoint functions with custom HTTP methods and paths (e.g., POST /process, GET /health). Creates one endpoint when deployed. gpu_worker.py: An example GPU queue-based worker. Contains @Endpoint functions that run on GPU hardware. Provides /runsync route for job submission. Creates one endpoint when deployed. cpu_worker.py: An example CPU queue-based worker. Contains @Endpoint functions that run on CPU-only instances. Provides /runsync route for job submission. Creates one endpoint when deployed. .flashignore: Lists files and directories to exclude from the deployment artifact (similar to .gitignore). Each worker file defines a resource configuration and its associated functions. When you deploy, Flash creates one Serverless endpoint per unique resource configuration.

Set up the project

After initialization, complete the setup:
# Install dependencies
pip install -r requirements.txt

# Copy environment template
cp .env.example .env

# Add your API key to .env
# RUNPOD_API_KEY=your_api_key_here

How it fits into the workflow

flash init is the first step in the Flash development workflow:
  1. flash init: Creates project structure and boilerplate.
  2. flash run: Starts local development server for testing.
  3. flash deploy: Builds and deploys to Runpod Serverless.

Handle existing files

If you run flash init in a directory with existing files, Flash detects conflicts and prompts for confirmation:
┌─ File Conflicts Detected ─────────────────────┐
│ Warning: The following files will be          │
│ overwritten:                                  │
│                                               │
│   • lb_worker.py                              │
│   • gpu_worker.py                             │
│   • requirements.txt                          │
└───────────────────────────────────────────────┘
Continue and overwrite these files? [y/N]:
Use --force to skip the prompt and overwrite files:
flash init . --force

Start developing

Once your project is set up:
# Start the development server
flash run

# Open the API explorer
# http://localhost:8888/docs
Make changes to your worker files, and the server reloads automatically. When you’re ready, deploy with:
flash deploy

Next steps