Skip to content

Commit 0ebd0c9

Browse files
authored
Merge pull request #127 from objectstack-ai/copilot/refactor-vitepress-homepage
2 parents d77d476 + 385be5a commit 0ebd0c9

File tree

1 file changed

+124
-77
lines changed

1 file changed

+124
-77
lines changed

docs/index.md

Lines changed: 124 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,120 +3,167 @@ layout: home
33

44
hero:
55
name: ObjectQL
6-
text: The Standard Protocol for AI Software Generation
7-
tagline: A universal, metadata-driven ORM and protocol designed to empower LLMs to generate enterprise apps without hallucinations.
6+
text: The Universal Data Compiler
7+
tagline: Stop writing glue code. Start compiling your data layer. Define schemas once in YAML, compile to optimized SQL for any database, auto-generate type-safe APIs.
88
image:
99
src: /logo.svg
1010
alt: ObjectQL Logo
1111
actions:
1212
- theme: brand
13-
text: 📖 Read the Guide
13+
text: Get Started
1414
link: /guide/getting-started
1515
- theme: alt
16-
text: 🤖 AI-Native Development
17-
link: /ai/
18-
- theme: alt
19-
text: 🔌 API Reference
20-
link: /api/
16+
text: View on GitHub
17+
link: https://github.com/objectstack-ai/objectql
2118

2219
features:
23-
- icon: 🛡️
24-
title: No Hallucinations
25-
details: Schema-first architecture ensures LLMs generate valid queries against a strict contract, eliminating phantom columns and tables.
26-
- icon: 📉
27-
title: Token Efficient
28-
details: Compact YAML/JSON metadata and declarative logic reduce context window usage compared to verbose ORM code generation.
29-
- icon: 🧩
30-
title: Metadata-Driven
31-
details: All logic (Schema, Validation, Permissions) is defined in declarative files. Perfect for RAG and Long-term Agent Memory.
32-
- icon: 🌍
33-
title: Universal Runtime
34-
details: Write once, run anywhere. The core protocol abstracts PostgreSQL, MongoDB, and SQLite, running in Node.js, Browser, or Edge.
20+
- icon: 🔒
21+
title: Zero-Overhead Security
22+
details: RBAC and ACL rules are compiled directly into SQL WHERE clauses at query time, not checked in application memory. Security breaches from forgotten permission checks are impossible.
23+
- icon: 🌐
24+
title: Database Agnostic
25+
details: Write your schema once. Switch from local SQLite in development to production PostgreSQL, MySQL, or TiDB without changing a single line of code. The compiler handles dialect translation.
26+
- icon:
27+
title: Virtual Columns
28+
details: Define computed fields in your schema that compile to efficient database expressions. No N+1 queries, no manual JOIN management—just declare the intent and let the compiler optimize.
3529
---
3630

37-
## The Protocol in Action
38-
39-
ObjectQL bridges the gap between AI generation and reliable execution.
40-
41-
### 1. Declarative Modeling
31+
## Show Code: From Schema to SQL
4232

43-
Define your data model in simple, human and machine-readable YAML.
33+
You define the intent in declarative YAML. ObjectQL compiles it into optimized, database-specific SQL.
4434

4535
::: code-group
4636

47-
```yaml [account.object.yml]
48-
name: account
49-
label: Account
37+
```yaml [project.object.yml]
38+
name: project
39+
label: Project
5040
fields:
51-
name: { type: text, required: true }
52-
industry:
41+
name:
42+
type: text
43+
required: true
44+
status:
5345
type: select
54-
options: [tech, finance, retail]
55-
revenue: currency
56-
status: { type: select, options: [active, vip] }
46+
options: [planning, active, completed]
47+
default: planning
48+
owner:
49+
type: lookup
50+
reference_to: users
51+
required: true
52+
# Virtual column: computed at query time
53+
task_count:
54+
type: number
55+
formula: "COUNT(tasks.id)"
56+
virtual: true
5757
```
5858
59-
```yaml [account.validation.yml]
60-
# Cross-field logic without writing code
61-
rules:
62-
vip_revenue_check:
63-
when: "status == 'vip'"
64-
expect: "revenue > 1000000"
65-
message: "VIP accounts require >1M revenue"
59+
```sql [Compiled SQL (PostgreSQL)]
60+
-- Query: Find active projects with task counts
61+
SELECT
62+
p.id,
63+
p.name,
64+
p.status,
65+
u.name AS owner_name,
66+
(SELECT COUNT(*)
67+
FROM tasks t
68+
WHERE t.project_id = p.id) AS task_count
69+
FROM projects p
70+
LEFT JOIN users u ON p.owner = u.id
71+
WHERE p.status = 'active'
72+
AND p.tenant_id = $1 -- RBAC injected automatically
73+
ORDER BY p.created_at DESC;
6674
```
6775

6876
:::
6977

70-
### 2. Hallucination-Free Querying
78+
**You define the intent. We compile the optimized SQL.**
7179

72-
LLMs generate structured JSON queries instead of error-prone SQL strings.
80+
## Why ObjectQL?
7381

74-
::: code-group
82+
### Architected for Enterprise Backends
83+
84+
ObjectQL is not a runtime wrapper around your database. It's a **compiler** that transforms high-level metadata into production-grade database operations.
85+
86+
**🔒 Security by Design**
7587

