|
1 | | -# Welcome to your organization's demo respository |
2 | | -This code repository (or "repo") is designed to demonstrate the best GitHub has to offer with the least amount of noise. |
| 1 | +# ObjectStack Starter Template |
| 2 | + |
| 3 | +A starter template for building [ObjectStack](https://objectstack.ai) applications. This template demonstrates the basic structure and conventions for creating metadata-driven low-code applications using the ObjectStack framework. |
| 4 | + |
| 5 | +[](https://www.typescriptlang.org/) |
| 6 | +[](https://www.npmjs.com/package/@objectstack/spec) |
| 7 | +[](https://opensource.org/licenses/MIT) |
| 8 | + |
| 9 | +## 🚀 Quick Start |
| 10 | + |
| 11 | +### Installation |
| 12 | + |
| 13 | +```bash |
| 14 | +# Clone this repository |
| 15 | +git clone https://github.com/objectstack-ai/objectstack-starter.git |
| 16 | +cd objectstack-starter |
| 17 | + |
| 18 | +# Install dependencies |
| 19 | +npm install |
| 20 | + |
| 21 | +# Build the project |
| 22 | +npm run build |
| 23 | +``` |
| 24 | + |
| 25 | +### Development |
| 26 | + |
| 27 | +```bash |
| 28 | +# Watch mode - automatically rebuild on changes |
| 29 | +npm run dev |
| 30 | + |
| 31 | +# Type checking |
| 32 | +npm run type-check |
| 33 | + |
| 34 | +# Clean build artifacts |
| 35 | +npm run clean |
| 36 | +``` |
| 37 | + |
| 38 | +### Running the Example |
| 39 | + |
| 40 | +The template includes an example file demonstrating how to use the defined objects and views: |
| 41 | + |
| 42 | +```bash |
| 43 | +# Build the project |
| 44 | +npm run build |
| 45 | + |
| 46 | +# Run the example |
| 47 | +node dist/example.js |
| 48 | +``` |
| 49 | + |
| 50 | +This will show you how to import and work with the ObjectStack definitions. |
| 51 | + |
| 52 | +## 📦 What's Included |
| 53 | + |
| 54 | +This starter template includes: |
| 55 | + |
| 56 | +### Data Objects (`src/data/`) |
| 57 | + |
| 58 | +- **Project Task** (`project-task.object.ts`) - Task management with status, priority, assignments, and time tracking |
| 59 | +- **Contact** (`contact.object.ts`) - Contact management with CRM capabilities |
| 60 | + |
| 61 | +### UI Views (`src/ui/`) |
| 62 | + |
| 63 | +- **Task Views** (`task.view.ts`) |
| 64 | + - Grid view for task lists |
| 65 | + - Kanban board for visual task management |
| 66 | +- **Contact Views** (`contact.view.ts`) |
| 67 | + - Grid view for contact management |
| 68 | +- **App Definition** (`app.ts`) - Main application structure and navigation |
| 69 | + |
| 70 | +### Configuration |
| 71 | + |
| 72 | +- `objectstack.config.ts` - ObjectStack manifest with app metadata, navigation, and permissions |
| 73 | +- `tsconfig.json` - TypeScript configuration |
| 74 | +- `package.json` - Project dependencies and scripts |
| 75 | + |
| 76 | +## 🏗️ Project Structure |
| 77 | + |
| 78 | +``` |
| 79 | +objectstack-starter/ |
| 80 | +├── src/ |
| 81 | +│ ├── data/ # Data object definitions |
| 82 | +│ │ ├── project-task.object.ts |
| 83 | +│ │ └── contact.object.ts |
| 84 | +│ ├── ui/ # UI views and app definitions |
| 85 | +│ │ ├── task.view.ts |
| 86 | +│ │ ├── contact.view.ts |
| 87 | +│ │ └── app.ts |
| 88 | +│ ├── system/ # System configurations (future) |
| 89 | +│ ├── ai/ # AI agents and prompts (future) |
| 90 | +│ ├── api/ # API definitions (future) |
| 91 | +│ └── index.ts # Main export file |
| 92 | +├── objectstack.config.ts # ObjectStack manifest |
| 93 | +├── tsconfig.json # TypeScript configuration |
| 94 | +├── package.json # Project configuration |
| 95 | +└── README.md # This file |
| 96 | +``` |
| 97 | + |
| 98 | +## 📚 ObjectStack Concepts |
| 99 | + |
| 100 | +### Data Protocol (ObjectQL) |
| 101 | + |
| 102 | +Define your data structures using the ObjectStack Data Protocol: |
| 103 | + |
| 104 | +```typescript |
| 105 | +import type { Data } from '@objectstack/spec'; |
| 106 | + |
| 107 | +export const myObject: Data.ObjectDefinition = { |
| 108 | + name: 'my_object', // snake_case for machine names |
| 109 | + label: 'My Object', |
| 110 | + fields: { |
| 111 | + my_field: { |
| 112 | + name: 'my_field', |
| 113 | + label: 'My Field', |
| 114 | + type: 'text', |
| 115 | + required: true |
| 116 | + } |
| 117 | + }, |
| 118 | + enable: { |
| 119 | + apiEnabled: true, |
| 120 | + trackHistory: true |
| 121 | + } |
| 122 | +}; |
| 123 | +``` |
| 124 | + |
| 125 | +### UI Protocol (ObjectUI) |
| 126 | + |
| 127 | +Define views for your data: |
| 128 | + |
| 129 | +```typescript |
| 130 | +import type { UI } from '@objectstack/spec'; |
| 131 | + |
| 132 | +export const myListView: UI.ListView = { |
| 133 | + name: 'my_list', |
| 134 | + label: 'My List', |
| 135 | + type: 'grid', |
| 136 | + object: 'my_object', |
| 137 | + columns: [ |
| 138 | + { field: 'my_field', width: 200 } |
| 139 | + ] |
| 140 | +}; |
| 141 | +``` |
| 142 | + |
| 143 | +### System Protocol (ObjectOS) |
| 144 | + |
| 145 | +Configure your application: |
| 146 | + |
| 147 | +```typescript |
| 148 | +import type { System } from '@objectstack/spec'; |
| 149 | + |
| 150 | +export const config: System.Manifest = { |
| 151 | + name: 'my-app', |
| 152 | + type: 'app', |
| 153 | + displayName: 'My Application', |
| 154 | + navigation: [ |
| 155 | + { |
| 156 | + type: 'object', |
| 157 | + object: 'my_object', |
| 158 | + label: 'My Objects' |
| 159 | + } |
| 160 | + ] |
| 161 | +}; |
| 162 | +``` |
| 163 | + |
| 164 | +## 🎯 Naming Conventions |
| 165 | + |
| 166 | +ObjectStack follows strict naming conventions: |
| 167 | + |
| 168 | +- **Configuration Keys** (TypeScript properties): `camelCase` |
| 169 | + - Example: `maxLength`, `defaultValue`, `referenceFilters` |
| 170 | +- **Machine Names** (data values): `snake_case` |
| 171 | + - Example: `project_task`, `first_name`, `my_object` |
| 172 | + |
| 173 | +## 📖 Learn More |
| 174 | + |
| 175 | +- [ObjectStack Spec](https://www.npmjs.com/package/@objectstack/spec) - The protocol specification |
| 176 | +- [ObjectStack Documentation](https://objectstack.ai) - Full documentation |
| 177 | +- [ObjectStack GitHub](https://github.com/objectstack-ai) - Source code and examples |
| 178 | + |
| 179 | +## 🤝 Contributing |
| 180 | + |
| 181 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 182 | + |
| 183 | +## 📄 License |
| 184 | + |
| 185 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 186 | + |
| 187 | +## 🌟 Features |
| 188 | + |
| 189 | +- ✅ TypeScript support with strict type checking |
| 190 | +- ✅ Based on the latest @objectstack/spec (v0.3.3) |
| 191 | +- ✅ Example data objects following ObjectStack conventions |
| 192 | +- ✅ Example UI views (grid and kanban) |
| 193 | +- ✅ Proper project structure and configuration |
| 194 | +- ✅ Ready to extend with AI, API, and System protocols |
| 195 | + |
| 196 | +## 🔧 Extending This Template |
| 197 | + |
| 198 | +### Adding a New Object |
| 199 | + |
| 200 | +1. Create a new file in `src/data/` (e.g., `account.object.ts`) |
| 201 | +2. Define your object following the Data Protocol |
| 202 | +3. Export it from `src/index.ts` |
| 203 | +4. Add navigation for it in `objectstack.config.ts` |
| 204 | + |
| 205 | +### Adding a New View |
| 206 | + |
| 207 | +1. Create a new file in `src/ui/` (e.g., `account.view.ts`) |
| 208 | +2. Define your view following the UI Protocol |
| 209 | +3. Export it from `src/index.ts` |
| 210 | + |
| 211 | +### Adding AI Capabilities |
| 212 | + |
| 213 | +1. Create files in `src/ai/` for agents and prompts |
| 214 | +2. Use the AI Protocol from `@objectstack/spec/ai` |
| 215 | + |
| 216 | +### Adding API Endpoints |
| 217 | + |
| 218 | +1. Create files in `src/api/` for endpoint definitions |
| 219 | +2. Use the API Protocol from `@objectstack/spec/api` |
| 220 | + |
| 221 | +## 💡 Tips |
| 222 | + |
| 223 | +- Use the TypeScript language server for IntelliSense and type checking |
| 224 | +- Refer to the `@objectstack/spec` package for the complete protocol reference |
| 225 | +- Follow the naming conventions strictly (camelCase for config, snake_case for data) |
| 226 | +- Enable capabilities like `trackHistory` and `apiEnabled` as needed |
| 227 | +- Use the `prompts/` directory in `@objectstack/spec` for AI context |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +Built with ❤️ using [ObjectStack](https://objectstack.ai) |
3 | 232 |
|
4 | | -The repo includes an `index.html` file (so it can render a web page), two GitHub Actions workflows, and a CSS stylesheet dependency. |
|
0 commit comments