Startup Development - jvPalma/dotrun GitHub Wiki
Rapid development workflow optimized for small teams, quick iterations, and resource-efficient operations.
This workflow is designed for startup teams needing:
- Rapid Development: Fast iteration and prototyping
- Resource Efficiency: Cost-effective infrastructure and tools
- All-in-One Solutions: Consolidated tooling for small teams
- Quick Deployment: Simple, fast deployment processes
- Minimal Overhead: Lightweight processes and documentation
- 1-3 Full-stack developers
- 1 Founder/Technical lead
- 0-1 Designer (often developer doubles as designer)
- 0-1 DevOps specialist (often shared responsibility)
Repository: startup/dev-tools
# Initialize collection
mkdir startup-dev-tools && cd startup-dev-tools
git init
git remote add origin [email protected]:startup/dev-tools.git
# Create streamlined structure
mkdir -p bin/{development,deployment,testing,maintenance}
mkdir -p docs/{setup,workflows,troubleshooting}
mkdir -p config/{environments,templates}
mkdir -p scripts/{onboarding,ci}Collection Metadata (dotrun.collection.yml):
name: "startup-dev-tools"
description: "Rapid development tools for startup teams"
author: "Startup Development Team"
version: "1.0.0"
dependencies:
- node
- git
- docker
optional_dependencies:
- heroku
- vercel
- netlify
- railway
categories:
- development
- deployment
- testing
- maintenancebin/development/setup-everything.sh:
#!/usr/bin/env bash
### DOC
# One-command setup for new team members
# Installs all dependencies and sets up development environment
### DOC
set -euo pipefail
main() {
echo "๐๏ธ Setting up complete development environment..."
echo "โฐ This will take 5-10 minutes"
# Detect operating system
local os_type
if [[ "$OSTYPE" == "darwin"* ]]; then
os_type="macos"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
os_type="linux"
else
echo "โ Unsupported operating system: $OSTYPE"
exit 1
fi
echo "๐ฅ๏ธ Detected OS: $os_type"
# Install system dependencies
case "$os_type" in
macos)
echo "๐บ Setting up macOS dependencies..."
# Install Homebrew if not present
if ! command -v brew >/dev/null; then
echo "๐ฆ Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Install development tools
brew install node postgresql redis docker git
brew install --cask docker visual-studio-code
;;
linux)
echo "๐ง Setting up Linux dependencies..."
# Update package manager
sudo apt update
# Install development tools
sudo apt install -y \
nodejs npm \
postgresql postgresql-contrib \
redis-server \
docker.io docker-compose \
git curl wget \
build-essential
# Start services
sudo systemctl start postgresql
sudo systemctl start redis-server
sudo systemctl start docker
;;
esac
# Install global npm packages
echo "๐ฆ Installing global npm packages..."
npm install -g \
@vercel/cli \
heroku \
netlify-cli \
nodemon \
concurrently \
serve
# Setup project structure
echo "๐ Creating project structure..."
mkdir -p {frontend,backend,docs,tests,scripts}
# Frontend setup
if [[ ! -f "frontend/package.json" ]]; then
echo "โ๏ธ Setting up React frontend..."
cd frontend
npx create-react-app . --template typescript
npm install axios react-router-dom @types/node
cd ..
fi
# Backend setup
if [[ ! -f "backend/package.json" ]]; then
echo "๐ข Setting up Node.js backend..."
cd backend
npm init -y
npm install express cors dotenv bcryptjs jsonwebtoken
npm install -D nodemon @types/express @types/cors @types/node typescript ts-node
cd ..
fi
# Database setup
echo "๐๏ธ Setting up databases..."
# Create development database
if command -v createdb >/dev/null; then
createdb startup_dev 2>/dev/null || echo "๐ Database already exists"
createdb startup_test 2>/dev/null || echo "๐งช Test database already exists"
fi
# Environment files
echo "โ๏ธ Creating environment files..."
if [[ ! -f "frontend/.env" ]]; then
cat >frontend/.env <<'EOF'
REACT_APP_API_URL=http://localhost:3001
REACT_APP_ENV=development
EOF
fi
if [[ ! -f "backend/.env" ]]; then
cat >backend/.env <<'EOF'
PORT=3001
NODE_ENV=development
DATABASE_URL=postgresql://localhost:5432/startup_dev
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-super-secret-jwt-key-change-in-production
EOF
fi
# Git setup
echo "๐ Setting up Git configuration..."
if [[ ! -f ".gitignore" ]]; then
cat >.gitignore <<'EOF'
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Build outputs
/frontend/build
/backend/dist
# Database
*.db
*.sqlite
# IDE
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
EOF
fi
# Development scripts
echo "๐ง Creating development scripts..."
dr development/create-dev-scripts
# VS Code configuration
echo "๐ป Setting up VS Code configuration..."
mkdir -p .vscode
cat >.vscode/settings.json <<'EOF'
{
"typescript.preferences.importModuleSpecifier": "relative",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
EOF
cat >.vscode/extensions.json <<'EOF'
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next",
"bradlc.vscode-tailwindcss",
"ms-vscode.vscode-json"
]
}
EOF
echo "โ
Development environment setup complete!"
echo ""
echo "๐ Next steps:"
echo "1. Run: dr development/start-all"
echo "2. Open http://localhost:3000 for frontend"
echo "3. API available at http://localhost:3001"
echo "4. Edit code in VS Code or your preferred editor"
echo ""
echo "๐ก Useful commands:"
echo " dr development/start-all # Start all services"
echo " dr testing/run-all # Run all tests"
echo " dr deployment/quick-deploy # Deploy to staging"
}
main "$@"bin/development/start-all.sh:
#!/usr/bin/env bash
### DOC
# Start all development services with one command
# Frontend, backend, database, and development tools
### DOC
set -euo pipefail
source "$DR_CONFIG/helpers/pkg.sh"
validatePkg node
main() {
echo "๐ Starting all development services..."
# Check if we're in project root
if [[ ! -d "frontend" ]] || [[ ! -d "backend" ]]; then
echo "โ Must run from project root directory"
echo "๐ก Make sure you have frontend/ and backend/ directories"
exit 1
fi
# Start background services
echo "๐๏ธ Starting database services..."
# Check if PostgreSQL is running
if ! pgrep -x "postgres" >/dev/null; then
if [[ "$OSTYPE" == "darwin"* ]]; then
brew services start postgresql
else
sudo systemctl start postgresql
fi
fi
# Check if Redis is running
if ! pgrep -x "redis-server" >/dev/null; then
if [[ "$OSTYPE" == "darwin"* ]]; then
brew services start redis
else
sudo systemctl start redis-server
fi
fi
# Install dependencies if needed
echo "๐ฆ Checking dependencies..."
if [[ ! -d "frontend/node_modules" ]]; then
echo "๐ฆ Installing frontend dependencies..."
cd frontend && npm install && cd ..
fi
if [[ ! -d "backend/node_modules" ]]; then
echo "๐ฆ Installing backend dependencies..."
cd backend && npm install && cd ..
fi
# Create logs directory
mkdir -p logs
# Start services with concurrently
echo "๐ฏ Starting frontend and backend services..."
npx concurrently \
--names "BACKEND,FRONTEND" \
--prefix-colors "green,blue" \
--kill-others-on-fail \
"cd backend && npm run dev 2>&1 | tee ../logs/backend.log" \
"cd frontend && npm start 2>&1 | tee ../logs/frontend.log"
}
main "$@"bin/development/create-dev-scripts.sh:
#!/usr/bin/env bash
### DOC
# Create essential development scripts in package.json files
### DOC
set -euo pipefail
main() {
echo "๐ง Creating development scripts..."
# Backend scripts
if [[ -f "backend/package.json" ]]; then
echo "๐ข Adding backend scripts..."
npx json -I -f backend/package.json -e 'this.scripts = this.scripts || {}'
npx json -I -f backend/package.json -e 'this.scripts.dev = "nodemon src/index.ts"'
npx json -I -f backend/package.json -e 'this.scripts.build = "tsc"'
npx json -I -f backend/package.json -e 'this.scripts.start = "node dist/index.js"'
npx json -I -f backend/package.json -e 'this.scripts.test = "jest"'
npx json -I -f backend/package.json -e 'this.scripts["test:watch"] = "jest --watch"'
fi
# Frontend scripts (usually created by create-react-app)
if [[ -f "frontend/package.json" ]]; then
echo "โ๏ธ Frontend scripts already configured by create-react-app"
fi
# Root level scripts
if [[ ! -f "package.json" ]]; then
echo "๐ Creating root package.json..."
cat >package.json <<'EOF'
{
"name": "startup-project",
"version": "1.0.0",
"description": "Startup project with DotRun automation",
"scripts": {
"dev": "dr development/start-all",
"test": "dr testing/run-all",
"deploy:staging": "dr deployment/quick-deploy staging",
"deploy:production": "dr deployment/quick-deploy production",
"setup": "dr development/setup-everything"
},
"devDependencies": {
"concurrently": "^7.6.0"
}
}
EOF
npm install
fi
echo "โ
Development scripts created!"
echo "๐ก Available commands:"
echo " npm run dev # Start all services"
echo " npm test # Run all tests"
echo " npm run deploy:staging # Deploy to staging"
}
main "$@"bin/deployment/quick-deploy.sh:
#!/usr/bin/env bash
### DOC
# Deploy entire application stack in under 5 minutes
# Supports multiple cloud platforms with automatic setup
### DOC
set -euo pipefail
main() {
local environment="${1:-staging}"
local platform="${2:-auto}"
echo "๐ Quick deployment to $environment"
echo "โ๏ธ Platform: $platform"
# Auto-detect platform if not specified
if [[ "$platform" == "auto" ]]; then
if command -v vercel >/dev/null && [[ -f "vercel.json" ]]; then
platform="vercel"
elif command -v heroku >/dev/null && [[ -f "Procfile" ]]; then
platform="heroku"
elif command -v netlify >/dev/null && [[ -f "netlify.toml" ]]; then
platform="netlify"
else
echo "โ No deployment platform detected, defaulting to Heroku"
platform="heroku"
fi
fi
echo "๐ก Using platform: $platform"
# Build frontend
echo "โ๏ธ Building frontend..."
cd frontend
npm run build
cd ..
# Prepare backend
echo "๐ข Preparing backend..."
cd backend
if [[ -f "tsconfig.json" ]]; then
npm run build
fi
cd ..
case "$platform" in
vercel)
deploy_to_vercel "$environment"
;;
heroku)
deploy_to_heroku "$environment"
;;
netlify)
deploy_to_netlify "$environment"
;;
railway)
deploy_to_railway "$environment"
;;
*)
echo "โ Unsupported platform: $platform"
echo "Supported: vercel, heroku, netlify, railway"
exit 1
;;
esac
}
deploy_to_vercel() {
local environment="$1"
echo "โฒ Deploying to Vercel..."
# Deploy frontend
cd frontend
if [[ "$environment" == "production" ]]; then
vercel --prod
else
vercel
fi
cd ..
# Deploy backend (serverless functions)
if [[ -d "api" ]] || [[ -d "backend/api" ]]; then
echo "๐ Deploying backend as serverless functions..."
if [[ "$environment" == "production" ]]; then
vercel --prod
else
vercel
fi
fi
echo "โ
Vercel deployment complete!"
}
deploy_to_heroku() {
local environment="$1"
echo "๐ฃ Deploying to Heroku..."
# Setup Heroku apps if they don't exist
local app_name="startup-app"
if [[ "$environment" == "staging" ]]; then
app_name="startup-app-staging"
fi
# Check if app exists
if ! heroku apps:info "$app_name" >/dev/null 2>&1; then
echo "๐ฑ Creating Heroku app: $app_name"
heroku create "$app_name"
# Add database
heroku addons:create heroku-postgresql:hobby-dev --app "$app_name"
heroku addons:create heroku-redis:hobby-dev --app "$app_name"
fi
# Deploy
if [[ "$environment" == "staging" ]]; then
git push heroku-staging main
else
git push heroku main
fi
# Run migrations
echo "๐๏ธ Running database migrations..."
heroku run npm run migrate --app "$app_name" || echo "โ ๏ธ No migrations found"
echo "โ
Heroku deployment complete!"
echo "๐ URL: https://$app_name.herokuapp.com"
}
deploy_to_netlify() {
local environment="$1"
echo "๐ข Deploying to Netlify..."
# Deploy frontend
cd frontend
if [[ "$environment" == "production" ]]; then
netlify deploy --prod --dir=build
else
netlify deploy --dir=build
fi
cd ..
echo "โ
Netlify deployment complete!"
}
deploy_to_railway() {
local environment="$1"
echo "๐ Deploying to Railway..."
# Install Railway CLI if not present
if ! command -v railway >/dev/null; then
npm install -g @railway/cli
fi
# Deploy
railway login
if [[ "$environment" == "production" ]]; then
railway deploy --environment production
else
railway deploy --environment staging
fi
echo "โ
Railway deployment complete!"
}
main "$@"bin/deployment/setup-environment.sh:
#!/usr/bin/env bash
### DOC
# Setup deployment environment on chosen platform
# Configures databases, environment variables, and domains
### DOC
set -euo pipefail
main() {
local platform="$1"
local environment="${2:-staging}"
echo "๐๏ธ Setting up $environment environment on $platform"
case "$platform" in
heroku)
setup_heroku_environment "$environment"
;;
vercel)
setup_vercel_environment "$environment"
;;
netlify)
setup_netlify_environment "$environment"
;;
railway)
setup_railway_environment "$environment"
;;
*)
echo "โ Unsupported platform: $platform"
exit 1
;;
esac
echo "โ
Environment setup complete!"
}
setup_heroku_environment() {
local environment="$1"
local app_name="startup-app"
if [[ "$environment" == "staging" ]]; then
app_name="startup-app-staging"
fi
echo "๐ฃ Setting up Heroku environment: $app_name"
# Create app if it doesn't exist
if ! heroku apps:info "$app_name" >/dev/null 2>&1; then
heroku create "$app_name"
fi
# Add addons
echo "๐ฆ Adding Heroku addons..."
heroku addons:create heroku-postgresql:hobby-dev --app "$app_name" || echo "Database already exists"
heroku addons:create heroku-redis:hobby-dev --app "$app_name" || echo "Redis already exists"
# Set environment variables
echo "โ๏ธ Setting environment variables..."
heroku config:set NODE_ENV="$environment" --app "$app_name"
heroku config:set JWT_SECRET="$(openssl rand -base64 32)" --app "$app_name"
# Setup git remote
heroku git:remote -a "$app_name"
if [[ "$environment" == "staging" ]]; then
git remote rename heroku heroku-staging
fi
echo "โ
Heroku environment ready!"
}
setup_vercel_environment() {
local environment="$1"
echo "โฒ Setting up Vercel environment: $environment"
# Setup environment variables
echo "โ๏ธ Setting environment variables..."
vercel env add NODE_ENV "$environment"
if [[ "$environment" == "production" ]]; then
vercel env add JWT_SECRET production
else
vercel env add JWT_SECRET preview
fi
echo "โ
Vercel environment ready!"
}
main "$@"bin/testing/run-all.sh:
#!/usr/bin/env bash
### DOC
# Run all tests quickly for rapid feedback
# Includes unit tests, integration tests, and linting
### DOC
set -euo pipefail
main() {
local test_type="${1:-all}"
echo "๐งช Running test suite: $test_type"
local failed_tests=()
case "$test_type" in
unit | all)
echo "๐ฌ Running unit tests..."
if ! run_unit_tests; then
failed_tests+=("unit")
fi
;;
esac
case "$test_type" in
integration | all)
echo "๐ Running integration tests..."
if ! run_integration_tests; then
failed_tests+=("integration")
fi
;;
esac
case "$test_type" in
e2e | all)
echo "๐ Running E2E tests..."
if ! run_e2e_tests; then
failed_tests+=("e2e")
fi
;;
esac
case "$test_type" in
lint | all)
echo "๐ Running linting..."
if ! run_linting; then
failed_tests+=("lint")
fi
;;
esac
# Summary
if [[ ${#failed_tests[@]} -eq 0 ]]; then
echo "๐ All tests passed!"
return 0
else
echo "โ Failed test suites: ${failed_tests[*]}"
return 1
fi
}
run_unit_tests() {
local success=true
# Frontend unit tests
if [[ -d "frontend" && -f "frontend/package.json" ]]; then
echo "โ๏ธ Frontend unit tests..."
cd frontend
npm test -- --coverage --watchAll=false || success=false
cd ..
fi
# Backend unit tests
if [[ -d "backend" && -f "backend/package.json" ]]; then
echo "๐ข Backend unit tests..."
cd backend
npm test || success=false
cd ..
fi
$success
}
run_integration_tests() {
echo "๐ Running integration tests..."
# Start test database
if command -v createdb >/dev/null; then
createdb startup_test 2>/dev/null || true
fi
# Run integration tests
if [[ -d "tests/integration" ]]; then
cd tests/integration
npm test || return 1
cd ../..
fi
return 0
}
run_e2e_tests() {
echo "๐ Running E2E tests..."
# Simple smoke test
if command -v curl >/dev/null; then
# Start services in background
dr development/start-all &
local services_pid=$!
# Wait for services to start
sleep 30
# Test frontend
if curl -f http://localhost:3000 >/dev/null 2>&1; then
echo "โ
Frontend accessible"
else
echo "โ Frontend not accessible"
kill $services_pid
return 1
fi
# Test backend
if curl -f http://localhost:3001/health >/dev/null 2>&1; then
echo "โ
Backend accessible"
else
echo "โ Backend not accessible"
kill $services_pid
return 1
fi
kill $services_pid
fi
return 0
}
run_linting() {
local success=true
# Frontend linting
if [[ -d "frontend" ]]; then
echo "โ๏ธ Frontend linting..."
cd frontend
npm run lint --if-present || success=false
cd ..
fi
# Backend linting
if [[ -d "backend" ]]; then
echo "๐ข Backend linting..."
cd backend
npm run lint --if-present || success=false
cd ..
fi
$success
}
main "$@"bin/maintenance/cleanup.sh:
#!/usr/bin/env bash
### DOC
# Quick cleanup of development environment
# Clears caches, logs, and temporary files
### DOC
set -euo pipefail
main() {
echo "๐งน Cleaning up development environment..."
# Clear npm caches
echo "๐ฆ Clearing npm caches..."
npm cache clean --force 2>/dev/null || true
# Clear logs
echo "๐ Clearing logs..."
rm -rf logs/*.log 2>/dev/null || true
mkdir -p logs
# Clear build artifacts
echo "๐๏ธ Clearing build artifacts..."
rm -rf frontend/build 2>/dev/null || true
rm -rf backend/dist 2>/dev/null || true
# Clear test artifacts
echo "๐งช Clearing test artifacts..."
rm -rf coverage 2>/dev/null || true
rm -rf frontend/coverage 2>/dev/null || true
rm -rf backend/coverage 2>/dev/null || true
# Docker cleanup
if command -v docker >/dev/null; then
echo "๐ณ Docker cleanup..."
docker system prune -f >/dev/null 2>&1 || true
fi
# Get disk space saved
echo "๐พ Cleanup complete!"
df -h . | awk 'NR==2{print "Available disk space: " $4}'
}
main "$@"bin/maintenance/system-check.sh:
#!/usr/bin/env bash
### DOC
# Quick system health check
# Verifies all dependencies and services are working
### DOC
set -euo pipefail
main() {
echo "๐ Running system health check..."
local issues=0
# Check required tools
echo "๐ง Checking required tools..."
local tools=("node" "npm" "git" "curl")
for tool in "${tools[@]}"; do
if command -v "$tool" >/dev/null; then
echo "โ
$tool"
else
echo "โ $tool - not found"
((issues++))
fi
done
# Check optional tools
echo "๐ง Checking optional tools..."
local optional_tools=("docker" "heroku" "vercel")
for tool in "${optional_tools[@]}"; do
if command -v "$tool" >/dev/null; then
echo "โ
$tool"
else
echo "โ ๏ธ $tool - not found (optional)"
fi
done
# Check services
echo "๐๏ธ Checking services..."
if pgrep -x "postgres" >/dev/null; then
echo "โ
PostgreSQL running"
else
echo "โ ๏ธ PostgreSQL not running"
fi
if pgrep -x "redis-server" >/dev/null; then
echo "โ
Redis running"
else
echo "โ ๏ธ Redis not running"
fi
# Check project structure
echo "๐ Checking project structure..."
local required_dirs=("frontend" "backend")
for dir in "${required_dirs[@]}"; do
if [[ -d "$dir" ]]; then
echo "โ
$dir/ directory"
else
echo "โ $dir/ directory missing"
((issues++))
fi
done
# Check dependencies
echo "๐ฆ Checking dependencies..."
if [[ -d "frontend/node_modules" ]]; then
echo "โ
Frontend dependencies installed"
else
echo "โ ๏ธ Frontend dependencies missing"
echo "๐ก Run: cd frontend && npm install"
fi
if [[ -d "backend/node_modules" ]]; then
echo "โ
Backend dependencies installed"
else
echo "โ ๏ธ Backend dependencies missing"
echo "๐ก Run: cd backend && npm install"
fi
# Summary
if [[ $issues -eq 0 ]]; then
echo "๐ System is healthy!"
return 0
else
echo "โ ๏ธ Found $issues issues"
echo "๐ก Run: dr development/setup-everything"
return 1
fi
}
main "$@"# One-command setup for new team members
dr import [email protected]:startup/dev-tools.git startup
dr startup/development/setup-everything
# Start development
dr startup/development/start-all# Start working
dr startup/maintenance/system-check
dr startup/development/start-all
# Before committing
dr startup/testing/run-all
dr startup/maintenance/cleanup
# Deploy when ready
dr startup/deployment/quick-deploy staging# Pre-deployment checks
dr startup/testing/run-all
dr startup/maintenance/system-check
# Deploy to production
dr startup/deployment/quick-deploy production heroku
# Monitor deployment
dr startup/monitoring/check-health production# Complete Heroku setup
dr startup/deployment/setup-environment heroku staging
dr startup/deployment/setup-environment heroku production
# Deploy
dr startup/deployment/quick-deploy staging heroku
dr startup/deployment/quick-deploy production heroku# Vercel + serverless setup
dr startup/deployment/setup-environment vercel staging
dr startup/deployment/quick-deploy staging vercelThis startup development workflow provides everything a small team needs to move quickly while maintaining quality and the ability to scale as the company grows.