76-
```json [Request (JSON Protocol)]
77-
{
78-
"fields": ["name", "revenue", "owner.name"],
79-
"filters": [
80-
["industry", "=", "tech"],
81-
"and",
82-
["revenue", ">", 500000]
83-
]
84-
}
88+
Traditional ORMs rely on developers remembering to add permission checks:
89+
90+
```typescript
91+
// Traditional ORM - Easy to forget!
92+
const projects = await Project.find({ status: 'active' });
93+
// ❌ Oops, forgot to filter by user's tenant
8594
```
8695

87-
```sql [Generated SQL (Postgres)]
88-
SELECT t1.name, t1.revenue, t2.name
89-
FROM account AS t1
90-
LEFT JOIN users AS t2 ON t1.owner = t2.id
91-
WHERE t1.industry = 'tech'
92-
AND t1.revenue > 500000
96+
ObjectQL injects security rules during compilation:
97+
98+
```typescript
99+
// ObjectQL - Permissions enforced by the engine
100+
const projects = await objectql.find('project', {
101+
filters: [['status', '=', 'active']]
102+
});
103+
// ✅ WHERE clause automatically includes: tenant_id = current_user.tenant_id
93104
```
94-
:::
95105

96-
## The Shift to AI Programming
106+
Permission rules are defined once in metadata and enforced at the database level. Zero chance of data leakage from application-layer bugs.
97107

98-
We believe the future of software development isn't about humans writing better code—it's about **Humans architecting systems that AI can implement**.
108+
**🌐 True Database Portability**
99109

100-
To achieve this, we need a backend technology that speaks the same language as the AI.
110+
Switch databases without code changes:
101111

102-
### Why not just use TypeORM/Prisma?
112+
- **Development**: SQLite (zero configuration, file-based)
113+
- **Staging**: PostgreSQL (JSONB optimized queries)
114+
- **Production**: MySQL 8.0+ or TiDB (horizontal scaling)
115+
- **Enterprise**: Oracle or SQL Server (legacy integration)
103116

104-
Traditional ORMs are designed for *human ergonomics*. They use complex fluent APIs, generic types, and string templates. For an LLM, these are "fuzzy" targets that lead to:
105-
* **Hallucinations**: Inventing methods that don't exist.
106-
* **Context Window Bloat**: Needing huge type definition files to understand the schema.
107-
* **Injection Risks**: Generating unsafe raw SQL strings.
117+
The compiler generates dialect-specific SQL automatically. No vendor lock-in.
108118

109-
### The ObjectQL Advantage
119+
**⚡ Virtual Columns Without the Pain**
120+
121+
Define computed fields that compile to efficient SQL:
122+
123+
```yaml
124+
# In your schema
125+
revenue_total:
126+
type: currency
127+
formula: "SUM(line_items.amount)"
128+
virtual: true
129+
```
110130
111-
ObjectQL abstracts the entire backend into a **Standardized Protocol**:
131+
ObjectQL compiles this to a subquery or JOIN based on the query context. No N+1 problems, no manual optimization needed.
112132
113-
1. **Schema is Data**: `user.object.yml` is easier for AI to read/write than `class User extends Entity`.
114-
2. **Logic is Data**: Queries are ASTs like `{ op: 'find', filters: [['age', '>', 18]] }`. 100% deterministic.
115-
3. **Self-Describing**: The runtime can introspect any ObjectQL endpoint and explain it to an Agent instantly.
133+
## Compiler vs. Traditional ORM
134+
135+
| Feature | ObjectQL (Compiler) | Traditional ORM (Runtime) |
136+
|---------|---------------------|---------------------------|
137+
| **Runtime Overhead** | Near-zero (direct SQL compilation) | High (query builder + reflection) |
138+
| **Security Model** | Engine-enforced (compiled into WHERE clauses) | Application-logic (developer must remember) |
139+
| **Database Portability** | Protocol-based (dialect-agnostic AST) | Code-based (vendor-specific methods) |
140+
| **Query Optimization** | Compile-time analysis + dialect-specific optimizations | Best-effort runtime translation |
141+
| **Type Safety** | Schema-first (TypeScript types generated from YAML) | Code-first (manual type definitions) |
142+
| **Computed Fields** | Virtual columns compiled to SQL expressions | Requires manual afterLoad hooks |
143+
| **Permission Injection** | Automatic (part of compilation phase) | Manual (decorators or middleware) |
144+
| **AI Integration** | Metadata = perfect LLM context | Code = fuzzy target for generation |
145+
146+
## Supported Drivers
147+
148+
ObjectQL compiles to multiple database backends with dialect-specific optimizations:
149+
150+
**🐘 PostgreSQL** — JSONB field type support, advanced indexing strategies, full-text search with `tsvector`
151+
152+
**🐬 MySQL** — 8.0+ features including JSON columns, window functions, and CTEs
153+
154+
**💎 SQLite** — Local-first ready, zero configuration, perfect for development and edge deployments
155+
156+
**🏢 SQL Server & Oracle** — Enterprise-grade legacy system integration with vendor-specific optimization
157+
158+
**🍃 MongoDB** — Document model support with schema validation (experimental)
159+
160+
All drivers share the same query protocol. Write once, deploy anywhere.
161+
162+
---
116163

117164
## Next Steps
118165

119-
* **[🤖 Configure your AI Assistant](./ai/coding-assistant.md)**: Get the System Prompts to turn Cursor/Copilot into an ObjectQL expert.
120-
* **[🚀 Start a Tutorial](./tutorials/index.md)**: Build a Task Manager or CRM in minutes to understand the flow.
121-
* **[🔌 Building AI Agents](./ai/building-apps.md)**: Learn how to use ObjectQL as the tool interface for autonomous agents.
122-
* **[📚 Developer Guide](./guide/getting-started.md)**: The classic manual for human developers.
166+
- **[Developer Guide](/guide/getting-started)** — Build your first ObjectQL application
167+
- **[Data Modeling Reference](/guide/data-modeling)** — Learn the schema definition language
168+
- **[Query Language Spec](/spec/query-language)** — Understand the compilation target
169+
- **[AI-Native Development](/ai/)** — Use ObjectQL as an LLM tool interface

0 commit comments

Comments
 (0)