The Engine (ObjectQL)
The Metadata-Driven Data Engine
The Engine (ObjectQL)
The Universal Protocol for Data Virtualization.
ObjectQL is the heart of ObjectStack. It is not an ORM (Object-Relational Mapper). It is a Metadata-Driven Data Engine that completely abstracts the concept of "storage" from your business logic.
The Problem: Storage Coupling
In traditional development, your business logic is tightly coupled to your database. You write specific SQL queries for Postgres, specific aggregation pipelines for MongoDB, or use an ORM that leaks leaky abstractions.
When you need to scale from SQLite to Postgres, or offload analytics to ClickHouse, you rewrite code. This is Technical Debt created by coupling.
The Solution: The ObjectQL Protocol
ObjectQL introduces a protocol layer between your intent and the storage.
- You Define Intent: You describe what data you need using the ObjectQL Schema language.
- The Engine Compiles: ObjectQL analyzes your request, your permissions, and the target storage capabilities.
- Drivers Execute: The engine instructs the appropriate Driver (Postgres, Redis, Excel) to fetch the data efficiently.
Example: One Schema, Many Drivers
# customer.objectql.yml
entity:
name: Customer
storage:
driver: postgres_main # Stored in PostgreSQL
fields:
- name: name
type: text
- name: logs
type: array
storage:
driver: s3_logs # Stored in S3 JSON files!
- name: cached_status
type: text
storage:
driver: redis_cache # Fetched from Redis!
In this example, querying a Customer object transparently fetches data from Postgres, S3, and Redis. The developer queries one object. The Engine handles the complexity.
Key Capabilities
1. Polyglot Persistence without the Pain
Treat disparate data sources as a single cohesive graph. Join data from a CSV file with data from a SQL database. ObjectQL handles the cross-source joining and filtering in memory or via optimized push-down queries.
2. Zero-Overhead Security
Security is not an "afterthought" middleware. In ObjectQL, access control policies (RBAC) are compiled into the query.
If a user only has access to "Region: US", the generated SQL will automatically include WHERE region = 'US'. It is impossible for a developer to forget a permission check.
3. Virtual Columns & Computed Fields
Define business logic directly in your schema.
- name: full_name
type: virtual
expression: "${first_name} || ' ' || ${last_name}"
ObjectQL compiles this into the native SQL concatenation for Postgres, or a JavaScript function for MongoDB.
Supported Drivers
ObjectStack ships with a robust set of Universal Drivers:
- Relational: PostgreSQL, MySQL, SQLite, TiDB
- NoSQL: MongoDB, Redis (as a primary store)
- Files: Excel (.xlsx), CSV, JSON, Markdown (Frontmatter)
- API: REST, GraphQL (Federation)
Use Cases
- Legacy Modernization: Wrap an old Oracle database with ObjectQL to give it a modern API without migrating data.
- SaaS building: Use the "Tenant" primitive to automatically partition data by customer ID.
- Rapid Prototyping: Start with SQLite and switch to Postgres in production by changing one line of config.