🔮 Interactive ERD visualization for Salesforce orgs — explore objects, relationships, and metadata with a modern React UI
A beautiful, interactive tool to visualize your Salesforce database schema. Connect to any org, explore standard and custom objects, and understand relationships at a glance.
React Flow canvas • PKCE OAuth • Data Cloud support • Export to PNG/SVG/JSON
Get up and running in under 2 minutes:
# Clone the repository
git clone https://github.com/Jaganpro/sf-schema-viewer.git
cd sf-schema-viewer
# Run the interactive setup wizard
./setup.shThat's it! The setup wizard will guide you through:
- ✅ Checking prerequisites (Node.js, Python, etc.)
- ✅ Selecting your Salesforce org (if SF CLI is installed)
- ✅ Creating an External Client App for OAuth
- ✅ Configuring your
.envfile automatically - ✅ Starting the application
Open http://localhost:5173 and click Connect to Salesforce 🎉
| Requirement | Version | Check Command |
|---|---|---|
| Node.js | 18+ | node --version |
| Python | 3.11+ | python3 --version |
| uv | latest | uv --version |
| npm | latest | npm --version |
| SF CLI | (optional) | sf --version |
Note: Salesforce CLI is optional but enables org selection and opens Setup directly in your browser.
Installing Prerequisites (macOS)
# Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js
brew install node
# Install Python
brew install python@3.11
# Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install Salesforce CLI (optional)
brew install sfInstalling Prerequisites (Linux/Ubuntu)
# Install Node.js (via nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 18
# Install Python
sudo apt update && sudo apt install python3.11 python3.11-venv
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install Salesforce CLI (optional)
npm install -g @salesforce/cliThe setup.sh wizard supports several options:
./setup.sh # Interactive setup wizard
./setup.sh --help # Show usage information
./setup.sh --manual # Skip SF CLI, use manual credential entry
./setup.sh --validate # Test existing .env credentials- Checks prerequisites — Verifies Node.js, Python, uv, npm are installed
- Detects SF CLI — If available, enables org selection and direct Setup access
- Guides app creation — Walks you through creating an External Client App in Salesforce
- Collects credentials — Prompts for Consumer Key/Secret from your app
- Creates
.envfile — Writes configuration with secure session secret - Validates credentials — Checks format and endpoint reachability
- Starts the app — Optionally launches both servers
- 🔑 OAuth 2.0 Flow — Secure web server flow with refresh token support
- 🍪 Session Management — Encrypted cookie sessions with automatic token refresh
- 🌐 Multi-Org Support — Connect to any Production, Sandbox, or Developer org
- 🔄 Version Selector — Choose from last 9 API versions (3 years of releases)
- ✨ New Objects Detection — Sparkle icons (✨) highlight objects new in selected release
- 📊 Release Stats Card — See new object counts for last 3 Salesforce releases at a glance
- 🔍 New Objects Modal — Click any release to see all new objects with details
- 🎯 "New in {Release}" Filter — One-click filter to show only new objects
- 🖱️ Drag & Drop — Freely position nodes on the canvas with position memory
- 🔍 Zoom & Pan — Mouse wheel zoom (0.1x - 2x) and background drag panning
- 🔄 Auto-Layout — One-click Dagre-powered hierarchical layout algorithm
- 🎯 Fit View — Instantly center and fit all nodes in the viewport
- 🔲 Compact Mode — Toggle field visibility for high-level schema overview
- 🛤️ Smart Edge Routing — Dynamic edge paths that avoid node overlaps
- ➖ Lookup Relationships — Dashed blue lines for optional references
- ➡️ Master-Detail Relationships — Solid red lines with cascade delete
- 🔢 Cardinality Markers — Visual N:1 indicators showing relationship direction
- 🏷️ Field Name Labels — See which field (e.g., ParentId) creates each relationship
- 🎬 Animated Edges — Marching ants animation shows data flow direction
- 🔄 Self-References — Support for recursive relationships (e.g., Account.ParentId)
Real-time metadata badges displayed on each object node:
| Badge | Description | Example |
|---|---|---|
| 🔴 OWD: Private | Internal sharing model (red) | OWD: Private |
| 🟡 OWD: Read | Internal sharing model (yellow) | OWD: Read |
| 🟢 OWD: ReadWrite | Internal sharing model (green) | OWD: ReadWrite |
| 🔵 Count: 5.2M | Record count (blue) | Count: 5.2M |
| 🟠 Count: 12M [LDV] | Large Data Volume indicator (orange) | Count: 12M [LDV] |
- ⚡ Instant Search — Real-time filtering through 1000+ sObjects
- 🏷️ Namespace Filtering — Filter by Standard, Custom, or Packaged objects
- 📦 Package Multi-Select — Filter by specific namespaces (npsp, npe01, etc.)
- 🎛️ Object Type Filters — Toggle visibility of system object categories
- 📸 PNG Export — High-resolution diagram images (1x, 2x, 3x)
- 🖼️ SVG Export — Vector graphics for perfect scaling
- 📋 JSON Export — Structured data with nodes, edges, and metadata
- 📎 Copy to Clipboard — Quick PNG copy for documentation
- 🟣 Data Cloud Workspace — Separate view for DLO/DMO entities
- 🌊 DLO Visualization — Data Lake Objects with teal theme
- 🟪 DMO Visualization — Data Model Objects with purple theme
- 📊 Category Badges — Profile, Engagement, Related, Other
- 🔐 Connect — Click "Connect to Salesforce" and authorize with your org credentials
- 📋 Browse — Use the sidebar to search and filter through available objects
- ✅ Select — Check objects to add them to the ERD canvas
- 🖱️ Explore — Drag nodes, zoom with scroll wheel, pan by dragging background
- 🔗 Analyze — Follow relationship lines to understand your data model
| Button | Action | Description |
|---|---|---|
| 🔲 Compact | Toggle fields | Hide field lists for a cleaner high-level view |
| 🔄 Auto Layout | Reorganize | Apply Dagre algorithm to arrange nodes hierarchically |
| 🎯 Fit View | Center all | Fit all nodes in the viewport with padding |
| ⚙️ Settings | Configure | Toggle badges, field labels, and edge animation |
| 📤 Export | Save diagram | Export as PNG, SVG, or JSON |
Relationship Lines:
── ── ──Dashed Blue = Lookup relationship (optional reference)────────Solid Purple = Master-Detail relationship (required, cascade delete)Nmarker indicates the "many" side of the relationship
Object Badges:
Standard= Salesforce-provided objectCustom= Org-created custom object[namespace]= Managed package object (e.g.,[npsp])
If you prefer not to use the setup wizard, or need to configure manually:
Click to expand manual setup instructions
External Client Apps are Salesforce's newer, more secure OAuth approach (Summer '24+).
- Go to Setup → Apps → External Client Apps → External Client App Manager
- Click New External Client App
- Fill in:
- Name:
Schema Viewer - Distribution State:
Local
- Name:
- Enable OAuth (click app → Edit OAuth Settings):
- Callback URL:
http://localhost:8000/auth/callback - Scopes:
Access and manage your data (api)Perform requests at any time (refresh_token)
- Callback URL:
- Configure OAuth Policies (Policies tab → Edit):
- Permitted Users:
All users may self-authorize - Refresh Token Policy:
Refresh token is valid until revoked - IP Relaxation:
Relax IP restrictions
- Permitted Users:
- Save and wait ~10 minutes for propagation
- Copy the Consumer Key and Consumer Secret (View → Consumer Details)
cp .env.example .envEdit .env:
SF_CLIENT_ID=your_consumer_key_here
SF_CLIENT_SECRET=your_consumer_secret_here
SF_CALLBACK_URL=http://localhost:8000/auth/callback
SESSION_SECRET=generate_a_random_string_here
FRONTEND_URL=http://localhost:5173Tip: Generate a session secret with:
openssl rand -hex 32
./start.shThis will:
- Install all dependencies (backend & frontend)
- Start the backend on http://localhost:8000
- Start the frontend on http://localhost:5173
- Handle clean shutdown with
Ctrl+C
Manual startup (alternative):
| Backend | Frontend |
|---|---|
cd backend && uv sync && uv run uvicorn main:app --reload |
cd frontend && npm install && npm run dev |
| Layer | Technology |
|---|---|
| Frontend | React 19, TypeScript, Vite |
| Styling | Tailwind CSS v4, shadcn/ui |
| Icons | Lucide React |
| Visualization | React Flow, Dagre |
| State | Zustand |
| Backend | FastAPI, Python 3.11+ |
| Salesforce | simple-salesforce |
| Auth | OAuth 2.0 Web Server Flow |
sf-schema-viewer/
├── setup.sh # Interactive setup wizard (NEW)
├── start.sh # Start both servers
├── .env.example # Environment template
│
├── backend/ # FastAPI Python backend
│ ├── main.py # App entry point
│ ├── config.py # Environment config
│ ├── routers/
│ │ ├── auth.py # OAuth endpoints
│ │ ├── schema.py # Schema API endpoints
│ │ └── datacloud.py # Data Cloud API
│ ├── services/
│ │ ├── salesforce.py # SF API client
│ │ └── datacloud.py # Data Cloud service
│ └── models/ # Pydantic models
│
├── frontend/ # Vite + React + TypeScript
│ └── src/
│ ├── components/
│ │ ├── ui/ # shadcn/ui components
│ │ ├── flow/ # React Flow components
│ │ ├── layout/ # Layout components
│ │ └── sidebar/ # Object picker & panels
│ ├── store/ # Zustand state
│ ├── utils/ # Transformers, layout
│ └── types/ # TypeScript definitions
│
└── docs/ # Documentation
| Endpoint | Method | Description |
|---|---|---|
/auth/login |
GET | Initiate Salesforce OAuth flow |
/auth/callback |
GET | OAuth callback handler |
/auth/status |
GET | Check authentication status |
/auth/logout |
POST | Clear session and logout |
/auth/refresh |
POST | Refresh access token |
/auth/session-info |
GET | Get detailed session metadata |
/api/objects |
GET | List all sObjects in the org |
/api/objects/{name}/describe |
GET | Get full describe for one object |
/api/objects/describe |
POST | Batch describe multiple objects |
/api/objects/enrichment |
POST | Get OWD and record counts |
/api/api-versions |
GET | List available API versions |
/api/datacloud/status |
GET | Check Data Cloud availability |
/api/datacloud/entities |
GET | List Data Cloud entities |
OAuth Callback Error
Symptom: Redirect error after Salesforce login
Solutions:
- Verify callback URL in External Client App matches exactly:
http://localhost:8000/auth/callback - Wait 10+ minutes after creating the app for propagation
- Clear browser cookies and try again
- Check that all required OAuth scopes are enabled
External Client App not appearing
Symptom: Can't find the app in Setup after deployment
Solutions:
- Wait 5-10 minutes for the app to appear
- Search for "Schema Viewer" in Setup
- Check External Client App Manager (not regular App Manager)
- Verify deployment succeeded in setup.sh output
Scratch Org Issues
Symptom: Deployment fails with scratch org
Solution: External Client Apps don't work in scratch orgs. Use a Developer Edition, sandbox, or production org instead.
Connection Issues
Symptom: Can't reach Salesforce
Solutions:
- Check VPN/network connectivity
- Verify org is accessible via browser
- Try
sf org login webto re-authenticate
Contributions are welcome! Please feel free to submit a Pull Request.
MIT © 2024-2025
Made with ❤️ for the Salesforce community