Introduction
Permission Mongo is a high-performance Backend-as-a-Service that sits between your application and MongoDB, providing a complete REST API with fine-grained access control.What is Permission Mongo?
Permission Mongo transforms your MongoDB database into a secure, production-ready API by combining:- REST API - Full CRUD operations with batch support
- Fine-grained RBAC - Role-based access with hierarchical permissions
- Schema validation - Types, constraints, computed fields
- Document versioning - Track changes, diff, and restore
- Hooks - Pre/post triggers with HTTP webhook support
- Prometheus metrics - Full observability with Grafana dashboards
- 50K+ QPS - Optimized for high throughput
Key benefits
Zero backend code
Define schema + policy in YAML files, get a complete REST API with all CRUD operations
Works with existing data
No schema migration required - Permission Mongo adapts to your current MongoDB collections
Hierarchical RBAC
Managers automatically see subordinates’ data using org chart relationships
High performance
Redis caching, connection pooling, and async audit logging for sub-20ms response times
Use cases
Permission Mongo is ideal for:- SaaS applications - Multi-tenant systems with complex permission requirements
- Internal tools - Quick API generation for admin dashboards and back-office systems
- Mobile backends - Secure REST API for iOS and Android applications
- Microservices - Centralized data access layer with consistent authorization
- Rapid prototyping - Schema to API in minutes for MVPs and proof-of-concepts
Core features
REST API endpoints
Permission Mongo provides 10+ REST endpoints covering all data operations:| Endpoint Type | Description |
|---|---|
| CRUD | Create, read, update, delete documents |
| Batch | Batch create, update, delete operations |
| Query | List with filters, count, aggregation pipelines |
| Versioning | List versions, get version, diff, restore |
| Health | Health checks, readiness, Prometheus metrics |
Schema validation
Define your data structure with rich type support:config/schema.yml
Fine-grained RBAC
Define role-based policies with document-level and field-level permissions:config/policy.yml
user.$subordinates variable automatically includes all users reporting to the current user (directly or indirectly) based on your org chart defined in the users collection.
See Policy Definition for the complete RBAC syntax.
Document versioning
Track complete change history for any collection:config/schema.yml
_pm_versions collection. Use the versioning API to:
- List all versions:
GET /orders/{id}/versions - Get specific version:
GET /orders/{id}/versions/3 - Compare versions:
GET /orders/{id}/diff/2/4 - Restore to version:
POST /orders/{id}/restore/2
Hooks and webhooks
Trigger actions before or after operations:config/hooks.yml
Technology stack
| Component | Technology | Purpose |
|---|---|---|
| Language | Go 1.21+ | High performance, single binary deployment |
| HTTP Server | fasthttp | 10x faster than net/http for high-throughput APIs |
| Database | MongoDB 6.0+ | Document storage, versioning, audit logs |
| Cache | Redis 7.0+ | Policy caching, hierarchy lookups |
| Auth | JWT (RS256/HS256) | Industry standard token-based authentication |
| Config | YAML | Human-readable, version-controllable configuration |
| Metrics | Prometheus | Observability with pre-built Grafana dashboards |
Architecture overview
Performance characteristics
Permission Mongo is optimized for high throughput:- 50K+ QPS - Sustained queries per second on standard hardware
- Sub-10ms - Average read latency with Redis caching
- Sub-25ms - Average write latency including validation and versioning
- 256K - Concurrent connections with fasthttp tuning
Optimizations
- Lock-free router using atomic operations
- Connection pooling (MongoDB: 100 conns, Redis: 500 conns)
- Async audit logging with batched inserts
- AST caching for RBAC expression parsing
- Computed field memoization
Next steps
Quickstart
Get up and running in 5 minutes
Installation
Detailed installation options: binary, Docker, or from source
Configuration
Learn how to configure schema, policies, and hooks
API Reference
Complete REST API documentation with examples