BaasixBaasix

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

API Routes Documentation

Setup and Deployment

Quick Start

Prerequisites

  • Node.js (v14+)
  • PostgreSQL (v11+)
  • npm or yarn

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/baasix.git
    cd baasix
  2. Install dependencies:

    npm install
  3. Configure environment variables (create a .env file):

    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
  4. 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 -d

Configuration Options

BAASIX can be configured through environment variables. Here are the most important ones:

Core Configuration

VariableDescriptionDefault
NODE_ENVApplication environmentdevelopment
PORTServer port3000
SECRET_KEYJWT secret key (min 32 chars)-
COOKIE_SECRETCookie encryption secret-

Database Configuration

VariableDescriptionDefault
DB_CLIENTDatabase client (postgres)postgres
DB_HOSTDatabase hostlocalhost
DB_PORTDatabase port5432
DB_NAMEDatabase namebaasix
DB_USERDatabase usernamepostgres
DB_PASSWORDDatabase password-
DB_SSLEnable SSL connectionfalse

Cache & Redis

VariableDescriptionDefault
CACHE_REDIS_URLRedis connection URL-
CACHE_TTLCache TTL in seconds30000

Security & CORS

VariableDescriptionDefault
AUTH_CORS_ALLOWED_ORIGINSAllowed CORS origins (comma-separated)localhost:3000
AUTH_CORS_ALLOW_ANY_PORTAllow any port for CORSfalse
RATE_LIMITMax requests per window100
RATE_LIMIT_INTERVALRate limit window (ms)5000

Features

VariableDescriptionDefault
MULTI_TENANTEnable multi-tenant modefalse
SOCKET_ENABLEDEnable Socket.IOfalse
PUBLIC_REGISTRATIONAllow public user registrationtrue

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.

On this page