spine-framework 0.3.49 → 0.3.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,7 +128,8 @@ BEGIN
128
128
  '{}'::jsonb,
129
129
  'pack',
130
130
  true
131
- );
131
+ )
132
+
132
133
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
133
134
 
134
135
  -- 2. MASTER SYSTEM ACCOUNT (inserted here to satisfy FK on type_id)
@@ -189,7 +190,8 @@ BEGIN
189
190
  '{}'::jsonb,
190
191
  'pack',
191
192
  true
192
- );
193
+ )
194
+
193
195
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
194
196
 
195
197
  -- 5.3 items type
@@ -232,7 +234,8 @@ BEGIN
232
234
  '{}'::jsonb,
233
235
  'pack',
234
236
  true
235
- );
237
+ )
238
+
236
239
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
237
240
 
238
241
  -- 5.4 threads type
@@ -277,7 +280,8 @@ BEGIN
277
280
  '{}'::jsonb,
278
281
  'pack',
279
282
  true
280
- );
283
+ )
284
+
281
285
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
282
286
 
283
287
  -- 5.5 messages type
@@ -321,7 +325,8 @@ BEGIN
321
325
  '{}'::jsonb,
322
326
  'pack',
323
327
  true
324
- );
328
+ )
329
+
325
330
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
326
331
 
327
332
  -- 5.6 links type
@@ -365,7 +370,8 @@ BEGIN
365
370
  '{}'::jsonb,
366
371
  'pack',
367
372
  true
368
- );
373
+ )
374
+
369
375
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
370
376
 
371
377
  -- 5.7 attachments type
@@ -410,7 +416,8 @@ BEGIN
410
416
  '{}'::jsonb,
411
417
  'pack',
412
418
  true
413
- );
419
+ )
420
+
414
421
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
415
422
 
416
423
  -- 5.8 watchers type
@@ -455,7 +462,8 @@ BEGIN
455
462
  '{}'::jsonb,
456
463
  'pack',
457
464
  true
458
- );
465
+ )
466
+
459
467
  ON CONFLICT (app_id, kind, slug) DO NOTHING;
460
468
 
461
469
  -- Update the spine-system account with the actual accounts type_id
package/README.md CHANGED
@@ -1,254 +1,192 @@
1
- Spine Framework
2
- A complete enterprise application framework built on Supabase + Netlify + React for building scalable multi-tenant applications with extensible app ecosystems.
3
-
4
- Overview
5
- Spine Framework is a complete, runnable framework that provides everything you need to build enterprise applications:
6
-
7
- Multi-tenant Architecture: Support for tenant hierarchies and isolated deployments
8
- Role-Based Access Control: Fine-grained permissions and authorization
9
- App Ecosystem: Install and manage custom applications
10
- Real-time Features: Built-in support for real-time collaboration and notifications
11
- AI Integration: Native support for AI agents and intelligent workflows
12
- Developer Tools: Comprehensive tooling for development, testing, and deployment
13
- Quick Start
14
- Prerequisites
15
- Node.js 18+
16
- PostgreSQL database (via Supabase recommended)
17
- Netlify account (for deployment)
18
- Installation
19
- # Clone the framework
20
- git clone https://github.com/spine-framework/spine-framework.git
21
- cd spine-framework
1
+ # Spine Framework
22
2
 
23
- # Install dependencies
24
- npm install
3
+ A complete enterprise application platform built on Supabase + Netlify + React for building scalable multi-tenant SaaS applications with an extensible app ecosystem.
25
4
 
26
- # Set up environment
27
- cp .env.example .env
28
- # Edit .env with your Supabase and Netlify credentials
5
+ ---
29
6
 
