Understanding Instances
What is an Instance?
An instance is a running OpenCode server associated with a specific project directory. Each instance:- Runs on a unique port (e.g.,
:3000,:3001) - Has its own sessions and conversation history
- Operates independently from other instances
- Maintains its own file context and workspace
Think of instances like different VS Code windows, each open to a different project folder.
Viewing Available Instances
Access the instances page to see all running instances:- Navigate to the instances page (typically from the sidebar or home)
- All active instances are displayed in a grid layout
- Each instance card shows key information
Instance Card Information
Project Name
The name of the directory (e.g., “my-app”)
Port Number
The local port the instance is running on (e.g., “:3000”)
Full Path
Complete directory path to the project
Status Indicator
Live status with animated pulse for running instances
Connecting to an Instance
To connect to an instance:- Click on any instance card in the grid
- The instance is automatically selected
- You’re redirected to the home screen for that instance
- All sessions and data are now scoped to this instance
Instance Grid Layout
The instances page features a responsive grid:- Mobile: Single column, stacked cards
- Tablet: 2 columns
- Desktop: 2 columns with larger cards
- Orange icon - OpenCode logo with gradient background
- Project name - Large, prominent display
- Port badge - Shows port number in a pill
- Status indicator - Animated green dot for running instances
- Full path - Monospace font showing complete directory path
Starting a New Instance
To create a new instance:- Open a terminal in your project directory
- Run
openportal run - The server starts on an available port
- Return to the instances page and refresh
- Your new instance appears in the list
Empty State
If no instances are running:- A centered empty state appears
- Shows a server icon with helpful text
- Displays the command to start an instance:
openportal run - Provides clear instructions for getting started
Instance Status
Running Instances
Active instances show:- Green status indicator - Animated pulsing dot
- Clickable card - Can be selected and connected
- Full information - All metadata visible
Instance Details
Each instance card displays:- Top row: Project name and port
- Status indicator: Running state
- Bottom: Full directory path
Switching Between Instances
You can easily switch between instances:- Click the current instance name in the sidebar footer
- Select “Manage Instances” or navigate to instances page
- Click a different instance card
- The entire UI updates to show that instance’s data
Switching instances changes:
- Available sessions
- Current project context
- Git diff view
- File search results
Current Instance Indicator
The sidebar footer shows which instance you’re connected to:- Instance name - The project directory name
- Hostname - Your machine’s hostname
- Avatar - Initials of your hostname
Instance Menu
Click the instance info in the footer to access:- Dashboard link
- Settings
- Security options
- Customer support
- Logout option
Instance Lifecycle
Starting Instances
Stopping Instances
To stop an instance:- Press
Ctrl+Cin the terminal where it’s running - Or use your process manager to terminate it
- The instance disappears from the Portal instances list
Instance Persistence
Instance data persists across restarts:- Sessions are saved to disk
- Conversation history is preserved
- Configuration is maintained
- Project context is remembered
Multiple Projects Workflow
Common Patterns
Frontend + Backend
Frontend + Backend
Run two instances:
- Instance 1: Frontend project on port 3000
- Instance 2: Backend project on port 3001
- Switch between them as needed in Portal
Microservices
Microservices
Run one instance per service:
- Each microservice has its own instance
- Independent chat contexts
- Isolated changes and sessions
Client Projects
Client Projects
Separate instance per client:
- Keep work completely isolated
- Different configurations per client
- Easy to switch contexts
Error Handling
Connection Errors
If Portal can’t fetch instances:- Error message appears in red
- Shows specific error reason
- Lists available troubleshooting steps
Port Conflicts
If a port is already in use:- OpenCode will try the next available port
- Check the terminal output for the actual port
- Update your connection if needed
Instance Not Responding
If an instance stops responding:- Check if the server is still running
- Restart the instance with
openportal run - Refresh the instances page
- Reconnect to the restarted instance
Mobile Experience
On mobile devices:- Instances display in a single column
- Cards are touch-optimized for easy selection
- Full path is visible but wraps if needed
- Status indicators are prominent
- Empty state is mobile-friendly
Performance Considerations
- Fetching instances is fast (single API call)
- Instance list auto-updates on navigation
- Minimal overhead per instance
- Scales well to dozens of instances
The instances page automatically refreshes when you navigate to it, ensuring you always see the latest running instances.
Best Practices
Naming Projects
Give your project directories meaningful names:- ✅
customer-dashboard - ✅
api-service - ❌
project1 - ❌
test
Organizing Instances
Keep your instances organized:- Stop instances you’re not actively using
- Use consistent port ranges per project type
- Document which ports are used for what
Resource Management
Each instance uses system resources:- Monitor memory usage with multiple instances
- Stop unused instances to free resources
- Consider running only 2-3 instances simultaneously