BAASIX - Backend as a Service
Introduction
BAASIX is a powerful, flexible Backend as a Service (BaaS) platform that enables rapid development of web and mobile applications. It provides a comprehensive API for common backend functionality, allowing developers to focus on building frontend experiences without worrying about the underlying infrastructure.
This documentation is designed to be AI-friendly, with clear cross-links between conceptual guides and API references.
Key Features
- Dynamic Database Management: Create and modify data models on the fly with a flexible schema system
- Powerful Query API: Complex filtering, sorting, pagination, aggregation, and full-text search capabilities
- Authentication & Authorization: Complete user management with JWT, cookie-based auth, and role-based permissions
- Workflow Automation: Visual workflow builder with 17 node types, 4 trigger types, and real-time monitoring
- Notification System: Built-in user notification system with real-time delivery via Socket.IO
- File Storage & Processing: Upload, manage and transform files with image optimization and video metadata
- PostGIS Geospatial Support: Advanced spatial data operations with PostGIS integration
- Reporting & Analytics: Generate complex reports and statistics with grouping and aggregation
- Hooks System: Extend functionality with custom hooks that trigger on specific events
- Task Management System: Built-in background task coordination with caching and state management
- Multi-tenant Architecture: Host multiple isolated client organizations within a single instance
- Real-time Updates: Socket.IO integration with Redis clustering for live data synchronization
- Caching System: Redis-based caching with configurable TTL for improved performance
- Rate Limiting & Security: Comprehensive security with CORS management and rate limiting
- Extensibility: Add custom endpoints, services, and business logic through extensions
Documentation
Core Concepts
- Database Schema Guide - Complete schema system with relationships and field types
- Advanced Query Guide - Master complex filtering, aggregation, and spatial queries
- Item Query Reference Guide - Operator-by-operator reference (pairs with Advanced Query Guide)
- Complete Filter Reference - Comprehensive list of filter operators and syntax
- Hooks and Endpoints Guide - Custom hooks and endpoints with service access patterns
- Integration Guide - Complete client integration with practical examples
- Error Handling Guide - Robust error handling and recovery strategies
- Schema Reference Guide - Learn how to define data models
- Item Query Reference Guide - Basic query capabilities
- Hooks System - Extend functionality with custom code
- Multi-tenant Guide - Understand the multi-tenant features
- Socket.IO Integration - Implement real-time features
API Routes Documentation
- Authentication Routes - User registration, login, and session management
- Session Limits Feature - Control concurrent sessions per user and device type
- Notification Routes - User notification system
- Settings Routes - Application configuration management
- Item Routes - CRUD operations for your data
- Reports Routes - Analytics and reporting with aggregation
- File Routes - File upload and management
- Schema Routes - Create and modify data models
- Permission Routes - Control access to your data
- Workflow Routes - Workflow automation with 17 node types and real-time monitoring
- Custom Workflow Modules - Extend script nodes with custom modules via extensions
- Utils Routes - Utility endpoints
- API Routes Reference - Complete list of all API endpoints
Setup and Deployment
- Deployment Guide - Production deployment with Docker, PM2, and Kubernetes
- Baasix Extensions - Create custom extensions
- TasksService Documentation - Background task management and coordination
- Additional Features - Email templates, caching, and more
Quick Start
Prerequisites
- Node.js (v14+)
- PostgreSQL (v11+)
- npm or yarn
Installation
-
Clone the repository:
git clone https://github.com/yourusername/baasix.git cd baasix -
Install dependencies:
npm install -
Configure environment variables (create a
.envfile):DB_CLIENT=postgres DB_HOST=localhost DB_PORT=5432 DB_NAME=baasix DB_USER=postgres DB_PASSWORD=postgres SECRET_KEY=your-secret-key COOKIE_SECRET=your-cookie-secret PORT=3000 -
Start the server:
npm start
Visit http://localhost:3000 to access the admin interface.
Docker Deployment
You can also deploy BAASIX using Docker:
docker-compose up -dConfiguration Options
BAASIX can be configured through environment variables. Here are the most important ones:
Core Configuration
| Variable | Description | Default |
|---|---|---|
| NODE_ENV | Application environment | development |
| PORT | Server port | 3000 |
| SECRET_KEY | JWT secret key (min 32 chars) | - |
| COOKIE_SECRET | Cookie encryption secret | - |
Database Configuration
| Variable | Description | Default |
|---|---|---|
| DB_CLIENT | Database client (postgres) | postgres |
| DB_HOST | Database host | localhost |
| DB_PORT | Database port | 5432 |
| DB_NAME | Database name | baasix |
| DB_USER | Database username | postgres |
| DB_PASSWORD | Database password | - |
| DB_SSL | Enable SSL connection | false |
Cache & Redis
| Variable | Description | Default |
|---|---|---|
| CACHE_REDIS_URL | Redis connection URL | - |
| CACHE_TTL | Cache TTL in seconds | 30000 |
Security & CORS
| Variable | Description | Default |
|---|---|---|
| AUTH_CORS_ALLOWED_ORIGINS | Allowed CORS origins (comma-separated) | localhost:3000 |
| AUTH_CORS_ALLOW_ANY_PORT | Allow any port for CORS | false |
| RATE_LIMIT | Max requests per window | 100 |
| RATE_LIMIT_INTERVAL | Rate limit window (ms) | 5000 |
Features
| Variable | Description | Default |
|---|---|---|
| MULTI_TENANT | Enable multi-tenant mode | false |
| SOCKET_ENABLED | Enable Socket.IO | false |
| PUBLIC_REGISTRATION | Allow public user registration | true |
For complete configuration options, see the Deployment Guide.
Examples
Creating a Schema
POST /schemas
Content-Type: application/json
Authorization: Bearer <token>
{
"collectionName": "products",
"schema": {
"name": "Product",
"timestamps": true,
"fields": {
"id": {
"type": "UUID",
"primaryKey": true,
"defaultValue": {
"type": "UUIDV4"
}
},
"name": {
"type": "String",
"allowNull": false
},
"price": {
"type": "Decimal",
"values": {
"precision": 10,
"scale": 2
}
}
}
}
}Creating an Item
POST /items/products
Content-Type: application/json
Authorization: Bearer <token>
{
"name": "Awesome Product",
"price": 19.99
}Querying Items
GET /items/products?filter={"price":{"gt":10}}&sort={"price":"desc"}&fields=id,name,price&limit=20
Authorization: Bearer <token>Security
BAASIX includes comprehensive security features:
- JSON Web Token (JWT) authentication
- Cookie-based authentication
- Role-based access control (RBAC)
- Field-level permissions
- Conditional permissions using dynamic variables
- Input validation and sanitization
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.