Usage Examples

Real-world examples and use cases for different project types and scenarios.

Quick Start Examples

Interactive Mode

The easiest way to get started - let the CLI guide you through configuration.

# Install the CLI
npm install -g kickstart-express

# Create a new project interactively
kickstart-express

# Follow the prompts:
# ✓ Project name: my-awesome-api
# ✓ Language: TypeScript
# ✓ Include Dockerfile: Yes
# ✓ Source folder: Yes
# ✓ Structured architecture: Yes

# Navigate to your project
cd my-awesome-api

# Install dependencies (if not already done)
pnpm install

# Start development server
pnpm dev

One-Line Setup

Create a fully-featured project with a single command.

# Create a TypeScript project with all features
kickstart-express --name my-awesome-api --language ts --docker --src --structured

# Navigate and start
cd my-awesome-api && pnpm dev

Project Types

Microservice API

Perfect for building lightweight microservices with TypeScript and Docker.

kickstart-express --name user-service --language ts --docker --src --structured

Generated structure: TypeScript, Docker-ready, organized codebase with controllers/services separation

Rapid Prototype

Quick and simple setup for prototyping or learning.

kickstart-express --name prototype-api --language js

Generated structure: Simple JavaScript setup, minimal configuration, ready to code

Enterprise API

Full-featured setup for production applications with all best practices.

kickstart-express --name enterprise-api --language ts --docker --src --structured

Generated structure: TypeScript, Docker, structured architecture, production-ready

Learning Project

Great for beginners learning Express.js fundamentals.

kickstart-express --name learning-express --language js --src

Generated structure: JavaScript, organized src folder, simple but clean structure

Development Workflows

TypeScript Development

# Create TypeScript project
kickstart-express --name ts-api --language ts --src

# Development workflow
cd ts-api
pnpm dev        # Start with hot reload
pnpm build      # Build for production
pnpm start      # Start production server

# Project structure
ts-api/
├── src/
│   └── index.ts
├── package.json
├── tsconfig.json
├── .env
└── .gitignore

Docker Development

# Create Docker-ready project
kickstart-express --name docker-api --docker --src

# Docker workflow
cd docker-api
docker-compose up --build    # Build and run
docker-compose up            # Run existing image
docker-compose down          # Stop containers

# Project includes
docker-api/
├── Dockerfile
├── docker-compose.yml
├── .dockerignore
└── src/

Structured Architecture

# Create structured project
kickstart-express --name structured-api --structured

# Generated API example
curl http://localhost:3000/api/calculator
curl -X POST http://localhost:3000/api/calculator/add \
  -H "Content-Type: application/json" \
  -d '{"a": 5, "b": 3}'

# Project structure
structured-api/
├── src/
│   ├── controllers/
│   │   └── calculator.controller.ts
│   ├── routes/
│   │   └── calculator.route.ts
│   ├── services/
│   │   └── calculator.service.ts
│   ├── models/
│   │   └── calculation.model.ts
│   └── index.ts

Team Scenarios

New Team Member Setup

Share these commands with new team members for consistent project setup.

# Team standard setup
npm install -g kickstart-express
kickstart-express --name team-project --language ts --docker --structured

# Or using npx (no global installation)
npx kickstart-express --name team-project --language ts --docker --structured

CI/CD Pipeline Setup

Use in automated scripts for consistent project generation.

#!/bin/bash
# setup-new-service.sh

SERVICE_NAME=$1
if [ -z "$SERVICE_NAME" ]; then
  echo "Usage: ./setup-new-service.sh <service-name>"
  exit 1
fi

# Generate service
npx kickstart-express --name "$SERVICE_NAME" --language ts --docker --structured

# Navigate and setup
cd "$SERVICE_NAME"
pnpm install
pnpm build

echo "Service $SERVICE_NAME created successfully!"

Workshop/Training Setup

Perfect for coding workshops or training sessions.

# For participants
npx kickstart-express --name workshop-api --language js --src

# Quick verification
cd workshop-api
pnpm dev
# Visit http://localhost:3000 to confirm it's working

Integration Examples

With Package Managers

# Using npm
npm install -g kickstart-express
kickstart-express --name npm-project

# Using yarn globally
yarn global add kickstart-express
kickstart-express --name yarn-project

# Using pnpm globally  
pnpm add -g kickstart-express
kickstart-express --name pnpm-project

# Using npx (recommended)
npx kickstart-express --name no-install-project

In NPM Scripts

Add to package.json for team workflows.

{
  "scripts": {
    "create:service": "npx kickstart-express --language ts --docker --structured",
    "create:simple": "npx kickstart-express --language js",
    "setup:dev": "npx kickstart-express --name dev-api --language ts --src"
  }
}

# Usage
npm run create:service -- --name user-service
npm run create:simple -- --name quick-test

Troubleshooting Examples

Debug Mode

# Enable debug output
KICKSTART_EXPRESS_DEBUG=1 kickstart-express --name debug-test

# Check if project exists
ls -la debug-test/

# Verify generation
cd debug-test && pnpm dev

Common Issues

Directory already exists:

rm -rf existing-project && kickstart-express --name existing-project

Permission issues:

sudo npm install -g kickstart-express

Node version compatibility:

node --version # Should be >= 18.0.0