mockforge-registry-server-0.3.70 is not a library.
MockForge Registry Server
Central plugin registry backend for MockForge.
Overview
This crate implements the REST API server that powers the MockForge plugin marketplace. It handles:
- Plugin search and discovery
- Plugin publishing and versioning
- User authentication and authorization
- Reviews and ratings
- Download statistics
- Plugin storage (S3-compatible)
Architecture
┌─────────────────┐
│ CLI Client │ mockforge plugin registry search ...
└────────┬────────┘
│
│ HTTPS
│
┌────────▼────────────────────────────────────────┐
│ Registry Server (this crate) │
│ │
│ ┌────────────┐ ┌──────────┐ ┌────────────┐ │
│ │ Axum API │──│ Auth │──│ Storage │ │
│ │ Handlers │ │ (JWT) │ │ (S3) │ │
│ └─────┬──────┘ └──────────┘ └────────────┘ │
│ │ │
│ ┌─────▼───────────────────────────────────┐ │
│ │ PostgreSQL Database │ │
│ │ (plugins, versions, users, reviews) │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘
Quick Start
Prerequisites
- Rust 1.75+
- PostgreSQL 15+
- S3-compatible storage (AWS S3, MinIO, etc.)
Development Setup
- Start dependencies:
# Using Docker Compose (recommended)
This starts:
- PostgreSQL on port 5432
- MinIO (S3) on ports 9000 (API) and 9001 (console)
- Configure environment:
# Create .env file
- Run migrations:
- Start server:
The server will start on http://localhost:8080.
Testing the API
# Health check
# Register user
# Search plugins
API Endpoints
Public Endpoints
GET /health- Health checkPOST /api/v1/plugins/search- Search pluginsGET /api/v1/plugins/:name- Get plugin detailsGET /api/v1/plugins/:name/versions/:version- Get version detailsGET /api/v1/plugins/:name/reviews- Get plugin reviewsGET /api/v1/stats- Get registry statistics
Authentication Endpoints
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- Login and get JWT token
Authenticated Endpoints (requires JWT)
POST /api/v1/plugins/publish- Publish new plugin versionDELETE /api/v1/plugins/:name/versions/:version/yank- Yank versionPOST /api/v1/plugins/:name/reviews- Submit review
Admin Endpoints (requires admin role)
POST /api/v1/admin/plugins/:name/verify- Verify plugin (add badge)
Database Schema
See docs/PLUGIN_MARKETPLACE_IMPLEMENTATION.md for complete schema.
Key tables:
plugins- Plugin metadataplugin_versions- Version informationusers- User accountsreviews- Plugin reviewstags- Tag catalogplugin_tags- Plugin-tag associations
Deployment
Docker
# Build image
# Run container
Production Checklist
- Set strong JWT_SECRET
- Configure production database (RDS, etc.)
- Set up S3 bucket with proper permissions
- Enable HTTPS/TLS
- Configure CORS for your domain
- Set up monitoring and logging
- Configure backups
- Enable rate limiting
- Set up CDN for plugin downloads
Development
Adding New Endpoints
- Add handler to
src/handlers/ - Register route in
src/routes.rs - Add database queries if needed
- Write tests
Running Tests
Database Migrations
# Create new migration
# Run migrations
# Revert last migration
Configuration
All configuration via environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL |
Yes | - | PostgreSQL connection string |
JWT_SECRET |
Yes | - | Secret for signing JWT tokens |
S3_BUCKET |
No | mockforge-plugins |
S3 bucket name |
S3_REGION |
No | us-east-1 |
S3 region |
S3_ENDPOINT |
No | - | Custom S3 endpoint (MinIO, etc.) |
PORT |
No | 8080 |
Server port |
MAX_PLUGIN_SIZE |
No | 52428800 |
Max plugin size (50MB) |
RATE_LIMIT_PER_MINUTE |
No | 60 |
API rate limit |
Security
- JWT-based authentication
- Password hashing with bcrypt
- Checksum verification for uploads
- Rate limiting
- CORS configuration
- SQL injection protection (SQLx)
License
MIT OR Apache-2.0