Skip to Content
New to Genbox? Check out our Getting Started guide

gb init

Initialize Genbox configuration for your project.

Synopsis

gb init [options]

Description

Creates a genbox.yaml configuration file for your project. Scans your project structure to detect apps, frameworks, and infrastructure, then generates appropriate configuration.

Options

OptionDescription
--guidedInteractive step-by-step mode
--quickMinimal config with auto-detection
--from-scanUse detected values from gb scan
--template <name>Start from a template
-y, --yesAccept all defaults

Examples

Interactive Mode (Default)

gb init

Walks through each section interactively.

Guided Mode

gb init --guided

Detailed step-by-step with explanations.

Quick Mode

gb init --quick

Generates minimal config with $detect markers.

From Scan

# First scan the project gb scan # Then initialize from detected values gb init --from-scan

Init Process

  1. Project Scan: Analyzes directory structure
  2. App Detection: Finds apps, frameworks, ports
  3. Infrastructure: Detects from docker-compose
  4. Profile Generation: Creates recommended profiles
  5. File Creation: Writes genbox.yaml

Example Output

Scanning project structure... ? Project name: myproject ? Project structure: (detected: monorepo) ○ single-app ● monorepo ○ workspace Found 3 apps: === admin === ? Type: (detected: frontend) ? Port: (detected: 3001) [Enter to accept] ? Framework: (detected: react) === api === ? Type: (detected: backend) ? Port: (detected: 3050) [Enter to accept] ? Framework: (detected: nestjs) === web === ? Type: (detected: frontend) ? Port: (detected: 3000) [Enter to accept] ? Framework: (detected: nextjs) Found infrastructure: ✓ mongodb (mongo:7, port 27017) ✓ redis (redis:7-alpine, port 6379) Generating profiles... • admin-quick: Admin → staging backend • full-stack: All apps + local database • api-only: Backend services only Created: genbox.yaml Run 'gb create' to spin up an environment!

Generated File

The init command creates a complete genbox.yaml:

version: 4 project: name: myproject structure: monorepo apps: admin: path: admin/ type: frontend port: 3001 framework: react api: path: api/ type: backend port: 3050 framework: nestjs web: path: web/ type: frontend port: 3000 framework: nextjs provides: mongodb: type: database image: mongo:7 port: 27017 redis: type: cache image: redis:7-alpine port: 6379 profiles: admin-quick: size: small apps: [admin] default_connection: staging full-stack: size: large apps: [admin, api, web] default_connection: local

Notes

  • Run from project root directory
  • Existing genbox.yaml will be backed up
  • Use --guided for learning the schema
  • Review generated config before using

See Also

Last updated on