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/*
andsrc/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 orchestrationsteps/
- Individual prompt definitionsui/prompt-renderer.js
- Beautiful CLI interfacenavigation/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 dependenciesDependencyResolver
- 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 infrastructureframeworks/
- 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 combinationstest-runner.js
- Executes generation + install + build + validationfeature-validator.js
- Verifies structure, dependencies, scripts, build outputsreports/
- 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
- Create Feature Module - Add under
src/features/
- Wire Dependencies - Update
src/builders/dependency-resolver.js
- Add Templates - Create content in
src/templates/*
- Add Prompt - Create step in
src/prompts/steps/*
- 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
insrc/index.js
to bypass prompts - Validate Dependencies: Check generated
package.json
againstDependencyResolver.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:
- Generators โ - Framework-specific generation logic
- Builders โ - Configuration file creation system
- Features โ - Feature integration modules
- Templates โ - Code generation templates
Get Involved:
- Adding a Framework โ - Complete extension guide
- Contributing โ - How to contribute to React Kickstart
- QA System โ - Understanding automated testing
Mental Model: Prompts โ Generator (by framework) โ Config/Files/Features โ Install โ Start โ Summary