Replit - Cheatsheet

Overview

Quick reference: Essential shortcuts, commands, and patterns for effective Replit development with AI assistance

Keyboard Shortcuts

Basic Navigation

  • Ctrl + K - Command palette
  • Ctrl + P - Quick file search
  • Ctrl + Shift + P - Command search
  • Ctrl + ` - Toggle terminal
  • Ctrl + / - Toggle comment

AI Integration

  • Ctrl + I - Generate with AI
  • Tab - Accept AI suggestion
  • Esc - Dismiss suggestion
  • Alt + / - Trigger completion
  • Ctrl + Space - Show suggestions

Ghostwriter Commands

Code Generation

# Generate function
"Create a function to validate email addresses"

# Generate component
"Create a React component for user profile card"

# Generate API endpoint
"Create Express route for user authentication"

# Generate tests
"Write unit tests for the user service"

Code Analysis

# Explain code
"Explain this algorithm"

# Fix bugs
"Fix the error in this function"

# Optimize performance
"Optimize this database query"

# Add comments
"Add documentation to this code"

Project Templates

Frontend Templates

  • React: Modern React with hooks
  • Next.js: Full-stack React framework
  • Vue.js: Progressive web apps
  • HTML/CSS/JS: Static websites

Backend Templates

  • Node.js: Express server
  • Python: Flask/Django apps
  • Go: High-performance APIs
  • Java: Spring Boot applications

Configuration Files

.replit Configuration

{
  "language": "nodejs",
  "run": "npm start",
  "entrypoint": "index.js",
  "hidden": [".config"],
  "modules": ["nodejs-18"]
}

Environment Setup

# Package installation
npm install package-name

# Environment variables
export API_KEY=your_key

# Start development
npm run dev

Database Operations

Replit Database

const db = require("@replit/database");

// Set data
await db.set("key", value);

// Get data
const data = await db.get("key");

// Delete data
await db.delete("key");

// List keys
const keys = await db.list();

External Databases

// PostgreSQL
const { Pool } = require('pg');
const pool = new Pool({
  connectionString: process.env.DATABASE_URL
});

// MongoDB
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGODB_URI);

Deployment Commands

Replit Deployment

# Auto-deploy on changes
# Configure in deployment settings

# Manual deployment
npm run build
# Deploy through Replit interface

# Environment variables
# Set in Secrets tab

External Deployment

# Heroku
git push heroku main

# Vercel
vercel --prod

# Netlify
netlify deploy --prod

Collaboration Features

Multiplayer Controls

  • 👥 Invite collaborators
  • 👤 Follow cursors
  • 💬 Chat with team
  • 🎤 Voice communication
  • 📺 Screen sharing

Permissions

  • Owner: Full control
  • Editor: Code and run
  • Viewer: View only
  • Commenter: View and comment

Debugging Tools

Debug Commands

# Node.js debugging
node --inspect index.js

# Python debugging
python -m pdb app.py

# Console logging
console.log(variable);
print(variable);

Browser DevTools

  • F12 - Open DevTools
  • Ctrl + Shift + C - Inspect element
  • Ctrl + Shift + J - Console
  • Ctrl + Shift + I - DevTools

Performance Tips

✅ Optimization

  • Use appropriate packages
  • Minimize file sizes
  • Enable caching
  • Optimize images
  • Use CDNs for assets

⚠️ Limitations

  • CPU and memory limits
  • Network bandwidth caps
  • Storage limitations
  • Always-on requirements
  • Custom domain restrictions