A high-performance, scalable backend service with real-time capabilities, MCP support, and enterprise-grade security
- π RESTful API - Fast, scalable REST API with JWT authentication
- π Dynamic Collections - Schema-flexible document storage with validation
- π Advanced Querying - MongoDB-compatible query language with aggregation support
- π― Views & Aggregations - Pre-defined queries with parameterized execution
- π Row-Level Security - Fine-grained access control with RBAC
- π Access Keys - API key authentication with scoped permissions
- π€ MCP Integration - Model Context Protocol support for AI applications
- π Real-time Analytics - Monitor system health and usage metrics
- π₯ User Management - Complete user administration interface
- ποΈ Collection Explorer - Visual database management tools
- π§ Settings Management - System and user configuration
- π Schema Editor - Visual JSON schema builder
- Go 1.22 or higher
- Node.js 20+ and pnpm
- Database: MongoDB, AWS DocumentDB, or PostgreSQL
- Docker (optional)
# Clone the repository
git clone https://github.com/MadHouseLabs/anybase.git
cd anybase
# Start with Docker Compose
docker-compose up -d# Clone the repository
git clone https://github.com/MadHouseLabs/anybase.git
cd anybase
# Install backend dependencies
go mod download
# Install dashboard dependencies
cd dashboard
pnpm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your configuration
# Run the backend
go run cmd/server/main.go
# In another terminal, run the dashboard
cd dashboard
pnpm devanybase/
βββ api/ # API handlers and routes
β βββ v1/ # Version 1 API implementation
βββ cmd/ # Application entrypoints
β βββ server/ # Main server application
βββ internal/ # Private application code
β βββ accesskey/ # Access key management
β βββ auth/ # Authentication logic
β βββ collection/ # Collection operations
β βββ config/ # Configuration management
β βββ database/ # Database connectivity
β βββ governance/ # RBAC and permissions
β βββ middleware/ # HTTP middleware
β βββ models/ # Data models
β βββ settings/ # Settings management
β βββ user/ # User management
βββ dashboard/ # Next.js dashboard application
β βββ app/ # App router pages
β βββ components/ # React components
β βββ lib/ # Utility functions
βββ docker/ # Docker configurations
AnyBase supports multiple database backends. Choose one:
# MongoDB/DocumentDB Connection
ANYBASE_DATABASE_TYPE=mongodb
ANYBASE_DATABASE_URI=mongodb://localhost:27017
ANYBASE_DATABASE_DATABASE=anybase# PostgreSQL Connection
ANYBASE_DATABASE_TYPE=postgres
ANYBASE_DATABASE_URI=postgres://username@localhost/anybase?sslmode=disable
ANYBASE_DATABASE_DATABASE=anybaseCreate a .env file in the root directory:
# Database Configuration (see above for database-specific settings)
ANYBASE_DATABASE_TYPE=mongodb # or postgres
ANYBASE_DATABASE_URI=mongodb://localhost:27017
ANYBASE_DATABASE_DATABASE=anybase
# JWT Configuration
JWT_SECRET=your-secret-key-here
JWT_EXPIRY=24h
REFRESH_TOKEN_EXPIRY=168h
# Server Configuration
PORT=8080
HOST=0.0.0.0
MODE=development
# Initial Admin User (created on first startup)
INIT_ADMIN_EMAIL=admin@anybase.local
INIT_ADMIN_PASSWORD=admin123 # Change this immediately after first login!
# Dashboard Configuration
NEXT_PUBLIC_API_URL=http://localhost:8080AnyBase automatically creates necessary indexes on startup:
- MongoDB: Native MongoDB indexes with compound and unique constraints
- PostgreSQL: B-tree and GIN indexes on JSONB fields for optimal query performance
Complete API documentation is available in the OpenAPI specification. You can:
- Import it into Postman or Insomnia for testing
- Use it to generate client SDKs
- View it with Swagger UI or ReDoc
# Register a new user
curl -X POST http://localhost:8080/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"securepass","name":"John Doe"}'
# Login
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"securepass"}'# Create a collection
curl -X POST http://localhost:8080/api/v1/collections \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "products",
"description": "Product catalog",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"price": {"type": "number"},
"category": {"type": "string"}
},
"required": ["name", "price"]
}
}'
# Insert a document
curl -X POST http://localhost:8080/api/v1/data/products \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Widget","price":29.99,"category":"Hardware"}'# Create an access key
curl -X POST http://localhost:8080/api/v1/access-keys \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key",
"permissions": ["collection:products:read", "collection:products:write"]
}'AnyBase supports MCP for AI model integration. Configure your MCP client to connect to:
http://localhost:8080/mcp
The MCP server provides collection-specific tools with full schema awareness for optimal AI interactions.
# Pull the images
docker pull ghcr.io/madhouselabs/anybase-backend:latest
docker pull ghcr.io/madhouselabs/anybase-dashboard:latest
# Run with docker-compose
docker-compose up -d# Build backend
docker build -t anybase-backend .
# Build dashboard
docker build -t anybase-dashboard ./dashboard# Run backend tests
go test ./...
# Run backend tests with coverage
go test -cover ./...
# Run dashboard tests
cd dashboard
pnpm testAnyBase is optimized for high performance:
- Connection Pooling: Efficient MongoDB connection management
- Indexed Queries: Automatic index creation for optimal query performance
- Caching: Built-in caching for frequently accessed data
- Rate Limiting: Per-IP rate limiting to prevent abuse
- Concurrent Processing: Go's goroutines for parallel request handling
- JWT Authentication: Secure token-based authentication
- RBAC: Role-based access control with fine-grained permissions
- Input Validation: JSON Schema validation for all inputs
- Rate Limiting: Built-in rate limiting to prevent abuse
- CORS: Configurable CORS policies
- Secure Headers: Security headers for XSS and CSRF protection
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Gin web framework
- Dashboard powered by Next.js
- Database support via MongoDB Go Driver
- UI components from Radix UI
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions