Skip to content

Commit 54dede4

Browse files
committed
Add initial documentation and remove .cursorrules
Added comprehensive documentation under the docs directory, including guides for data modeling, logic actions, hooks, SDK reference, security, and protocol specifications. Removed the .cursorrules file containing internal coding standards and architecture guidelines.
1 parent 3d469fd commit 54dede4

File tree

13 files changed

+233
-187
lines changed

13 files changed

+233
-187
lines changed

.cursorrules

Lines changed: 0 additions & 187 deletions
This file was deleted.

docs/guide/data-modeling.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Data Modeling
2+
3+
ObjectOS uses YAML to define data models.
4+
5+
## Object Definition
6+
7+
Files named `*.object.yml` define your entities.
8+
9+
```yaml
10+
code: project
11+
label: Project
12+
fields:
13+
name:
14+
label: Project Name
15+
type: text
16+
required: true
17+
```
18+
19+
## Field Types
20+
21+
- `text`
22+
- `number`
23+
- `currency`
24+
- `lookup` (Relationship)

docs/guide/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Getting Started with ObjectOS
2+
3+
ObjectOS is a high-performance, metadata-driven low-code runtime engine.
4+
5+
## Core Concepts
6+
7+
- **Kernel**: The brain of the operation.
8+
- **Drivers**: How we talk to databases.
9+
- **Server**: Exposing APIs over HTTP.
10+
11+
## Installation
12+
13+
```bash
14+
npm install @objectos/kernel @objectos/server
15+
```
16+
17+
## Quick Start
18+
19+
Initialize the kernel and register your first object.

docs/guide/logic-actions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Custom Actions
2+
3+
Actions are custom business logic endpoints.
4+
5+
## Defining an Action
6+
7+
Actions are often defined in YAML files (`*.action.yml`) or registered programmatically.
8+
9+
```typescript
10+
kernel.registerAction('project.archive', async (ctx) => {
11+
const { id } = ctx.params;
12+
// Custom logic to archive project
13+
});
14+
```

docs/guide/logic-hooks-examples.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Logic Hooks Examples
2+
3+
## Auto-Populate Current User
4+
5+
```typescript
6+
kernel.on('beforeCreate', async (ctx) => {
7+
if (ctx.objectName === 'task' && ctx.user) {
8+
ctx.data.created_by = ctx.user.id;
9+
}
10+
});
11+
```
12+
13+
## Validation
14+
15+
```typescript
16+
kernel.on('beforeUpdate', async (ctx) => {
17+
if (ctx.objectName === 'project' && ctx.data.budget < 0) {
18+
throw new ValidationError('Budget cannot be negative');
19+
}
20+
});
21+
```

docs/guide/logic-hooks.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Writing Hooks
2+
3+
Hooks allow you to intercept and modify standard operations.
4+
5+
## Hook Events
6+
7+
- `beforeFind`, `afterFind`
8+
- `beforeCreate`, `afterCreate`
9+
- `beforeUpdate`, `afterUpdate`
10+
- `beforeDelete`, `afterDelete`
11+
12+
## Registration
13+
14+
```typescript
15+
kernel.on('beforeCreate', async (ctx) => {
16+
console.log('Creating object:', ctx.objectName);
17+
});
18+
```

docs/guide/sdk-reference.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SDK Reference
2+
3+
The Kernel SDK provides methods to interact with your data programmatically.
4+
5+
## `kernel.find(objectName, options)`
6+
7+
Retrieves records matching the query options.
8+
9+
```typescript
10+
const projects = await kernel.find('project', {
11+
filters: [['status', '=', 'active']]
12+
});
13+
```
14+
15+
## `kernel.create(objectName, data)`
16+
17+
Creates a new record.
18+
19+
```typescript
20+
await kernel.create('project', { name: 'New API' });
21+
```

docs/guide/security-guide.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Security Guide
2+
3+
Security in ObjectOS is handled through Permissions and Plugins.
4+
5+
## Authentication
6+
7+
Use `@objectos/plugin-auth` for handling user sessions.
8+
9+
## Authorization
10+
11+
Permissions are defined in object definitions or via permission sets.
12+
13+
```typescript
14+
// Example of permission check
15+
if (!ctx.hasPermission('project', 'create')) {
16+
throw new PermissionDeniedError();
17+
}
18+
```

docs/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: home
3+
4+
hero:
5+
name: "ObjectOS"
6+
text: "A Unified Data Management Framework"
7+
tagline: "Kernel handles logic, Drivers handle data, Server handles HTTP."
8+
actions:
9+
- theme: brand
10+
text: Get Started
11+
link: /guide/
12+
- theme: alt
13+
text: View Spec
14+
link: /spec/
15+
16+
features:
17+
- title: Metadata Driven
18+
details: Define your business logic and data schema using simple YAML files.
19+
- title: Kernel & Drivers
20+
details: Core logic is decoupled from data storage implementation.
21+
- title: HTTP Ready
22+
details: Built-in NestJS server integration for instant API generation.
23+
---

docs/spec/http-protocol.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# HTTP Protocol
2+
3+
The Server exposes a RESTful API following these conventions.
4+
5+
## Headers
6+
7+
- `Content-Type: application/json`
8+
- `Authorization: Bearer <token>`
9+
10+
## Response Envelope
11+
12+
```json
13+
{
14+
"code": 200,
15+
"data": { ... },
16+
"message": "Success"
17+
}
18+
```
19+
20+
## Standard Endpoints
21+
22+
- `GET /api/v4/{object}/query`
23+
- `POST /api/v4/{object}`
24+
- `PUT /api/v4/{object}/{id}`
25+
- `DELETE /api/v4/{object}/{id}`

0 commit comments

Comments
 (0)