|
| 1 | +--- |
| 2 | +title: Architecture |
| 3 | +description: ObjectStack Enterprise Architecture - Cross-Database Edition |
| 4 | +--- |
| 5 | + |
| 6 | +# ObjectStack Enterprise Architecture |
| 7 | + |
| 8 | +## Core Value Proposition |
| 9 | + |
| 10 | +**Write Once, Run on Any DB** |
| 11 | + |
| 12 | +ObjectStack is a database-agnostic full-stack application development framework. Through standardized protocols (ObjectQL/UI), it enables developers to build portable and scalable enterprise applications without being constrained by underlying database technology stacks. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Layer 1: Protocol Layer (ObjectStack Protocols) |
| 17 | + |
| 18 | +### Positioning |
| 19 | +The "isolation layer" between business logic and underlying technology. |
| 20 | + |
| 21 | +### Core Value |
| 22 | +Application developers only need to understand ObjectQL syntax, without needing to know whether the underlying database is MySQL, PostgreSQL, or Oracle. Even if the underlying database changes, the upper-level business code (Schema and UI) doesn't need to change a single line. |
| 23 | + |
| 24 | +### Main Protocols |
| 25 | +- **ObjectQL**: Unified data query and manipulation language |
| 26 | +- **ObjectUI**: Unified UI rendering protocol |
| 27 | +- **Schema Definition**: Data model definition in JSON Schema format |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Layer 2: Core Engines (The Engines) |
| 32 | + |
| 33 | +Independent and decoupled core engine layer providing cross-database capabilities. |
| 34 | + |
| 35 | +### 1. ObjectQL (Backend Core: Multi-Database Adapter Engine) |
| 36 | + |
| 37 | +This is the true **"Universal Connector"**. It's no longer bound to SQLite but comes with a complete driver adapter layer. |
| 38 | + |
| 39 | +#### Core Modules |
| 40 | + |
| 41 | +##### AST Compiler (Abstract Syntax Tree Compiler) |
| 42 | +Compiles ObjectQL's JSON queries into an abstract syntax tree. |
| 43 | + |
| 44 | +##### Dialect Transpiler |
| 45 | +The key to cross-database support: |
| 46 | +- **MySQL**: Transpiles to `LIMIT x OFFSET y` |
| 47 | +- **Oracle**: Transpiles to `ROWNUM` or `OFFSET FETCH` |
| 48 | +- **PostgreSQL**: Optimizes queries using JSONB features |
| 49 | +- **SQL Server**: Transpiles to `TOP` or `OFFSET FETCH NEXT` |
| 50 | + |
| 51 | +##### Connection Pool |
| 52 | +Manages database connection pools, supporting high concurrency. |
| 53 | + |
| 54 | +##### Migration Engine |
| 55 | +Automatically generates ALTER TABLE DDL statements for different databases based on JSON Schema changes to synchronize table structures. |
| 56 | + |
| 57 | +#### Supported Drivers |
| 58 | + |
| 59 | +- `@objectql/driver-mysql` - MySQL database driver |
| 60 | +- `@objectql/driver-postgres` - PostgreSQL database driver |
| 61 | +- `@objectql/driver-oracle` - Oracle database driver |
| 62 | +- `@objectql/driver-sqlserver` - SQL Server database driver |
| 63 | +- `@objectql/driver-sqlite` - SQLite driver (for development environment or edge computing only) |
| 64 | + |
| 65 | +### 2. ObjectUI (Frontend Core: Rendering Engine) |
| 66 | + |
| 67 | +#### Positioning |
| 68 | +Completely decoupled from the backend. It only recognizes ObjectQL's API data format and doesn't care which database the data comes from. |
| 69 | + |
| 70 | +#### Core Features |
| 71 | +- **Database Agnostic**: Interacts entirely through ObjectQL API |
| 72 | +- **Component-based Design**: Reusable UI component library |
| 73 | +- **Responsive Rendering**: Adapts to different devices and screen sizes |
| 74 | +- **Theme Customization**: Supports custom styles and themes |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Layer 3: ObjectOS (Server-side Runtime / Middleware) |
| 79 | + |
| 80 | +### Positioning |
| 81 | +A server-oriented Headless CMS or BaaS (Backend as a Service) platform. |
| 82 | + |
| 83 | +It's no longer just a local app kernel, but a web service that can be deployed in Docker/Kubernetes. |
| 84 | + |
| 85 | +### Core Responsibilities |
| 86 | + |
| 87 | +#### 1. Unified Authentication Center (Auth Middleware) |
| 88 | + |
| 89 | +- **ObjectQL Integration**: Provides `allowRead`, `allowWrite` and other permission mechanisms |
| 90 | +- **Enterprise Authentication Integration**: Supports LDAP / OAuth2 / OIDC / SAML |
| 91 | +- **Token Parsing**: Injects user roles into ObjectQL context |
| 92 | +- **Fine-grained Access Control**: Row-level and field-level permission management |
| 93 | + |
| 94 | +#### 2. Plugin & Extension Container (Server-side Plugins) |
| 95 | + |
| 96 | +##### IO Extensions |
| 97 | +Not just local IO, but integration with various enterprise services: |
| 98 | +- **Redis**: Caching layer |
| 99 | +- **S3/OSS**: Object storage |
| 100 | +- **RabbitMQ/Kafka**: Message queues |
| 101 | + |
| 102 | +##### Webhooks |
| 103 | +Send HTTP callbacks to external systems when data changes. |
| 104 | + |
| 105 | +##### Custom Business Logic |
| 106 | +Supports developers in writing custom plugins to extend business logic. |
| 107 | + |
| 108 | +#### 3. Multi-Environment Management |
| 109 | + |
| 110 | +ObjectOS allows the same codebase to switch between different environments: |
| 111 | + |
| 112 | +- **Development Environment**: Uses `driver-sqlite` (local file, no database installation required) |
| 113 | +- **Testing Environment**: Uses `driver-mysql` (CI/CD automatic deployment) |
| 114 | +- **Production Environment**: Uses `driver-oracle` (integrates with legacy core systems) |
| 115 | + |
| 116 | +Switch environments through configuration files without modifying code. |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Layer 4: Applications & Delivery (The Applications) |
| 121 | + |
| 122 | +Under this architecture, the form of applications has evolved. No longer just ".oos files," but **"microservices" or "business modules"**. |
| 123 | + |
| 124 | +### DevOps-Friendly Delivery |
| 125 | + |
| 126 | +1. **Development Phase**: Developers write Schema and Plugin code |
| 127 | +2. **Packaging Phase**: Package into Docker Image through ObjectOS |
| 128 | +3. **Deployment Phase**: Deploy to enterprise private cloud or public cloud |
| 129 | + |
| 130 | +### SaaS Platform |
| 131 | + |
| 132 | +Quickly build multi-tenant SaaS platforms based on ObjectOS. |
| 133 | + |
| 134 | +#### Tenant Isolation Strategies |
| 135 | + |
| 136 | +##### Strategy A: Schema Discriminator |
| 137 | +All tenants share one database, distinguished by fields. |
| 138 | + |
| 139 | +**Advantages**: |
| 140 | +- High resource utilization |
| 141 | +- Low management cost |
| 142 | + |
| 143 | +**Use Cases**: |
| 144 | +- Large number of tenants |
| 145 | +- Moderate data volume |
| 146 | + |
| 147 | +##### Strategy B: Database per Tenant |
| 148 | +Each tenant uses an independent database instance. |
| 149 | + |
| 150 | +**Advantages**: |
| 151 | +- Complete data isolation |
| 152 | +- Independent performance optimization |
| 153 | +- Easy backup and recovery |
| 154 | + |
| 155 | +**Use Cases**: |
| 156 | +- Small number of tenants |
| 157 | +- High data isolation requirements |
| 158 | + |
| 159 | +**ObjectQL Advantage**: Upper-level business code doesn't need to change at all; tenant isolation can be achieved by simply configuring ObjectQL's connection strategy. |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +## Target Customers |
| 164 | + |
| 165 | +### 1. IT Departments of Medium to Large Enterprises (Platform Strategy) |
| 166 | + |
| 167 | +#### Pain Points |
| 168 | +- Dozens of legacy systems within the enterprise |
| 169 | +- Multiple databases like SQL Server, Oracle |
| 170 | +- Severe data silos, difficult system integration |
| 171 | + |
| 172 | +#### Solution |
| 173 | +Use ObjectOS as a **"Data Platform"**: |
| 174 | +- Connect various heterogeneous databases at the bottom |
| 175 | +- Provide unified ObjectQL API upward |
| 176 | +- Frontend, whether React or Vue, only calls ObjectQL |
| 177 | +- No need to worry about underlying database complexity |
| 178 | + |
| 179 | +### 2. SaaS Startups |
| 180 | + |
| 181 | +#### Pain Points |
| 182 | +- Want to quickly build SaaS products |
| 183 | +- Don't want to spend time writing CRUD, permissions, multi-tenancy logic |
| 184 | +- Need to focus on core business value |
| 185 | + |
| 186 | +#### Solution |
| 187 | +Use ObjectStack as the foundation: |
| 188 | +- Set up database table structure (Schema) in one day |
| 189 | +- Quickly generate admin backend (ObjectUI) |
| 190 | +- Focus on writing core business plugins |
| 191 | + |
| 192 | +### 3. Low-Code Platform Vendors |
| 193 | + |
| 194 | +#### Pain Points |
| 195 | +- Many low-code platforms are tied to their own proprietary databases |
| 196 | +- Customers worry about vendor lock-in |
| 197 | +- High migration costs |
| 198 | + |
| 199 | +#### Solution |
| 200 | +ObjectQL supports cross-database: |
| 201 | +- Customers can use Oracle if they want |
| 202 | +- Can migrate to cloud when needed |
| 203 | +- No vendor lock-in whatsoever |
| 204 | + |
| 205 | +--- |
| 206 | + |
| 207 | +## Technical Advantages Summary |
| 208 | + |
| 209 | +### 1. Database Agnostic |
| 210 | +- Write once, run on any database |
| 211 | +- Reduce migration costs and risks |
| 212 | + |
| 213 | +### 2. Standardized Protocols |
| 214 | +- ObjectQL provides unified data access interface |
| 215 | +- ObjectUI provides unified frontend rendering protocol |
| 216 | + |
| 217 | +### 3. Enterprise-Grade Features |
| 218 | +- Multi-tenancy support |
| 219 | +- Unified authentication center |
| 220 | +- High availability and scalability |
| 221 | + |
| 222 | +### 4. Development Efficiency |
| 223 | +- Out-of-the-box components and features |
| 224 | +- Reduce repetitive code writing |
| 225 | +- Fast iteration from prototype to production |
| 226 | + |
| 227 | +### 5. Flexible Deployment |
| 228 | +- Supports on-premises, private cloud, public cloud |
| 229 | +- Docker/Kubernetes friendly |
| 230 | +- Multi-environment configuration management |
| 231 | + |
| 232 | +--- |
| 233 | + |
| 234 | +## Architecture Evolution Roadmap |
| 235 | + |
| 236 | +### Current Stage |
| 237 | +- Core engine development |
| 238 | +- Mainstream database driver support |
| 239 | +- Basic component library construction |
| 240 | + |
| 241 | +### Near-term Goals |
| 242 | +- Enterprise authentication integration |
| 243 | +- More database drivers |
| 244 | +- Performance optimization and monitoring |
| 245 | + |
| 246 | +### Long-term Vision |
| 247 | +- Complete ecosystem |
| 248 | +- Community plugin marketplace |
| 249 | +- AI-assisted development tools |
| 250 | + |
| 251 | +--- |
| 252 | + |
| 253 | +## Getting Started |
| 254 | + |
| 255 | +To get started with ObjectStack, check out our [Getting Started](/docs/getting-started) guide. |
| 256 | + |
| 257 | +Learn more about each component: |
| 258 | +- [ObjectQL Documentation](/docs/objectql) |
| 259 | +- [ObjectUI Documentation](/docs/objectui) |
| 260 | +- [ObjectOS Documentation](/docs/objectos) |
0 commit comments