Quick Reference
Development Commands
Section titled “Development Commands”Docker Commands
Section titled “Docker Commands”# Start all servicesdocker compose up
# Start specific servicedocker compose up web # Frontend onlydocker compose up sanity # Sanity Studio only
# Start in backgrounddocker compose up -d
# View logsdocker compose logs -fdocker compose logs -f webdocker compose logs -f sanity
# Stop servicesdocker compose down
# Rebuild and startdocker compose up --build
# Clean updocker system prune -a
Frontend Commands
Section titled “Frontend Commands”cd app
# Install dependenciesnpm install
# Start development servernpm run dev
# Build for productionnpm run build
# Start production servernpm start
# Run lintingnpm run lint
# Type checkingnpx tsc --noEmit
Sanity Studio Commands
Section titled “Sanity Studio Commands”cd app/sanity
# Install dependenciesnpm install
# Start development servernpm run dev
# Start production servernpm start
# Build for productionnpm run build
# Deploy to Sanitynpm run deploy
# Load demo datanpm run demo-data
Documentation Site Commands
Section titled “Documentation Site Commands”cd website
# Install dependenciesnpm install
# Start development servernpm run dev
# Build for productionnpm run build
# Preview production buildnpm run preview
Environment Variables
Section titled “Environment Variables”Required Variables
Section titled “Required Variables”# EnvironmentNODE_ENV=developmentPORT=8080
# Sanity ConfigurationNEXT_PUBLIC_SANITY_PROJECT_ID=your_project_idNEXT_PUBLIC_SANITY_DATASET=productionNEXT_PUBLIC_SANITY_DATASET_DEV=developmentSANITY_API_VERSION=2024-03-21SANITY_API_TOKEN=your_api_token
# Sanity StudioSANITY_STUDIO_PUBLIC_SANITY_PROJECT_ID=your_project_idSANITY_STUDIO_PUBLIC_SANITY_DATASET=productionSANITY_STUDIO_PUBLIC_SANITY_DATASET_DEV=development
URLs and Ports
Section titled “URLs and Ports”Service | Docker Port | Manual Port | URL |
---|---|---|---|
Frontend | 8080 | 3000 | http://localhost:8080 |
Sanity Studio | 3333 | 3333 | http://localhost:3333 |
Documentation | 4321 | 4321 | http://localhost:4321 |
Common File Paths
Section titled “Common File Paths”Frontend
Section titled “Frontend”- Layout:
app/src/app/layout.tsx
- Home Page:
app/src/app/page.tsx
- Components:
app/src/components/
- API Routes:
app/src/app/api/
- Types:
app/src/types/
- Utilities:
app/src/lib/
Sanity Studio
Section titled “Sanity Studio”- Config:
app/sanity/sanity.config.ts
- Schemas:
app/sanity/schemaTypes/
- CLI Config:
app/sanity/sanity.cli.ts
Configuration Files
Section titled “Configuration Files”- Docker Compose:
docker-compose.yml
- Sanity Docker:
docker-compose.sanity.yml
- Next.js Config:
app/next.config.ts
- Tailwind Config:
app/tailwind.config.ts
- TypeScript Config:
app/tsconfig.json
Troubleshooting Commands
Section titled “Troubleshooting Commands”Port Conflicts
Section titled “Port Conflicts”# Check what's using a portlsof -i :8080lsof -i :3333lsof -i :3000
# Kill process using portkill -9 <PID>
Docker Issues
Section titled “Docker Issues”# Check Docker statusdocker infodocker version
# List containersdocker ps -a
# Check container logsdocker logs <container_id>
# Restart Docker Desktop# (On macOS/Windows)
Node.js Issues
Section titled “Node.js Issues”# Check Node versionnode --version
# Check npm versionnpm --version
# Clear npm cachenpm cache clean --force
# Remove node_modulesrm -rf node_modules package-lock.jsonnpm install
Sanity Issues
Section titled “Sanity Issues”# Check Sanity CLInpx sanity --version
# Login to Sanitynpx sanity login
# Check project accessnpx sanity projects list
# Test connectionnpx sanity dataset list
Development Workflow
Section titled “Development Workflow”Daily Development
Section titled “Daily Development”# 1. Start servicesdocker compose up
# 2. Make code changes# 3. Test in browser# 4. Check logs if issuesdocker compose logs -f
# 5. Stop servicesdocker compose down
Code Changes
Section titled “Code Changes”# Frontend changes - auto-reload# Sanity schema changes - restart studio# API changes - test endpoints# Environment changes - restart services
Testing
Section titled “Testing”# Frontend: http://localhost:8080# Sanity Studio: http://localhost:3333# API endpoints: Use Postman or curl# Database: Use Sanity Vision
Git Commands
Section titled “Git Commands”# Check statusgit status
# Add changesgit add .
# Commit changesgit commit -m "Description of changes"
# Push changesgit push origin main
# Pull latestgit pull origin main
# Check branchesgit branch -a
# Create new branchgit checkout -b feature-name
Package Management
Section titled “Package Management”Frontend Dependencies
Section titled “Frontend Dependencies”cd app
# Add dependencynpm install package-name
# Add dev dependencynpm install --save-dev package-name
# Update dependenciesnpm update
# Check outdated packagesnpm outdated
# Audit securitynpm audit
Sanity Dependencies
Section titled “Sanity Dependencies”cd app/sanity
# Add Sanity pluginnpm install sanity-plugin-plugin-name
# Update Sanitynpm update sanity
# Check Sanity versionnpm list sanity
Performance Monitoring
Section titled “Performance Monitoring”Frontend
Section titled “Frontend”- Use Chrome DevTools Performance tab
- Monitor Network tab for API calls
- Check Console for errors
- Use React DevTools for component analysis
Backend
Section titled “Backend”- Monitor Sanity query performance
- Check API response times
- Monitor database usage
- Use Sanity Vision for query testing
Security Checklist
Section titled “Security Checklist”- Environment variables not committed
- API tokens have minimal permissions
- CORS origins properly configured
- Input validation implemented
- Authentication middleware active
- HTTPS enabled in production
- Regular dependency updates
- Security audits run
Deployment Checklist
Section titled “Deployment Checklist”- Environment variables set
- Production build tested
- Sanity Studio deployed
- CORS origins updated
- API tokens rotated
- Monitoring configured
- Backup strategy in place
- Rollback plan ready