MockForge Collaboration
Cloud collaboration features for MockForge enabling teams to work together on mock environments in real-time.
Features
Team Workspaces
- Shared Environments: Create collaborative workspaces where team members can work together
- Role-Based Access Control: Three roles with different permission levels:
- Admin: Full access including workspace management, member management, and all editing capabilities
- Editor: Can create, edit, and delete mocks; cannot manage workspace settings or members
- Viewer: Read-only access to view mocks and history
Real-Time Synchronization
- WebSocket-Based Sync: Changes are broadcast instantly to all connected users
- Presence Awareness: See who else is currently working in the workspace
- Cursor Tracking: View where other users are editing in real-time
- Automatic Conflict Resolution: Intelligent merge strategies for concurrent edits
Version Control
- Git-Style History: Every change creates a commit with full workspace snapshot
- Named Snapshots: Create tagged versions (like git tags) for important milestones
- Time Travel: Restore workspace to any previous commit or snapshot
- Diff Viewing: Compare changes between any two versions
Self-Hosted Option
- Run Your Own Server: Deploy on your infrastructure for complete control
- SQLite or PostgreSQL: Choose your database backend
- Simple Configuration: Environment variables or config files
- Docker Support: Easy deployment with Docker/Kubernetes
Quick Start
Starting a Collaboration Server
use ;
async
Connecting as a Client
use ;
async
Architecture
Components
- Authentication Service: JWT-based authentication with Argon2 password hashing
- Workspace Service: CRUD operations for workspaces with permission checks
- Event Bus: Broadcast channel for real-time change notifications
- Sync Engine: Manages active connections and synchronization state
- History Tracker: Version control with commits and snapshots
- Conflict Resolver: Three-way merge with multiple strategies
Database Schema
- users: User accounts with credentials and profile info
- workspaces: Team workspace definitions
- workspace_members: User-workspace relationships with roles
- workspace_invitations: Pending invitations to join workspaces
- commits: Version history with full snapshots
- snapshots: Named versions for easy restoration
Configuration
Environment Variables
MOCKFORGE_JWT_SECRET=your-secret-key
MOCKFORGE_DATABASE_URL=sqlite://mockforge-collab.db
MOCKFORGE_BIND_ADDRESS=0.0.0.0:8080
Configuration File
[]
= "your-secret-key"
= "postgresql://user:pass@localhost/mockforge"
= "0.0.0.0:8080"
= 100
= true
Security
- Password Hashing: Argon2 for secure password storage
- JWT Tokens: Industry-standard authentication
- Role-Based Access: Granular permission control
- Database Encryption: Optional encryption at rest
- Audit Logging: Track all changes with author information
Deployment
Docker
FROM rust:1.75 as builder
WORKDIR /app
COPY . .
RUN cargo build --release --package mockforge-collab
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/mockforge-collab /usr/local/bin/
CMD ["mockforge-collab"]
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: mockforge-collab
spec:
replicas: 3
selector:
matchLabels:
app: mockforge-collab
template:
metadata:
labels:
app: mockforge-collab
spec:
containers:
- name: mockforge-collab
image: mockforge/collab:latest
env:
- name: MOCKFORGE_DATABASE_URL
value: "postgresql://..."
API Examples
Create a Workspace
let workspace = workspace_service
.create_workspace
.await?;
Add a Member
let member = workspace_service
.add_member
.await?;
Create a Snapshot
let snapshot = history
.create_snapshot
.await?;
Restore from Snapshot
let state = history
.restore_snapshot
.await?;
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.