-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobjectstack.config.ts
More file actions
149 lines (136 loc) · 4.3 KB
/
objectstack.config.ts
File metadata and controls
149 lines (136 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/**
* ObjectStack Configuration
*
* Configuration file for @objectstack/cli serve command.
* This defines the kernel configuration, plugins, and metadata sources.
*/
import { defineStack } from '@objectstack/spec';
import { AppPlugin, DriverPlugin } from '@objectstack/runtime';
import { ObjectQLPlugin } from '@objectstack/objectql';
import { InMemoryDriver } from '@objectstack/driver-memory';
import { AuditLogPlugin } from '@objectos/audit';
import { AuthPlugin } from '@objectstack/plugin-auth';
import { AutomationPlugin } from '@objectos/automation';
import { CachePlugin } from '@objectos/cache';
import { I18nPlugin } from '@objectos/i18n';
import { JobsPlugin } from '@objectos/jobs';
import { MetricsPlugin } from '@objectos/metrics';
import { NotificationPlugin } from '@objectos/notification';
import { PermissionsPlugin } from '@objectos/permissions';
import { createRealtimePlugin } from '@objectos/realtime';
import { StoragePlugin } from '@objectos/storage';
import { TelemetryPlugin } from '@objectos/telemetry';
import { UIPlugin } from '@objectos/ui';
import { WorkflowPlugin } from '@objectos/workflow';
import { GraphQLPlugin } from '@objectos/graphql';
import { resolve } from 'path';
// ─── Example App Bundles ─────────────────────────────────────────
import CrmApp from './examples/crm/objectstack.config';
import TodoApp from './examples/todo/objectstack.config';
export default defineStack({
manifest: {
id: 'com.objectos.platform',
name: 'ObjectOS',
namespace: 'objectos',
version: '0.1.0',
type: 'app',
description: 'ObjectOS Business Operating System',
},
/**
* Metadata sources
* Define where to load object schemas, permissions, workflows, etc.
*/
metadata: {
baseDir: resolve(__dirname),
patterns: [
'packages/*/objects/*.object.yml',
'packages/*/workflows/*.workflow.yml',
'packages/*/permissions/*.permission.yml',
],
},
/**
* Plugins to check/load
* These are initialized in order during kernel bootstrap
*/
plugins: [
// ObjectQL Engine & Driver
new ObjectQLPlugin(),
new DriverPlugin(new InMemoryDriver()),
// Foundation
new MetricsPlugin(),
new CachePlugin(),
new StoragePlugin(),
new TelemetryPlugin({
serviceName: 'objectos',
serviceVersion: '0.1.0',
environment: process.env.NODE_ENV || 'development',
exporter: {
protocol: (process.env.OTEL_EXPORTER_PROTOCOL as any) || 'none',
endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
},
}),
// Core
new AuthPlugin({
secret:
process.env.AUTH_SECRET ||
(() => {
const defaultSecret = 'dev-secret-change-in-production-min-32-chars';
if (process.env.NODE_ENV === 'production') {
console.error(
'WARNING: Using default AUTH_SECRET in production! Set AUTH_SECRET environment variable.',
);
}
return defaultSecret;
})(),
baseUrl: process.env.BETTER_AUTH_URL || 'http://localhost:5320',
}),
new PermissionsPlugin({
tenantIsolation: true,
}),
new AuditLogPlugin(),
// Logic
new WorkflowPlugin(),
new AutomationPlugin(),
new JobsPlugin(),
// Services
new NotificationPlugin(),
new I18nPlugin(),
new UIPlugin(),
// createRealtimePlugin(),
// GraphQL Layer (Phase O.1)
new GraphQLPlugin(),
// Example Apps
new AppPlugin(CrmApp),
new AppPlugin(TodoApp),
],
/**
* Server configuration
*/
server: {
port: process.env.PORT || 5320,
/**
* Static mounts for production single-process deployment.
* - /console/* → apps/web/dist (Vite SPA)
* - /docs/* → apps/site/out (Next.js static export)
*/
staticMounts: [
{ root: './apps/web/dist', path: '/console', spa: true, rewrite: true },
{ root: './apps/site/out', path: '/docs', rewrite: true },
],
cors: {
origin: process.env.CORS_ORIGINS?.split(',') || [
'http://localhost:5321',
'http://localhost:5320',
],
credentials: true,
},
},
/**
* Kernel Configuration
*/
kernel: {
logger: {
level: process.env.LOG_LEVEL || 'info',
},
},
} as any);