Development Setup
Prerequisites
Section titled “Prerequisites”Before starting, ensure you have:
- Company laptop set up
- GitHub account with OpticWorks organization access
- VPN access configured
- 1Password installed and configured
Operating System Setup
Section titled “Operating System Setup”macOS (Recommended)
Section titled “macOS (Recommended)”Install Homebrew
Section titled “Install Homebrew”/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Essential Tools
Section titled “Essential Tools”# Install core development toolsbrew install git node python3 postgresql redis docker
# Install useful utilitiesbrew install wget curl jq tree htopLinux (Ubuntu/Debian)
Section titled “Linux (Ubuntu/Debian)”# Update package listsudo apt update && sudo apt upgrade -y
# Install essential toolssudo apt install -y git build-essential curl wget
# Install Node.js (via nvm)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bashWindows
Section titled “Windows”- Install Windows Subsystem for Linux (WSL 2)
- Install Windows Terminal
- Follow Linux setup instructions within WSL
- Install Docker Desktop for Windows
Development Tools
Section titled “Development Tools”Node.js & npm
Section titled “Node.js & npm”Using nvm (Recommended)
Section titled “Using nvm (Recommended)”# Install nvmcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js LTSnvm install --ltsnvm use --lts
# Verify installationnode --versionnpm --versionGlobal npm Packages
Section titled “Global npm Packages”npm install -g \ typescript \ ts-node \ eslint \ prettier \ nodemon \ pm2Git Configuration
Section titled “Git Configuration”# Set your identitygit config --global user.name "Your Name"git config --global user.email "your.email@opticworks.com"
# Set default branch namegit config --global init.defaultBranch main
# Enable helpful featuresgit config --global pull.rebase truegit config --global fetch.prune truegit config --global core.editor "code --wait"
# Setup SSH key for GitHubssh-keygen -t ed25519 -C "your.email@opticworks.com"Add your SSH key to GitHub:
- Copy your public key:
cat ~/.ssh/id_ed25519.pub - Go to GitHub Settings → SSH Keys
- Click “New SSH Key” and paste
Code Editor
Section titled “Code Editor”VS Code (Recommended)
Section titled “VS Code (Recommended)”Download from: code.visualstudio.com
Essential Extensions:
code --install-extension dbaeumer.vscode-eslintcode --install-extension esbenp.prettier-vscodecode --install-extension eamodio.gitlenscode --install-extension ms-azuretools.vscode-dockercode --install-extension bradlc.vscode-tailwindcsscode --install-extension prisma.prismacode --install-extension ms-vscode.vscode-typescript-nextSettings (settings.json):
{ "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "typescript.updateImportsOnFileMove.enabled": "always"}Docker
Section titled “Docker”brew install --cask docker# Install Dockercurl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.sh
# Add user to docker groupsudo usermod -aG docker $USER
# Install Docker Composesudo apt install docker-compose-pluginVerify installation:
docker --versiondocker compose versionDatabase Tools
Section titled “Database Tools”PostgreSQL
Section titled “PostgreSQL”# macOSbrew install postgresql@15brew services start postgresql@15
# Linuxsudo apt install postgresql postgresql-contribDatabase Client
Section titled “Database Client”- GUI: TablePlus (recommended)
- CLI:
psql(included with PostgreSQL) - VS Code Extension: PostgreSQL by Microsoft
API Testing
Section titled “API Testing”Postman
Section titled “Postman”Download from: postman.com/downloads
Company Workspace:
- Join OpticWorks team workspace
- Import shared collections
- Set up environment variables
Alternative: HTTPie
Section titled “Alternative: HTTPie”# macOSbrew install httpie
# Linuxsudo apt install httpieProject-Specific Setup
Section titled “Project-Specific Setup”Clone Repositories
Section titled “Clone Repositories”# Create workspace directorymkdir -p ~/workspace/opticworkscd ~/workspace/opticworks
# Clone main projectsgit clone git@github.com:opticworks/platform.gitgit clone git@github.com:opticworks/web-app.gitgit clone git@github.com:opticworks/mobile-app.gitEnvironment Variables
Section titled “Environment Variables”Each project requires environment variables:
# Copy example env filecp .env.example .env
# Edit with your valuescode .envInstall Dependencies
Section titled “Install Dependencies”# For Node.js projectsnpm install
# Or if using yarnyarn installDatabase Setup
Section titled “Database Setup”# Create local databasecreatedb opticworks_dev
# Run migrationsnpm run db:migrate
# Seed database with test datanpm run db:seedStart Development Server
Section titled “Start Development Server”# Standard startnpm run dev
# With debuggingnpm run dev:debug
# Watch mode with auto-reloadnpm run dev:watchThe app should now be running at http://localhost:3000
Environment Configuration
Section titled “Environment Configuration”Required Services
Section titled “Required Services”Redis (for caching and queues)
Section titled “Redis (for caching and queues)”# macOSbrew install redisbrew services start redis
# Linuxsudo apt install redis-serversudo systemctl start redisMessage Queue (RabbitMQ)
Section titled “Message Queue (RabbitMQ)”# Using Docker (recommended)docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-managementEnvironment Variables Template
Section titled “Environment Variables Template”# DatabaseDATABASE_URL="postgresql://localhost:5432/opticworks_dev"
# RedisREDIS_URL="redis://localhost:6379"
# API Keys (get from 1Password)API_SECRET_KEY="<from-1password>"STRIPE_SECRET_KEY="<from-1password>"
# External ServicesAWS_ACCESS_KEY_ID="<from-1password>"AWS_SECRET_ACCESS_KEY="<from-1password>"
# Feature FlagsENABLE_NEW_FEATURE=trueDEBUG_MODE=trueTesting Your Setup
Section titled “Testing Your Setup”Run Tests
Section titled “Run Tests”# Unit testsnpm test
# Integration testsnpm run test:integration
# E2E testsnpm run test:e2e
# All testsnpm run test:allLinting & Formatting
Section titled “Linting & Formatting”# Check code stylenpm run lint
# Fix auto-fixable issuesnpm run lint:fix
# Format codenpm run formatBuild Project
Section titled “Build Project”# Development buildnpm run build:dev
# Production buildnpm run buildTroubleshooting
Section titled “Troubleshooting”Port Already in Use
Section titled “Port Already in Use”# Find and kill process on port 3000lsof -ti:3000 | xargs kill -9Node Modules Issues
Section titled “Node Modules Issues”# Clear cache and reinstallrm -rf node_modules package-lock.jsonnpm cache clean --forcenpm installDocker Issues
Section titled “Docker Issues”# Reset Dockerdocker system prune -a
# Restart Docker service# macOS: Restart Docker Desktop# Linux: sudo systemctl restart dockerDatabase Connection Issues
Section titled “Database Connection Issues”# Check PostgreSQL is running# macOS: brew services list# Linux: sudo systemctl status postgresql
# Test connectionpsql -h localhost -U postgresDevelopment Workflow
Section titled “Development Workflow”Daily Workflow
Section titled “Daily Workflow”-
Start development services
Terminal window docker compose up -d -
Pull latest changes
Terminal window git pull origin main -
Install any new dependencies
Terminal window npm install -
Run migrations if needed
Terminal window npm run db:migrate -
Start dev server
Terminal window npm run dev
Before Committing
Section titled “Before Committing”# Run pre-commit checksnpm run lintnpm run formatnpm testAdditional Resources
Section titled “Additional Resources”Getting Help
Section titled “Getting Help”- Slack: #engineering channel
- Documentation: Internal wiki
- Code reviews: Ask senior developers
- Pair programming: Schedule time with teammates
Next Steps
Section titled “Next Steps”- ✅ Complete this setup guide
- Read Code Standards
- Review Git Workflow
- Pick up your first task from Jira
- Submit your first pull request!
Welcome to the OpticWorks development team! 🚀