Architecture
Project Structure

Project Structure Walkthrough

A comprehensive, visual guide to understanding React Kickstart's codebase organization, execution flow, and where everything lives.

For New Contributors: Run node bin/react-kickstart.js my-app --yes locally first to see it work, then use this guide to understand the internals.


๐ŸŽฏ TL;DR (Quick Start)

Execution Flow: Prompts collect answers โ†’ Framework generator runs โ†’ Files/configs are written โ†’ Dependencies install โ†’ Dev server starts โ†’ Summary prints

Key Entry Points:

  • Start reading: src/index.js โ†’ src/prompts/prompt-flow.js โ†’ src/generators/frameworks/*-generator.js
  • Configs/scripts: src/builders/* (configuration/package-json/dependency management)
  • Files/features: src/features/* and src/templates/* (file generation/content/styling/routing/testing)

When Stuck: Search for the keyword you picked in prompts (e.g., "vite"), then follow the function calls.


๐Ÿ—๏ธ High-Level Architecture


๐Ÿ“ Directory Structure

react-kickstart/
โ”œโ”€โ”€ bin/
โ”‚   โ””โ”€โ”€ react-kickstart.js          # CLI entry point
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.js                    # Main orchestrator
โ”‚   โ”œโ”€โ”€ prompts/                    # Interactive prompts
โ”‚   โ”œโ”€โ”€ generators/                 # Framework generators
โ”‚   โ”œโ”€โ”€ builders/                   # Configuration builders
โ”‚   โ”œโ”€โ”€ features/                   # Feature integrations
โ”‚   โ”œโ”€โ”€ templates/                  # Code generation
โ”‚   โ”œโ”€โ”€ errors/                     # Error handling
โ”‚   โ””โ”€โ”€ utils/                      # Utilities
โ”œโ”€โ”€ qa-automation/                  # Quality assurance
โ”œโ”€โ”€ package.json                    # CLI metadata & deps
โ”œโ”€โ”€ eslint.config.js               # Linting rules
โ””โ”€โ”€ vitest.config.js               # Test configuration

๐Ÿ”„ Execution Flow Diagram

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      Developer       โ”‚  ==> โ”‚  bin/react-kickstart  โ”‚  ==> โ”‚       src/index.js        โ”‚
โ”‚   (runs the CLI)     โ”‚      โ”‚     (CLI entry)       โ”‚      โ”‚ (createApp Orchestrator) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                โ”‚                                 โ”‚
          โ”‚                                โ”‚                                 โ–ผ
          โ”‚                                โ”‚                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚                                โ”‚                    โ”‚  prompts/prompt-flow.js โ”‚
          โ”‚                                โ”‚                    โ”‚  + steps/* (choices)    โ”‚
          โ”‚                                โ”‚                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                โ”‚                                โ”‚ answers
          โ”‚                                โ”‚                                โ–ผ
          โ”‚                                โ”‚                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚                                โ”‚                 โ”‚ generators/base-generator โ”‚
          โ”‚                                โ”‚                 โ”‚ + concrete generators      โ”‚
          โ”‚                                โ”‚                 โ”‚   (Vite, Next.js, etc.)   โ”‚
          โ”‚                                โ”‚                 โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                โ”‚                       โ”‚       โ”‚       โ”‚
          โ”‚                                โ”‚     configs           โ”‚       โ”‚       โ”‚ files/features
          โ”‚                                โ”‚     (build/test/ts)   โ”‚       โ”‚       โ”‚ (src/public)
          โ”‚                                โ”‚                       โ–ผ       โ–ผ       โ–ผ
          โ”‚                                โ”‚               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚                                โ”‚               โ”‚ src/builders/  โ”‚  โ”‚ src/features/   โ”‚
          โ”‚                                โ”‚               โ”‚ - configuration โ”‚  โ”‚ - api-clients   โ”‚
          โ”‚                                โ”‚               โ”‚ - package-json  โ”‚  โ”‚ - source-files  โ”‚
          โ”‚                                โ”‚               โ”‚ - dep-resolver  โ”‚  โ”‚ - styling       โ”‚
          โ”‚                                โ”‚               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚ - routing       โ”‚
          โ”‚                                โ”‚                                   โ”‚ - testing/ts    โ”‚
          โ”‚                                โ”‚                                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                โ”‚                                             โ”‚
          โ”‚                                โ”‚                                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚                                โ”‚                                 โ”‚    src/templates/     โ”‚
          โ”‚                                โ”‚                                 โ”‚ (content generation)  โ”‚
          โ”‚                                โ”‚                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                โ–ผ
          โ”‚                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚                    โ”‚ utils/process/package-managers.js   โ”‚
          โ”‚                    โ”‚  โ†’ install deps (npm/yarn)          โ”‚
          โ”‚                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                        โ”‚
          โ”‚                                        โ–ผ
          โ”‚                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚                          โ”‚ utils/process/start-project.js  โ”‚
          โ”‚                          โ”‚  โ†’ run dev server, open browser โ”‚
          โ”‚                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                                            โ”‚
          โ–ผ                                            โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ utils/ui/completion.js โ”‚                  โ”‚  qa-automation/ (optional)   โ”‚
โ”‚ โ†’ final summary/tips   โ”‚                  โ”‚  - test-matrix-generator     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ”‚  - test-runner, reports      โ”‚
                                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฉ Key Components Deep Dive

๐ŸŽฏ Core Orchestration (src/index.js)

The main orchestrator that coordinates the entire application flow:

Initialize & Validate

  • Parse command line arguments
  • Validate project name and directory
  • Display welcome screen

Collect User Preferences

  • Run interactive prompts (or use flags)
  • Validate and normalize choices
  • Apply intelligent defaults

Generate Project

  • Select appropriate framework generator
  • Execute generation sequence
  • Handle errors and cleanup

Post-Processing

  • Install dependencies
  • Initialize Git repository
  • Start development server
  • Display completion summary

๐Ÿ’ฌ Prompt System (src/prompts/)

Architecture:

  • prompt-flow.js - Multi-step prompt orchestration
  • steps/ - Individual prompt definitions
  • ui/prompt-renderer.js - Beautiful CLI interface
  • navigation/step-navigator.js - Forward/backward navigation

Key Features:

  • Conditional prompts based on previous answers
  • Intelligent defaults and validation
  • Beautiful, branded CLI interface
  • Support for both interactive and non-interactive modes

๐Ÿ—๏ธ Generator System (src/generators/)

Template Method Pattern:

// BaseGenerator defines the sequence
class BaseGenerator {
  async generate(projectPath, projectName, userChoices) {
    await this.createPackageConfiguration()
    await this.createFrameworkConfiguration()
    await this.createProjectFiles()
    await this.createFrameworkSpecificFiles()
  }
}
 
// Concrete generators implement specific steps
class ViteGenerator extends BaseGenerator {
  async createFrameworkConfiguration() {
    // Vite-specific configuration
  }
}

โš™๏ธ Builder System (src/builders/)

Configuration Management:

  • ConfigurationBuilder - Creates framework configs (vite.config.js, next.config.js, tsconfig.json)
  • PackageJsonBuilder - Generates scripts and manages dependencies
  • DependencyResolver - Smart dependency placement (dependencies vs devDependencies)

Dependency Management:

// Smart dependency resolution
const deps = DependencyResolver.getAllDependencies(framework, features)
// Result: { dependencies: {...}, devDependencies: {...} }

๐ŸŽจ Feature System (src/features/)

Modular feature integrations that can be mixed and matched:

๐ŸŒ API Clients

Axios, Fetch, React Query integration with base setup classes

๐Ÿ“ Project Files

Core file generation (HTML, entry points, App components)

๐Ÿงญ Routing

React Router setup for Vite, Next.js routing configuration

๐ŸŽจ Styling

CSS, Tailwind, styled-components with framework-specific setup

๐Ÿ—ƒ๏ธ State Management

Redux Toolkit, Zustand scaffolding with example implementations

๐Ÿงช Testing

Vitest, Jest setup with framework-specific configurations

๐Ÿ“ Template System (src/templates/)

Content Generation Architecture:

  • engines/ - Core template engines and rendering infrastructure
  • frameworks/ - Framework-specific content strategies (Vite, Next.js App/Pages Router)
  • features/ - Feature-specific templates (Redux counter, Zustand store examples)

๐Ÿงช Quality Assurance System

Automated Testing (qa-automation/)

React Kickstart includes comprehensive QA automation to validate all combinations:

# Generate exhaustive test matrix
node qa-automation/test-matrix-generator.js
 
# Run different test suites
node qa-automation/test-runner.js critical 10    # Most important combinations
node qa-automation/test-runner.js standard 25   # Common combinations  
node qa-automation/test-runner.js edge 15       # Edge cases

QA Components:

  • test-matrix-generator.js - Generates all possible combinations
  • test-runner.js - Executes generation + install + build + validation
  • feature-validator.js - Verifies structure, dependencies, scripts, build outputs
  • reports/ - JSON reports for each test run

Coverage: Every framework/feature combination is automatically tested to ensure compatibility and prevent regressions.


๐Ÿ› ๏ธ Common Development Tasks

Adding a New Framework

Create Generator

Implement *-generator.js extending BaseGenerator in src/generators/frameworks/

Register Framework

Add case in src/generators/index.js for generator selection

Add to Prompts

Include in src/prompts/steps/framework-step.js choices

Wire Dependencies

Update src/builders/* for dependencies and scripts

Update QA Matrix

Include in qa-automation/test-matrix-generator.js

Adding a New Feature

  1. Create Feature Module - Add under src/features/
  2. Wire Dependencies - Update src/builders/dependency-resolver.js
  3. Add Templates - Create content in src/templates/*
  4. Add Prompt - Create step in src/prompts/steps/*
  5. Update QA - Include in test matrix

Modifying Build Configuration

  • Scripts: src/builders/package-json-builder.js โ†’ getFrameworkScripts()
  • Build Directory: src/builders/package-json-builder.js โ†’ getBuildDirectory()
  • Dependencies: src/builders/dependencies.js for version updates

๐Ÿ” End-to-End Example: Vite + TypeScript + Tailwind + Redux

1. User runs CLI:

node bin/react-kickstart.js my-app --yes

2. Choices made:

  • Framework: Vite
  • Language: TypeScript
  • Styling: Tailwind CSS
  • State: Redux Toolkit
  • Testing: Vitest

3. Result:

  • Complete Vite project with all features integrated
  • Dependencies installed
  • Dev server started at http://localhost:5173

๐Ÿ› Debugging Tips

Quick Debug: Add UI_UTILS.log() calls in src/index.js, BaseGenerator.generate(), or any step to trace execution.

Common Debug Scenarios:

  • Narrow Scope: Hardcode userChoices in src/index.js to bypass prompts
  • Validate Dependencies: Check generated package.json against DependencyResolver.getAllDependencies() output
  • Config Issues: Review configuration-builder.js for framework-specific branches
  • Start Failures: Ensure port is free, try npm run dev manually
  • Generator Errors: Add try/catch around suspect calls in concrete generators

๐Ÿ“š Next Steps

Explore Further:

Get Involved:

Mental Model: Prompts โ†’ Generator (by framework) โ†’ Config/Files/Features โ†’ Install โ†’ Start โ†’ Summary