Skip to content

Commit 8dea4b9

Browse files
committed
feat(project-tracker): add projects and tasks modules with comprehensive hooks, permissions, and validation
- Introduced projects.data.yml and tasks.data.yml for initial data setup. - Created projects.hook.ts implementing various hooks for data validation, state transitions, and notifications. - Defined projects.object.yml and tasks.object.yml for schema definitions including fields and actions. - Established projects.permission.yml and tasks.permission.yml for detailed access control rules. - Implemented projects.validation.yml for validation rules ensuring data integrity. - Added types for Projects and Tasks in TypeScript for type safety. - Configured tsconfig.json for TypeScript compilation settings.
1 parent 3639de8 commit 8dea4b9

File tree

176 files changed

+356
-3080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+356
-3080
lines changed

.vscode/tasks.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "Run Studio: Basic Script",
5+
"label": "Run Dev Server",
66
"type": "shell",
7-
"command": "node",
7+
"command": "pnpm",
88
"args": [
9-
"packages/cli/dist/index.js",
10-
"studio",
11-
"--dir",
12-
"examples/starters/basic-script"
9+
"objectql",
10+
"dev"
1311
],
1412
"group": "test",
1513
"presentation": {

docs/guide/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { ObjectQL } from '@objectql/core';
1111
export const db = new ObjectQL({
1212
connection: 'sqlite://data.db', // 1. Infrastructure
1313
modules: [
14-
'@objectql/starter-basic', // 2. External Module (NPM)
15-
'./src/modules/billing' // 3. Local Module
14+
'@my-org/module-crm', // 2. External Module (NPM)
15+
'./src/modules/billing' // 3. Local Module
1616
],
1717
// source: ... (Deprecated, use modules)
1818
plugins: [] // 4. Extensions

docs/guide/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async function main() {
8686
// Load schema from local directories OR npm packages
8787
modules: [
8888
'src/objects', // Local Module
89-
'@objectql/starter-auth' // External Module (NPM)
89+
'@objectql/module-auth' // External Module (NPM)
9090
]
9191
});
9292

examples/README.md

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,77 @@
1-
# ObjectQL Examples Gallery
1+
# ObjectQL Examples
22

3-
Welcome to the ObjectQL examples collection. This directory is organized to help you find the right starting point for your needs, from simple scripts to complex real-world applications.
3+
Welcome to the ObjectQL Examples repository. This collection demonstrates everything from "Hello World" scripts to complex, module-driven enterprise architectures.
44

5-
## 📚 Quick References
5+
## 📂 Directory Structure
66

7-
| Resource | Description |
8-
| :--- | :--- |
9-
| **[Attachment Upload Demo](./attachment-upload-demo.md)** | Complete guide to uploading files, handling images, creating records with attachments, and implementing file upload components |
10-
11-
## 🌐 Browser Demos
12-
*ObjectQL running directly in web browsers - no backend required!*
7+
### 1. 🚀 Starters (Quick Start)
8+
*Standard templates found in `examples/starters/`*
139

1410
| Example | Description | Proficiency |
1511
| :--- | :--- | :--- |
16-
| **[Memory Driver Demo](./browser-demo/)** | Interactive task manager running entirely in the browser with in-memory storage. Perfect for prototyping and understanding ObjectQL's client-side capabilities. | 🌱 Beginner |
17-
| **[LocalStorage Demo](./browser-localstorage-demo/)** | Persistent browser storage that survives page refreshes. Ideal for offline apps, PWAs, and user preferences. | ⚡️ Intermediate |
12+
| **[Hello World](./starters/hello-world)** | **Absolute minimum.** A single TypeScript file using `ObjectQL` programmatically with an in-memory database. No config, no CLI. | 🟢 Basic |
13+
| **[Express API](./starters/express-api)** | **The Standard Server.** Shows how to mount ObjectQL onto an existing Express.js application as a middleware. | 🟢 Basic |
14+
| **[Basic Script](./starters/basic-script)** | A simple TypeScript script initializing ObjectQL with SQLite. Perfect for testing logic without a web server. | 🟢 Basic |
15+
16+
### 2. 🧩 Module Architecture
17+
*Demonstrating the power of the new `modules` system in `objectql.config.ts`. See `examples/scenarios/`.*
1818

19-
**Features:**
20-
- 🎨 Beautiful interactive UI with live CRUD operations
21-
- 📊 Real-time statistics dashboard
22-
- 🖥️ Browser console debugging (`window.app`, `window.taskRepo`)
23-
- ✨ Sample data generation
24-
- 🔄 Filter and manage data visually
19+
| Example | Description | Proficiency |
20+
| :--- | :--- | :--- |
21+
| **[Module Composition](./scenarios/module-composition)** | **[Code](./scenarios/module-composition)** <br> Shows how to mix **Local Modules** (`./src/modules/billing`) with **External NPM Modules** (`@objectql/module-auth`) in a single application. | 💡 Intermediate |
22+
| **[Enterprise Monorepo](./scenarios/enterprise-monorepo)** | **[Code](./scenarios/enterprise-monorepo)** <br> Organizing a large-scale application into domain-specific modules (CRM, HR, Finance). | 🏢 Advanced |
2523

26-
## 🚀 Starters
27-
*Boilerplates and minimal setups to get you coding in seconds.*
24+
### 3. 📚 Tutorials (Step-by-Step)
25+
*Found in `examples/tutorials/`*
2826

2927
| Example | Description | Proficiency |
3028
| :--- | :--- | :--- |
31-
| **[Basic Script](./starters/basic-script)** | A simple TypeScript script initializing ObjectQL with SQLite. Perfect for testing logic. | 🌱 Beginner |
32-
| **[Express API](./starters/express-api)** | A REST API server using Express.js + ObjectQL. Shows how to mount the server adapter. | ⚡️ Intermediate |
29+
| **[Task Manager](./tutorials/tutorial-task-manager)** | A simple Todo list app to learn objects, fields, and basic validation. | 🟢 Basic |
30+
| **[CRM System](./tutorials/tutorial-crm-system)** | A relational database example with Customers, Contacts, and Deals. Demonstrates `lookup` fields. | 💡 Intermediate |
31+
| **[AI Agent](./tutorials/tutorial-ai-agent)** | Integrating LLMs to query your data using natural language. | 🧠 AI-Native |
32+
| **[Formulas & Rules](./tutorials/tutorial-formulas)** | Using Excel-like formula syntax for computed fields and validation. | 💡 Intermediate |
33+
| **[Federation](./tutorials/tutorial-federation)** | Connecting multiple ObjectQL services together. | 🏢 Advanced |
3334

34-
## 🧩 Plugins & Extensions
35-
*Learn how to extend the core capabilities of ObjectQL.*
35+
### 4. 🌐 Browser Demos
36+
*Run ObjectQL in the browser with no backend.*
3637

3738
| Example | Description | Proficiency |
3839
| :--- | :--- | :--- |
39-
| **[Audit Log](./plugins/audit-log)** | A fully functional plugin that tracks changes (`afterCreate`, `afterUpdate`) and stores them. | 🔧 Advanced |
40+
| **[Memory Driver Demo](./browser-demo/)** | Interactive task manager running entirely in the browser. | 🟢 Basic |
41+
| **[LocalStorage Demo](./browser-localstorage-demo/)** | Persistent browser storage. Ideal for offline apps. | 💡 Intermediate |
4042

41-
## 🏗 Scenarios & Patterns
42-
*Demonstrations of specific architectural patterns.*
43+
### 5. 🔌 Plugins & Extensions
44+
*Found in `examples/plugins/`*
4345

4446
| Example | Description | Proficiency |
4547
| :--- | :--- | :--- |
46-
| **[Enterprise Structure](./scenarios/enterprise-structure)** | **[NEW]** Best practices for organizing metadata in large-scale applications. Shows domain-driven module structure with 20+ objects across CRM, HR, Finance, and Project modules. | 🏢 Advanced |
47-
| **[Module Usage](./scenarios/module-usage)** | Shows how to consume pre-packaged business logic (modules) in an application. | 💡 Intermediate |
48+
| **[Audit Log](./plugins/audit-log)** | How to write a generic plugin that intercepts `beforeCreate` and `afterUpdate` hooks to log changes. | 💡 Intermediate |
4849

49-
## 🚧 Coming Soon
50-
We are working on high-fidelity examples:
51-
- **CRM System**: A Salesforce-like CRM with rich permission rules.
52-
- **E-Commerce**: High-performance catalog and order management.
53-
- **Next.js Integration**: Using Server Actions with ObjectQL.
54-
- **AI RAG Demo**: Semantic search connecting to OpenAI.
50+
### 6. 🛠 Integration Snippets
51+
*Standalone files in root `examples/`*
52+
53+
| Example | Description |
54+
| :--- | :--- |
55+
| **[Existing Database](./connect-existing-database.ts)** | How to use Introspection to generate ObjectQL schema from an existing SQL database. |
56+
| **[Custom API Routes](./custom-api-routes.ts)** | Adding custom REST endpoints alongside the auto-generated ObjectQL API. |
57+
| **[Schema Migration](./schema-migration-example.ts)** | Programmatic usage of the migration system. |
5558

5659
---
57-
## How to Run
5860

59-
Each example is a self-contained NPM package.
61+
## 🏃‍♀️ How to Run
62+
63+
Most examples can be decoupled and run independently.
6064

65+
**For Starters:**
6166
```bash
62-
cd examples/starters/express-api
67+
cd examples/starters/hello-world
6368
pnpm install
6469
pnpm start
6570
```
6671

67-
- [ObjectQL Documentation](../docs/)
68-
- [Metadata Specification](../docs/spec/metadata-format.md)
69-
- [Metadata Protection Guide](../docs/spec/metadata-format.md#9-metadata-protection)
72+
**For Modules/Scenarios:**
73+
```bash
74+
# From root
75+
pnpm objectql dev --dir examples/tutorials/tutorial-task-manager
76+
```
77+

examples/browser-demo/README.md

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

0 commit comments

Comments
 (0)