| Crates.io | mockforge-collab |
| lib.rs | mockforge-collab |
| version | 0.3.31 |
| created_at | 2025-10-23 03:13:33.740978+00 |
| updated_at | 2026-01-04 23:48:26.252214+00 |
| description | Cloud collaboration features for MockForge - team workspaces, real-time sync, and version control |
| homepage | https://mockforge.dev |
| repository | https://github.com/SaaSy-Solutions/mockforge |
| max_upload_size | |
| id | 1896543 |
| size | 627,894 |
Cloud collaboration features for MockForge enabling teams to work together on mock environments in real-time.
The crate uses SQLx with offline mode support. When installing from crates.io, the .sqlx query cache is included, so compilation works without a database connection. If you're building from source and encounter SQLx errors, you can either:
SQLX_OFFLINE=false: Compile with a database connectioncargo sqlx prepare --database-url <your-database-url>use mockforge_collab::{CollabServer, CollabConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = CollabConfig {
database_url: "sqlite://mockforge-collab.db".to_string(),
bind_address: "127.0.0.1:8080".to_string(),
jwt_secret: "your-secure-secret".to_string(),
..Default::default()
};
let server = CollabServer::new(config).await?;
server.run("127.0.0.1:8080").await?;
Ok(())
}
use mockforge_collab::{CollabClient, ClientConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = ClientConfig {
server_url: "ws://localhost:8080".to_string(),
auth_token: "your-jwt-token".to_string(),
};
let client = CollabClient::connect(config).await?;
client.subscribe_to_workspace("workspace-id").await?;
// Client now receives real-time updates
Ok(())
}
MOCKFORGE_JWT_SECRET=your-secret-key
MOCKFORGE_DATABASE_URL=sqlite://mockforge-collab.db
MOCKFORGE_BIND_ADDRESS=0.0.0.0:8080
[collab]
jwt_secret = "your-secret-key"
database_url = "postgresql://user:pass@localhost/mockforge"
bind_address = "0.0.0.0:8080"
max_connections_per_workspace = 100
auto_commit = true
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"]
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://..."
let workspace = workspace_service
.create_workspace(
"My Team Workspace".to_string(),
Some("Shared mocks for our API".to_string()),
user_id,
)
.await?;
let member = workspace_service
.add_member(workspace_id, admin_id, new_user_id, UserRole::Editor)
.await?;
let snapshot = history
.create_snapshot(
workspace_id,
"v1.0.0".to_string(),
Some("Production release".to_string()),
user_id,
)
.await?;
let state = history
.restore_snapshot(workspace_id, "v1.0.0")
.await?;
Licensed under either of:
at your option.