30
- # Start development
31
- npm run dev
32
- Install Custom Apps
33
- # Install Cortex (CRM, Support, Community, Knowledge Base)
34
- npm run app-install cortex
35
-
36
- # Install Customer Portal
37
- npm run app-install customer-portal
38
-
39
- # List available apps
40
- npm run spine-framework list-apps
41
- Architecture
42
- Core Components
43
- Framework Core: Base functionality, authentication, and data models
44
- App Registry: System for managing and distributing applications
45
- Multi-tenant Engine: Tenant isolation and hierarchy management
46
- Authorization Layer: Role-based permissions and access control
47
- Real-time Infrastructure: WebSocket support and live updates
48
- AI Agent System: Integration with AI services and workflows
49
- App Ecosystem
50
- Spine Framework supports a growing ecosystem of applications:
51
-
52
- Cortex: CRM, Support, Community, and Knowledge Base
53
- Customer Portal: Self-service customer portal
54
- Custom Apps: Build your own applications using the framework
55
- Database Schema
56
- The framework uses a clean, normalized schema with:
57
-
58
- Accounts & Tenants: Multi-tenant hierarchy support
59
- People & Roles: User management and permissions
60
- Items & Threads: Flexible data modeling system
61
- Apps & Integrations: Extensible app registry
62
- AI Agents: Intelligent workflow automation
63
- Development
64
- Project Structure
65
- my-spine-project/
66
- ├── src/
67
- │ ├── components/ # Reusable UI components
68
- │ ├── pages/ # Application pages
69
- │ ├── hooks/ # Custom React hooks
70
- │ ├── contexts/ # React contexts
71
- │ └── utils/ # Utility functions
72
- ├── functions/ # Serverless functions
73
- ├── migrations/ # Database migrations
74
- ├── custom/ # Custom app extensions
75
- └── docs/ # Documentation
76
- Building Apps
77
- Create custom applications using the Spine Framework:
78
-
79
- // src/apps/my-app/index.tsx
80
- import { AppLayout, useCurrentApp } from '@spine-framework/core'
7
+ ## Quick Start
8
+
9
+ ### Prerequisites
10
+
11
+ - Node.js 18+
12
+ - A [Supabase](https://supabase.com) project
13
+ - A [Netlify](https://netlify.com) account
14
+
15
+ ### 1. Create a new project
16
+
17
+ ```bash
18
+ mkdir my-app && cd my-app
19
+ npm install spine-framework
20
+ npx spine-framework init
21
+ ```
22
+
23
+ This scaffolds the full project structure, copies all framework files, and writes a `.env` template.
24
+
25
+ ### 2. Configure your environment
26
+
27
+ Edit `.env` with your Supabase credentials:
28
+
29
+ ```env
30
+ SUPABASE_URL=https://your-project.supabase.co
31
+ SUPABASE_ANON_KEY=your-anon-key
32
+ SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
33
+ SUPABASE_DB_PASSWORD=your-database-password
34
+ ```
35
+
36
+ Get these from your [Supabase dashboard](https://supabase.com/dashboard/project/_/settings/api).
37
+ `SUPABASE_DB_PASSWORD` is under **Settings → Database**.
38
+
39
+ ### 3. Apply database migrations
40
+
41
+ ```bash
42
+ npx spine-framework migrate
43
+ ```
44
+
45
+ This creates all tables, RLS policies, functions, and seeds system data. Safe to re-run on an existing project — migrations are idempotent.
46
+
47
+ ### 4. Start the development server
48
+
49
+ ```bash
50
+ npm install && npm run assemble && netlify dev
51
+ ```
52
+
53
+ Your app is now running at `http://localhost:8888`.
54
+
55
+ ---
56
+
57
+ ## CLI Reference
58
+
59
+ All commands run via `npx spine-framework <command>`.
60
+
61
+ | Command | Description |
62
+ |---------|-------------|
63
+ | `init` | Scaffold a new project in the current directory |
64
+ | `migrate` | Apply framework SQL migrations to your Supabase project |
65
+ | `migrate --dry-run` | Preview pending migrations without applying |
66
+ | `migrate --db-password <pw>` | Pass DB password directly instead of reading from `.env` |
67
+ | `status` | Show installed apps and framework version |
68
+
69
+ ---
70
+
71
+ ## Project Structure
72
+
73
+ After `init`, your project looks like this:
74
+
75
+ ```
76
+ my-app/
77
+ ├── .env # Your credentials (never commit this)
78
+ ├── .framework/ # Framework core (do not edit)
79
+ │ ├── cli/ # CLI commands
80
+ │ ├── functions/ # Serverless API functions
81
+ │ ├── migrations/ # SQL migrations
82
+ │ ├── src/ # React frontend core
83
+ │ └── scripts/ # Build scripts
84
+ ├── custom/ # Your custom apps and extensions
85
+ │ └── apps/ # App packages go here
86
+ ├── config/ # Vite, TypeScript, Tailwind config
87
+ ├── scripts/ # Project-level build scripts
88
+ ├── netlify.toml # Netlify configuration
89
+ └── package.json
90
+ ```
81
91
 
92
+ ---
93
+
94
+ ## Architecture
95
+
96
+ - **Multi-tenant**: Account hierarchy with inherited access and RLS-enforced isolation
97
+ - **Role-based access control**: Fine-grained permissions via database-enforced policies
98
+ - **App ecosystem**: Install, manage, and build custom applications on the framework
99
+ - **Serverless API**: Netlify Functions handle all backend logic
100
+ - **Real-time**: Supabase Realtime for live updates
101
+ - **AI integration**: Native support for AI agents and pipeline automation
102
+
103
+ ### Database Schema
104
+
105
+ | Table group | Tables |
106
+ |-------------|--------|
107
+ | Identity | `accounts`, `people`, `roles` |
108
+ | Runtime | `items`, `threads`, `messages`, `links`, `attachments`, `watchers` |
109
+ | Apps | `apps`, `types`, `pipelines`, `triggers` |
110
+ | AI | `ai_agents`, `embeddings`, `prompt_configs` |
111
+ | System | `api_keys`, `logs`, `integrations`, `timers` |
112
+
113
+ ---
114
+
115
+ ## Building Custom Apps
116
+
117
+ Create your own applications and place them in `custom/apps/`:
118
+
119
+ ```tsx
120
+ // custom/apps/my-app/index.tsx
82
121
  export default function MyApp() {
83
- const app = useCurrentApp()
84
-
85
- return (
86
- <AppLayout>
87
- <h1>{app.name}</h1>
88
- {/* Your app content */}
89
- </AppLayout>
90
- )
122
+ return <div>Hello from My App</div>
91
123
  }
92
- Database Extensions
93
- Add custom database schema:
94
-
95
- -- migrations/001_my_app.sql
96
- CREATE TABLE my_app_data (
97
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
98
- account_id UUID REFERENCES accounts(id),
99
- title TEXT NOT NULL,
100
- created_at TIMESTAMPTZ DEFAULT now()
124
+ ```
125
+
126
+ Add custom database migrations in `custom/migrations/`:
127
+
128
+ ```sql
129
+ -- custom/migrations/001_my_app.sql
130
+ CREATE TABLE IF NOT EXISTS my_app_records (
131
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
132
+ account_id uuid NOT NULL REFERENCES public.accounts(id),
133
+ title text NOT NULL,
134
+ created_at timestamptz DEFAULT now()
101
135
  );
102
136
 
103
- -- Enable RLS
104
- ALTER TABLE my_app_data ENABLE ROW LEVEL SECURITY;
105
- Configuration
106
- Environment Variables
107
- # Database
108
- DATABASE_URL=postgresql://...
137
+ ALTER TABLE my_app_records ENABLE ROW LEVEL SECURITY;
138
+ ```
109
139
 
110
- # Supabase
111
- SUPABASE_URL=your-project.supabase.co
112
- SUPABASE_ANON_KEY=your-anon-key
113
- SUPABASE_SERVICE_ROLE_KEY=your-service-key
114
-
115
- # Framework
116
- SPINE_ENV=development
117
- SPINE_LOG_LEVEL=info
118
- Framework Configuration
119
- // spine.config.ts
120
- export default {
121
- database: {
122
- url: process.env.DATABASE_URL,
123
- poolSize: 10,
124
- },
125
- auth: {
126
- providers: ['email', 'github', 'google'],
127
- sessionTimeout: '24h',
128
- },
129
- apps: {
130
- registry: 'https://registry.spine-framework.com',
131
- autoUpdate: true,
132
- },
133
- ai: {
134
- provider: 'openai',
135
- model: 'gpt-4',
136
- }
137
- }
138
- Deployment
139
- Development
140
- # Start development server
141
- npm run dev
140
+ Custom migrations are picked up automatically by `npx spine-framework migrate`.
141
+
142
+ ---
142
143
 
143
- # Run tests
144
- npm test
144
+ ## Environment Variables
145
145
 
146
- # Type checking
147
- npm run type-check
148
- Production
149
- # Build for production
150
- npm run build
146
+ | Variable | Required | Description |
147
+ |----------|----------|-------------|
148
+ | `SUPABASE_URL` | Yes | Your Supabase project URL |
149
+ | `SUPABASE_ANON_KEY` | Yes | Supabase anon/public key |
150
+ | `SUPABASE_SERVICE_ROLE_KEY` | Yes | Supabase service role key (server-side only) |
151
+ | `SUPABASE_DB_PASSWORD` | Yes (migrate) | Postgres database password |
151
152
 
152
- # Deploy to Netlify
153
+ ---
154
+
155
+ ## Deployment
156
+
157
+ ```bash
158
+ # Build and deploy to Netlify
159
+ npm run assemble
153
160
  netlify deploy --prod
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Contributing
154
166
 
155
- # Or deploy to your preferred platform
156
- Database Migrations
157
- # Run migrations
158
- npx spine migrate up
159
-
160
- # Create new migration
161
- npx spine migrate create add_new_feature
162
-
163
- # Rollback migration
164
- npx spine migrate down
165
- Available Apps
166
- Official Apps
167
- spine-framework-cortex
168
-
169
- CRM, Support, Community, Knowledge Base
170
- npm install spine-framework-cortex
171
- spine-framework-portal
172
-
173
- Customer self-service portal
174
- npm install spine-framework-portal
175
- Installing Apps
176
- # Install an app
177
- npx spine install-app cortex
178
-
179
- # List available apps
180
- npx spine list-apps
181
-
182
- # Update an app
183
- npx spine update-app cortex
184
- API Reference
185
- Core Hooks
186
- // Authentication
187
- import { useAuth, useUser } from '@spine-framework/core'
188
-
189
- // App Management
190
- import { useApps, useCurrentApp } from '@spine-framework/core'
191
-
192
- // Data Management
193
- import { useItems, useThreads } from '@spine-framework/core'
194
-
195
- // Real-time
196
- import { useWebSocket } from '@spine-framework/core'
197
- Database Functions
198
- -- Get account apps
199
- SELECT * FROM get_account_apps(account_id, true, false);
200
-
201
- -- Get accessible accounts
202
- SELECT * FROM get_accessible_accounts(user_id);
203
-
204
- -- Check permissions
205
- SELECT * FROM has_permission(user_id, 'action', 'resource');
206
- Contributing
207
- Development Setup
208
- # Clone the repository
167
+ ```bash
209
168
  git clone https://github.com/spine-framework/spine-framework.git
210
169
  cd spine-framework
211
-
212
- # Install dependencies
213
170
  npm install
214
-
215
- # Start development
216
171
  npm run dev
217
- Submitting Changes
218
- Fork the repository
219
- Create a feature branch
220
- Make your changes
221
- Add tests
222
- Submit a pull request
223
- Building Apps for Distribution
224
- If you want to contribute an app to the ecosystem:
225
-
226
- Create your app using the framework
227
- Follow the app structure guidelines
228
- Include comprehensive documentation
229
- Submit for review
230
- License
231
- This framework is licensed under the Spine Framework Internal Use License.
232
-
233
- ✅ Free for internal business use
234
- ❌ Commercial redistribution requires separate license
235
- 📞 Contact: spine-framework.com for commercial licensing
236
- Support
237
- Documentation: docs.spine-framework.com
238
- Issues: GitHub Issues
239
- Community: Discord Server
240
- Commercial: Contact Us
241
- Version History
242
- v1.0.0
243
- Initial release
244
- Multi-tenant architecture
245
- App registry system
246
- Role-based access control
247
- Real-time features
248
- AI integration
249
- Roadmap
250
- v1.1: Enhanced AI capabilities
251
- v1.2: Advanced analytics and reporting
252
- v1.3: Mobile app support
253
- v2.0: Microservices architecture
254
- Spine Framework - Build enterprise applications with confidence.
172
+ ```
173
+
174
+ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for internals and [docs/APPS.md](docs/APPS.md) for the app development guide.
175
+
176
+ ---
177
+
178
+ ## License
179
+
180
+ Licensed under the [Spine Framework Internal Use License](LICENSE.md).
181
+
182
+ - Free for internal business use
183
+ - Commercial redistribution requires a separate license
184
+ - Contact [spine-framework.com](https://spine-framework.com) for commercial licensing
185
+
186
+ ---
187
+
188
+ ## Support
189
+
190
+ - Documentation: [docs.spine-framework.com](https://docs.spine-framework.com)
191
+ - Issues: [GitHub Issues](https://github.com/spine-framework/spine-framework/issues)
192
+ - Commercial: [spine-framework.com](https://spine-framework.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.3.49",
3
+ "version": "0.3.51",
4
4
  "description": "Multi-tenant, modular application platform for modern SaaS systems",
5
5
  "type": "module",
6
6
  "bin": {