@org.ai/examples 0.0.1

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.
Files changed (40) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/LICENSE +21 -0
  3. package/README.md +147 -0
  4. package/api-business/index.ts +1179 -0
  5. package/directory/index.ts +1118 -0
  6. package/dist/api-business/index.d.ts +221 -0
  7. package/dist/api-business/index.d.ts.map +1 -0
  8. package/dist/api-business/index.js +1132 -0
  9. package/dist/api-business/index.js.map +1 -0
  10. package/dist/directory/index.d.ts +202 -0
  11. package/dist/directory/index.d.ts.map +1 -0
  12. package/dist/directory/index.js +1073 -0
  13. package/dist/directory/index.js.map +1 -0
  14. package/dist/index.d.ts +75 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +127 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/marketplace/index.d.ts +242 -0
  19. package/dist/marketplace/index.d.ts.map +1 -0
  20. package/dist/marketplace/index.js +1249 -0
  21. package/dist/marketplace/index.js.map +1 -0
  22. package/dist/saas/index.d.ts +151 -0
  23. package/dist/saas/index.d.ts.map +1 -0
  24. package/dist/saas/index.js +1142 -0
  25. package/dist/saas/index.js.map +1 -0
  26. package/dist/startup-studio/index.d.ts +285 -0
  27. package/dist/startup-studio/index.d.ts.map +1 -0
  28. package/dist/startup-studio/index.js +1252 -0
  29. package/dist/startup-studio/index.js.map +1 -0
  30. package/dist/vc-firm/index.d.ts +248 -0
  31. package/dist/vc-firm/index.d.ts.map +1 -0
  32. package/dist/vc-firm/index.js +1335 -0
  33. package/dist/vc-firm/index.js.map +1 -0
  34. package/index.ts +151 -0
  35. package/marketplace/index.ts +1295 -0
  36. package/package.json +58 -0
  37. package/saas/index.ts +1188 -0
  38. package/startup-studio/index.ts +1324 -0
  39. package/tsconfig.json +12 -0
  40. package/vc-firm/index.ts +1430 -0
@@ -0,0 +1,1132 @@
1
+ /**
2
+ * API Business Example
3
+ *
4
+ * A complete example of a developer-focused API business modeled using primitives.org.ai
5
+ * Think: Stripe, Twilio, SendGrid, Algolia
6
+ *
7
+ * @example APIHub - A unified API gateway for third-party integrations
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * NOTE: These examples demonstrate the DESIRED API shape for business-as-code.
12
+ * Some types may not exist yet in the actual package. The examples serve as
13
+ * documentation and specification for the ideal primitives API.
14
+ */
15
+ // Use any for flexibility - these examples define the ideal API shape
16
+ const Business = (def) => def;
17
+ const Product = (def) => def;
18
+ const Service = (def) => def;
19
+ const Goals = (defs) => defs;
20
+ const Vision = (def) => def;
21
+ const kpis = (defs) => defs;
22
+ const okrs = (defs) => defs;
23
+ const financials = (def) => def;
24
+ const Process = (def) => def;
25
+ const Workflow = (def) => def;
26
+ const createBusinessRole = (def) => def;
27
+ // $ helper placeholder
28
+ const $ = {
29
+ format: (n) => `$${n.toLocaleString()}`,
30
+ growth: (current, previous) => ((current - previous) / previous * 100).toFixed(1),
31
+ margin: (revenue, cost) => ((revenue - cost) / revenue * 100).toFixed(1),
32
+ };
33
+ // =============================================================================
34
+ // 1. BUSINESS DEFINITION
35
+ // =============================================================================
36
+ /**
37
+ * APIHub - Unified API Gateway Platform
38
+ */
39
+ export const APIHubBusiness = Business({
40
+ name: 'APIHub Inc.',
41
+ mission: 'Make API integrations simple, reliable, and scalable for every developer',
42
+ values: ['Developer Experience', 'Reliability', 'Transparency', 'Security'],
43
+ industry: 'Developer Tools / API Infrastructure',
44
+ founded: new Date('2021-06-01'),
45
+ stage: 'growth',
46
+ structure: {
47
+ departments: [
48
+ {
49
+ name: 'Engineering',
50
+ headcount: 40,
51
+ budget: 6000000,
52
+ teams: [
53
+ { name: 'API Platform', headcount: 12, focus: 'Core API infrastructure' },
54
+ { name: 'Gateway', headcount: 8, focus: 'API gateway & routing' },
55
+ { name: 'Integrations', headcount: 10, focus: 'Third-party connectors' },
56
+ { name: 'Infrastructure', headcount: 6, focus: 'Cloud & reliability' },
57
+ { name: 'Security', headcount: 4, focus: 'API security & compliance' },
58
+ ],
59
+ },
60
+ {
61
+ name: 'Product',
62
+ headcount: 8,
63
+ budget: 1200000,
64
+ teams: [
65
+ { name: 'Product Management', headcount: 4 },
66
+ { name: 'Developer Experience', headcount: 2, focus: 'SDKs, docs, DX' },
67
+ { name: 'Design', headcount: 2 },
68
+ ],
69
+ },
70
+ {
71
+ name: 'Developer Relations',
72
+ headcount: 6,
73
+ budget: 800000,
74
+ teams: [
75
+ { name: 'DevRel', headcount: 4, focus: 'Community & advocacy' },
76
+ { name: 'Technical Writing', headcount: 2 },
77
+ ],
78
+ },
79
+ {
80
+ name: 'Sales',
81
+ headcount: 10,
82
+ budget: 1500000,
83
+ teams: [
84
+ { name: 'Enterprise Sales', headcount: 5 },
85
+ { name: 'Self-Serve Growth', headcount: 3 },
86
+ { name: 'Solutions Engineering', headcount: 2 },
87
+ ],
88
+ },
89
+ {
90
+ name: 'Support',
91
+ headcount: 8,
92
+ budget: 700000,
93
+ teams: [
94
+ { name: 'Technical Support', headcount: 5 },
95
+ { name: 'Success Engineering', headcount: 3 },
96
+ ],
97
+ },
98
+ ],
99
+ },
100
+ });
101
+ // =============================================================================
102
+ // 2. VISION & GOALS
103
+ // =============================================================================
104
+ export const APIHubVision = Vision({
105
+ statement: 'Power the connected economy by being the universal API layer for businesses',
106
+ timeHorizon: '2028',
107
+ pillars: [
108
+ 'Developer Experience Excellence',
109
+ 'Platform Reliability',
110
+ 'Integration Ecosystem',
111
+ 'Enterprise Security',
112
+ ],
113
+ successIndicators: [
114
+ { name: 'API Calls/Month', target: 100000000000, unit: 'calls' },
115
+ { name: 'Active Developers', target: 500000 },
116
+ { name: 'Enterprise Customers', target: 2000 },
117
+ { name: 'Platform Uptime', target: 99.99, unit: '%' },
118
+ ],
119
+ });
120
+ export const APIHubGoals = Goals([
121
+ {
122
+ name: 'Reach 10B Monthly API Calls',
123
+ category: 'product',
124
+ status: 'in-progress',
125
+ progress: 65,
126
+ dueDate: new Date('2024-12-31'),
127
+ owner: 'VP Engineering',
128
+ },
129
+ {
130
+ name: 'Launch 50 New Integrations',
131
+ category: 'product',
132
+ status: 'in-progress',
133
+ progress: 40,
134
+ dueDate: new Date('2024-06-30'),
135
+ owner: 'Integrations Lead',
136
+ },
137
+ {
138
+ name: 'Achieve SOC 2 Type II',
139
+ category: 'operational',
140
+ status: 'in-progress',
141
+ progress: 75,
142
+ dueDate: new Date('2024-03-31'),
143
+ owner: 'Security Lead',
144
+ },
145
+ {
146
+ name: 'Grow Developer Community to 100K',
147
+ category: 'growth',
148
+ status: 'in-progress',
149
+ progress: 55,
150
+ dueDate: new Date('2024-09-30'),
151
+ owner: 'DevRel Lead',
152
+ },
153
+ {
154
+ name: '$20M ARR',
155
+ category: 'financial',
156
+ status: 'in-progress',
157
+ progress: 70,
158
+ dueDate: new Date('2024-12-31'),
159
+ owner: 'CEO',
160
+ },
161
+ ]);
162
+ // =============================================================================
163
+ // 3. PRODUCTS & PRICING
164
+ // =============================================================================
165
+ /**
166
+ * Core API Products
167
+ */
168
+ export const APIGateway = Product({
169
+ name: 'APIHub Gateway',
170
+ description: 'Unified API gateway with routing, rate limiting, and analytics',
171
+ pricingModel: 'usage-based',
172
+ features: [
173
+ 'API routing & load balancing',
174
+ 'Rate limiting & throttling',
175
+ 'Request/response transformation',
176
+ 'Analytics & monitoring',
177
+ 'API versioning',
178
+ 'Caching',
179
+ 'Circuit breaker',
180
+ ],
181
+ roadmap: [
182
+ { name: 'GraphQL Support', status: 'in-progress', priority: 'high', targetDate: new Date('2024-Q1') },
183
+ { name: 'gRPC Gateway', status: 'planned', priority: 'medium', targetDate: new Date('2024-Q2') },
184
+ { name: 'AI-Powered Rate Limiting', status: 'planned', priority: 'medium', targetDate: new Date('2024-Q3') },
185
+ ],
186
+ });
187
+ export const IntegrationsHub = Product({
188
+ name: 'Integrations Hub',
189
+ description: 'Pre-built connectors to 200+ third-party APIs',
190
+ pricingModel: 'subscription',
191
+ features: [
192
+ '200+ pre-built integrations',
193
+ 'Unified data models',
194
+ 'Webhook management',
195
+ 'OAuth flow handling',
196
+ 'Data transformation',
197
+ 'Error handling & retries',
198
+ ],
199
+ });
200
+ export const APIAnalytics = Product({
201
+ name: 'API Analytics',
202
+ description: 'Real-time API monitoring, debugging, and insights',
203
+ pricingModel: 'usage-based',
204
+ features: [
205
+ 'Real-time dashboards',
206
+ 'Request tracing',
207
+ 'Error analysis',
208
+ 'Performance metrics',
209
+ 'Usage patterns',
210
+ 'Alerting',
211
+ ],
212
+ });
213
+ /**
214
+ * Usage-based Pricing
215
+ */
216
+ export const Pricing = {
217
+ free: {
218
+ name: 'Free',
219
+ monthlyApiCalls: 10000,
220
+ price: 0,
221
+ features: ['10K API calls/month', 'Community support', '5 integrations'],
222
+ },
223
+ developer: {
224
+ name: 'Developer',
225
+ monthlyApiCalls: 1000000,
226
+ price: 49, // base
227
+ overage: 0.0001, // per call over limit
228
+ features: ['1M API calls/month', 'Email support', '50 integrations', 'Analytics'],
229
+ },
230
+ team: {
231
+ name: 'Team',
232
+ monthlyApiCalls: 10000000,
233
+ price: 299, // base
234
+ overage: 0.00005, // per call over limit
235
+ features: ['10M API calls/month', 'Priority support', 'All integrations', 'Team management'],
236
+ },
237
+ enterprise: {
238
+ name: 'Enterprise',
239
+ monthlyApiCalls: 'unlimited',
240
+ price: 'custom',
241
+ features: ['Unlimited API calls', 'Dedicated support', 'SLA', 'SSO', 'Custom integrations', 'VPC deployment'],
242
+ },
243
+ };
244
+ /**
245
+ * Calculate monthly bill for usage
246
+ */
247
+ export function calculateMonthlyBill(plan, apiCalls) {
248
+ const pricing = Pricing[plan];
249
+ if (pricing.price === 'custom' || pricing.price === 0)
250
+ return pricing.price === 0 ? 0 : -1;
251
+ const base = pricing.price;
252
+ const limit = pricing.monthlyApiCalls;
253
+ const overage = 'overage' in pricing ? pricing.overage : 0;
254
+ if (apiCalls <= limit)
255
+ return base;
256
+ return base + (apiCalls - limit) * overage;
257
+ }
258
+ // =============================================================================
259
+ // 4. ORGANIZATION & ROLES
260
+ // =============================================================================
261
+ export const APIHubOrg = {
262
+ id: 'apihub',
263
+ name: 'APIHub Inc.',
264
+ settings: {
265
+ timezone: 'America/New_York',
266
+ currency: 'USD',
267
+ fiscalYearStart: 1,
268
+ },
269
+ departments: [
270
+ {
271
+ id: 'engineering',
272
+ name: 'Engineering',
273
+ permissions: {
274
+ code: ['read', 'write', 'deploy'],
275
+ infrastructure: ['read', 'write', 'manage'],
276
+ api: ['read', 'write', 'manage'],
277
+ },
278
+ teams: [
279
+ {
280
+ id: 'api-platform',
281
+ name: 'API Platform',
282
+ positions: [
283
+ { id: 'api-lead', title: 'API Platform Lead', roleId: 'staff-engineer', reportsTo: 'eng-vp' },
284
+ { id: 'api-eng-1', title: 'Senior API Engineer', roleId: 'senior-engineer', reportsTo: 'api-lead' },
285
+ { id: 'api-eng-2', title: 'API Engineer', roleId: 'engineer', reportsTo: 'api-lead' },
286
+ ],
287
+ },
288
+ {
289
+ id: 'integrations',
290
+ name: 'Integrations',
291
+ positions: [
292
+ { id: 'int-lead', title: 'Integrations Lead', roleId: 'senior-engineer', reportsTo: 'eng-vp' },
293
+ ],
294
+ },
295
+ {
296
+ id: 'sre',
297
+ name: 'Site Reliability',
298
+ positions: [
299
+ { id: 'sre-lead', title: 'SRE Lead', roleId: 'sre', reportsTo: 'eng-vp' },
300
+ ],
301
+ },
302
+ ],
303
+ },
304
+ {
305
+ id: 'devrel',
306
+ name: 'Developer Relations',
307
+ permissions: {
308
+ docs: ['read', 'write', 'publish'],
309
+ community: ['read', 'write', 'moderate'],
310
+ content: ['read', 'write', 'publish'],
311
+ },
312
+ },
313
+ ],
314
+ roles: [
315
+ createBusinessRole({
316
+ id: 'staff-engineer',
317
+ name: 'Staff Engineer',
318
+ type: 'engineer',
319
+ level: 7,
320
+ permissions: {
321
+ code: ['read', 'write', 'review', 'merge', 'deploy'],
322
+ architecture: ['read', 'write', 'approve'],
323
+ oncall: ['read', 'write', 'escalate'],
324
+ },
325
+ canHandle: ['architecture', 'incident-commander', 'code-review'],
326
+ canApprove: ['architecture-decision', 'major-release'],
327
+ }),
328
+ createBusinessRole({
329
+ id: 'senior-engineer',
330
+ name: 'Senior Engineer',
331
+ type: 'engineer',
332
+ level: 5,
333
+ permissions: {
334
+ code: ['read', 'write', 'review', 'merge'],
335
+ deployments: ['read', 'write'],
336
+ },
337
+ canHandle: ['coding', 'code-review', 'feature-design'],
338
+ canApprove: ['pull-request'],
339
+ }),
340
+ createBusinessRole({
341
+ id: 'engineer',
342
+ name: 'Engineer',
343
+ type: 'engineer',
344
+ level: 3,
345
+ permissions: {
346
+ code: ['read', 'write'],
347
+ deployments: ['read'],
348
+ },
349
+ canHandle: ['coding', 'bug-fix'],
350
+ }),
351
+ createBusinessRole({
352
+ id: 'sre',
353
+ name: 'Site Reliability Engineer',
354
+ type: 'engineer',
355
+ level: 5,
356
+ permissions: {
357
+ infrastructure: ['read', 'write', 'manage'],
358
+ deployments: ['read', 'write', 'rollback'],
359
+ oncall: ['read', 'write', 'escalate'],
360
+ },
361
+ canHandle: ['incident-response', 'capacity-planning', 'deployment'],
362
+ }),
363
+ createBusinessRole({
364
+ id: 'devrel',
365
+ name: 'Developer Advocate',
366
+ type: 'support',
367
+ level: 4,
368
+ permissions: {
369
+ docs: ['read', 'write', 'publish'],
370
+ community: ['read', 'write', 'moderate'],
371
+ samples: ['read', 'write', 'publish'],
372
+ },
373
+ canHandle: ['documentation', 'sample-code', 'community-support', 'conference-talk'],
374
+ }),
375
+ createBusinessRole({
376
+ id: 'solutions-engineer',
377
+ name: 'Solutions Engineer',
378
+ type: 'support',
379
+ level: 5,
380
+ permissions: {
381
+ customers: ['read', 'write'],
382
+ code: ['read'],
383
+ integrations: ['read', 'write'],
384
+ },
385
+ canHandle: ['technical-demo', 'poc', 'integration-support', 'architecture-review'],
386
+ }),
387
+ createBusinessRole({
388
+ id: 'support-bot',
389
+ name: 'Support Bot',
390
+ type: 'agent',
391
+ level: 1,
392
+ workerType: 'ai',
393
+ permissions: {
394
+ docs: ['read'],
395
+ customers: ['read'],
396
+ support: ['read', 'write'],
397
+ },
398
+ canHandle: ['documentation-query', 'status-check', 'basic-troubleshooting'],
399
+ }),
400
+ ],
401
+ approvalChains: [
402
+ {
403
+ id: 'api-change',
404
+ name: 'API Change Approval',
405
+ requestType: 'api-change',
406
+ levels: [
407
+ { threshold: 1, approvers: [{ type: 'role', roleId: 'senior-engineer' }] }, // Minor
408
+ { threshold: 2, approvers: [{ type: 'role', roleId: 'staff-engineer' }] }, // Major
409
+ { threshold: 3, approvers: [{ type: 'department-head' }] }, // Breaking
410
+ ],
411
+ },
412
+ {
413
+ id: 'integration-publish',
414
+ name: 'Integration Publish',
415
+ requestType: 'integration-publish',
416
+ levels: [
417
+ { threshold: Infinity, approvers: [{ type: 'role', roleId: 'senior-engineer' }, { type: 'role', roleId: 'devrel' }] },
418
+ ],
419
+ },
420
+ ],
421
+ routingRules: [
422
+ {
423
+ id: 'basic-support',
424
+ taskType: 'documentation-query',
425
+ priority: 1,
426
+ assignTo: { roleId: 'support-bot' },
427
+ },
428
+ {
429
+ id: 'technical-support',
430
+ taskType: 'integration-issue',
431
+ priority: 2,
432
+ assignTo: { roleId: 'solutions-engineer' },
433
+ },
434
+ {
435
+ id: 'incident',
436
+ taskType: 'incident',
437
+ priority: 1,
438
+ assignTo: { roleId: 'sre' },
439
+ },
440
+ ],
441
+ };
442
+ // =============================================================================
443
+ // 5. KPIs & METRICS
444
+ // =============================================================================
445
+ export const APIHubKPIs = kpis([
446
+ // Platform Metrics
447
+ {
448
+ name: 'Monthly API Calls',
449
+ category: 'operational',
450
+ target: 10000000000,
451
+ current: 6500000000,
452
+ frequency: 'monthly',
453
+ owner: 'VP Engineering',
454
+ },
455
+ {
456
+ name: 'API Uptime',
457
+ category: 'operational',
458
+ target: 99.99,
459
+ current: 99.97,
460
+ unit: '%',
461
+ frequency: 'monthly',
462
+ owner: 'SRE Lead',
463
+ },
464
+ {
465
+ name: 'P99 Latency',
466
+ category: 'operational',
467
+ target: 50,
468
+ current: 45,
469
+ unit: 'ms',
470
+ frequency: 'daily',
471
+ owner: 'API Platform Lead',
472
+ },
473
+ {
474
+ name: 'Error Rate',
475
+ category: 'operational',
476
+ target: 0.1,
477
+ current: 0.08,
478
+ unit: '%',
479
+ frequency: 'daily',
480
+ owner: 'API Platform Lead',
481
+ },
482
+ // Developer Metrics
483
+ {
484
+ name: 'Active Developers',
485
+ category: 'customer',
486
+ target: 100000,
487
+ current: 65000,
488
+ frequency: 'monthly',
489
+ owner: 'DevRel Lead',
490
+ },
491
+ {
492
+ name: 'Developer NPS',
493
+ category: 'customer',
494
+ target: 70,
495
+ current: 65,
496
+ frequency: 'quarterly',
497
+ owner: 'VP Product',
498
+ },
499
+ {
500
+ name: 'Time to First API Call',
501
+ category: 'customer',
502
+ target: 5,
503
+ current: 7,
504
+ unit: 'minutes',
505
+ frequency: 'weekly',
506
+ owner: 'DX Lead',
507
+ },
508
+ {
509
+ name: 'Documentation Coverage',
510
+ category: 'operational',
511
+ target: 100,
512
+ current: 92,
513
+ unit: '%',
514
+ frequency: 'monthly',
515
+ owner: 'Tech Writing Lead',
516
+ },
517
+ // Revenue Metrics
518
+ {
519
+ name: 'MRR',
520
+ category: 'financial',
521
+ target: 1500000,
522
+ current: 1170000,
523
+ unit: 'USD',
524
+ frequency: 'monthly',
525
+ owner: 'CEO',
526
+ },
527
+ {
528
+ name: 'Net Revenue Retention',
529
+ category: 'financial',
530
+ target: 130,
531
+ current: 125,
532
+ unit: '%',
533
+ frequency: 'monthly',
534
+ owner: 'VP Sales',
535
+ },
536
+ {
537
+ name: 'Free to Paid Conversion',
538
+ category: 'sales',
539
+ target: 5,
540
+ current: 3.8,
541
+ unit: '%',
542
+ frequency: 'monthly',
543
+ owner: 'Growth Lead',
544
+ },
545
+ ]);
546
+ // =============================================================================
547
+ // 6. OKRs
548
+ // =============================================================================
549
+ export const APIHubOKRs = okrs([
550
+ {
551
+ objective: 'Build the Best Developer Experience in API Tools',
552
+ owner: 'VP Product',
553
+ period: 'Q1 2024',
554
+ keyResults: [
555
+ {
556
+ description: 'Achieve Time to First API Call under 5 minutes',
557
+ metric: 'TTFAC',
558
+ targetValue: 5,
559
+ currentValue: 7,
560
+ unit: 'minutes',
561
+ },
562
+ {
563
+ description: 'Launch SDK for 5 new languages',
564
+ metric: 'SDKs Launched',
565
+ targetValue: 5,
566
+ currentValue: 2,
567
+ },
568
+ {
569
+ description: 'Reach Developer NPS of 70',
570
+ metric: 'Developer NPS',
571
+ targetValue: 70,
572
+ currentValue: 65,
573
+ },
574
+ ],
575
+ },
576
+ {
577
+ objective: 'Achieve Platform Reliability Excellence',
578
+ owner: 'VP Engineering',
579
+ period: 'Q1 2024',
580
+ keyResults: [
581
+ {
582
+ description: 'Maintain 99.99% uptime',
583
+ metric: 'Uptime',
584
+ targetValue: 99.99,
585
+ currentValue: 99.97,
586
+ unit: '%',
587
+ },
588
+ {
589
+ description: 'Reduce P99 latency to 30ms',
590
+ metric: 'P99 Latency',
591
+ targetValue: 30,
592
+ currentValue: 45,
593
+ unit: 'ms',
594
+ },
595
+ {
596
+ description: 'Implement multi-region failover',
597
+ metric: 'Regions with Failover',
598
+ targetValue: 3,
599
+ currentValue: 1,
600
+ },
601
+ ],
602
+ },
603
+ {
604
+ objective: 'Expand Integration Ecosystem',
605
+ owner: 'Integrations Lead',
606
+ period: 'Q1 2024',
607
+ keyResults: [
608
+ {
609
+ description: 'Launch 25 new integrations',
610
+ metric: 'Integrations Launched',
611
+ targetValue: 25,
612
+ currentValue: 12,
613
+ },
614
+ {
615
+ description: 'Achieve 95% integration test coverage',
616
+ metric: 'Test Coverage',
617
+ targetValue: 95,
618
+ currentValue: 82,
619
+ unit: '%',
620
+ },
621
+ {
622
+ description: 'Partner with 5 major API providers',
623
+ metric: 'Partnerships Signed',
624
+ targetValue: 5,
625
+ currentValue: 2,
626
+ },
627
+ ],
628
+ },
629
+ {
630
+ objective: 'Scale Developer Community',
631
+ owner: 'DevRel Lead',
632
+ period: 'Q1 2024',
633
+ keyResults: [
634
+ {
635
+ description: 'Grow to 100K active developers',
636
+ metric: 'Active Developers',
637
+ targetValue: 100000,
638
+ currentValue: 65000,
639
+ },
640
+ {
641
+ description: 'Publish 50 technical tutorials',
642
+ metric: 'Tutorials Published',
643
+ targetValue: 50,
644
+ currentValue: 28,
645
+ },
646
+ {
647
+ description: 'Speak at 10 developer conferences',
648
+ metric: 'Conference Talks',
649
+ targetValue: 10,
650
+ currentValue: 4,
651
+ },
652
+ ],
653
+ },
654
+ ]);
655
+ // =============================================================================
656
+ // 7. PROCESSES
657
+ // =============================================================================
658
+ export const IntegrationDevelopmentProcess = Process({
659
+ name: 'Integration Development',
660
+ description: 'Process for building and launching new API integrations',
661
+ owner: 'Integrations Lead',
662
+ steps: [
663
+ {
664
+ order: 1,
665
+ name: 'API Research',
666
+ description: 'Research target API documentation and capabilities',
667
+ automationLevel: 'manual',
668
+ duration: '2 days',
669
+ owner: 'Integration Engineer',
670
+ },
671
+ {
672
+ order: 2,
673
+ name: 'Schema Design',
674
+ description: 'Design unified schema and data model',
675
+ automationLevel: 'manual',
676
+ duration: '1 day',
677
+ owner: 'Integration Engineer',
678
+ },
679
+ {
680
+ order: 3,
681
+ name: 'Implementation',
682
+ description: 'Build the integration connector',
683
+ automationLevel: 'manual',
684
+ duration: '1 week',
685
+ owner: 'Integration Engineer',
686
+ },
687
+ {
688
+ order: 4,
689
+ name: 'Testing',
690
+ description: 'Write and run integration tests',
691
+ automationLevel: 'semi-automated',
692
+ duration: '2 days',
693
+ owner: 'Integration Engineer',
694
+ },
695
+ {
696
+ order: 5,
697
+ name: 'Documentation',
698
+ description: 'Write API documentation and guides',
699
+ automationLevel: 'manual',
700
+ duration: '1 day',
701
+ owner: 'Technical Writer',
702
+ },
703
+ {
704
+ order: 6,
705
+ name: 'Security Review',
706
+ description: 'Security and compliance review',
707
+ automationLevel: 'manual',
708
+ duration: '2 days',
709
+ owner: 'Security Engineer',
710
+ },
711
+ {
712
+ order: 7,
713
+ name: 'Beta Release',
714
+ description: 'Release to beta customers',
715
+ automationLevel: 'automated',
716
+ duration: '1 week',
717
+ },
718
+ {
719
+ order: 8,
720
+ name: 'GA Release',
721
+ description: 'General availability release',
722
+ automationLevel: 'semi-automated',
723
+ duration: '1 day',
724
+ },
725
+ ],
726
+ metrics: [
727
+ { name: 'Time to Ship', target: 3, unit: 'weeks' },
728
+ { name: 'Test Coverage', target: 95, unit: '%' },
729
+ { name: 'Documentation Completeness', target: 100, unit: '%' },
730
+ ],
731
+ });
732
+ export const IncidentResponseProcess = Process({
733
+ name: 'Incident Response',
734
+ description: 'Handle production incidents efficiently',
735
+ owner: 'SRE Lead',
736
+ steps: [
737
+ {
738
+ order: 1,
739
+ name: 'Detection',
740
+ description: 'Automated alerting detects incident',
741
+ automationLevel: 'automated',
742
+ duration: '1 minute',
743
+ },
744
+ {
745
+ order: 2,
746
+ name: 'Triage',
747
+ description: 'On-call determines severity',
748
+ automationLevel: 'manual',
749
+ duration: '5 minutes',
750
+ owner: 'SRE On-Call',
751
+ },
752
+ {
753
+ order: 3,
754
+ name: 'Notification',
755
+ description: 'Notify stakeholders based on severity',
756
+ automationLevel: 'automated',
757
+ duration: 'instant',
758
+ },
759
+ {
760
+ order: 4,
761
+ name: 'Investigation',
762
+ description: 'Root cause analysis',
763
+ automationLevel: 'manual',
764
+ duration: '15 minutes',
765
+ owner: 'SRE On-Call',
766
+ },
767
+ {
768
+ order: 5,
769
+ name: 'Mitigation',
770
+ description: 'Apply fix or workaround',
771
+ automationLevel: 'manual',
772
+ duration: '30 minutes',
773
+ owner: 'SRE On-Call',
774
+ },
775
+ {
776
+ order: 6,
777
+ name: 'Resolution',
778
+ description: 'Confirm service restored',
779
+ automationLevel: 'semi-automated',
780
+ duration: '10 minutes',
781
+ },
782
+ {
783
+ order: 7,
784
+ name: 'Communication',
785
+ description: 'Update status page and notify customers',
786
+ automationLevel: 'semi-automated',
787
+ duration: '5 minutes',
788
+ },
789
+ {
790
+ order: 8,
791
+ name: 'Postmortem',
792
+ description: 'Blameless postmortem within 48 hours',
793
+ automationLevel: 'manual',
794
+ duration: '2 hours',
795
+ owner: 'Incident Commander',
796
+ },
797
+ ],
798
+ metrics: [
799
+ { name: 'MTTD (Mean Time to Detect)', target: 1, unit: 'minutes' },
800
+ { name: 'MTTR (Mean Time to Resolve)', target: 30, unit: 'minutes' },
801
+ { name: 'Postmortem Completion Rate', target: 100, unit: '%' },
802
+ ],
803
+ });
804
+ export const DeveloperOnboardingProcess = Process({
805
+ name: 'Developer Onboarding',
806
+ description: 'Get developers to first successful API call',
807
+ owner: 'DX Lead',
808
+ steps: [
809
+ {
810
+ order: 1,
811
+ name: 'Signup',
812
+ description: 'Developer creates account',
813
+ automationLevel: 'automated',
814
+ duration: '30 seconds',
815
+ },
816
+ {
817
+ order: 2,
818
+ name: 'API Key Generation',
819
+ description: 'Generate API credentials',
820
+ automationLevel: 'automated',
821
+ duration: 'instant',
822
+ },
823
+ {
824
+ order: 3,
825
+ name: 'SDK Selection',
826
+ description: 'Choose language SDK',
827
+ automationLevel: 'semi-automated',
828
+ duration: '1 minute',
829
+ },
830
+ {
831
+ order: 4,
832
+ name: 'Quick Start',
833
+ description: 'Interactive quick start guide',
834
+ automationLevel: 'semi-automated',
835
+ duration: '3 minutes',
836
+ },
837
+ {
838
+ order: 5,
839
+ name: 'First API Call',
840
+ description: 'Make first successful API call',
841
+ automationLevel: 'semi-automated',
842
+ duration: '2 minutes',
843
+ },
844
+ {
845
+ order: 6,
846
+ name: 'Explore',
847
+ description: 'Explore additional features',
848
+ automationLevel: 'semi-automated',
849
+ duration: '10 minutes',
850
+ },
851
+ ],
852
+ metrics: [
853
+ { name: 'Time to First API Call', target: 5, unit: 'minutes' },
854
+ { name: 'Signup to First Call Conversion', target: 80, unit: '%' },
855
+ { name: 'Week 1 Retention', target: 50, unit: '%' },
856
+ ],
857
+ });
858
+ // =============================================================================
859
+ // 8. WORKFLOWS
860
+ // =============================================================================
861
+ export const UsageAlertWorkflow = Workflow({
862
+ name: 'Usage Alert',
863
+ description: 'Alert customers approaching rate limits',
864
+ trigger: { type: 'event', event: 'usage.threshold_reached' },
865
+ actions: [
866
+ {
867
+ order: 1,
868
+ type: 'condition',
869
+ name: 'Check Usage Level',
870
+ condition: 'usage.percent >= 80',
871
+ },
872
+ {
873
+ order: 2,
874
+ type: 'notification',
875
+ name: 'Email Developer',
876
+ config: {
877
+ template: 'usage_warning',
878
+ channel: 'email',
879
+ data: ['usage.current', 'usage.limit', 'usage.percent'],
880
+ },
881
+ },
882
+ {
883
+ order: 3,
884
+ type: 'condition',
885
+ name: 'Check Critical Level',
886
+ condition: 'usage.percent >= 95',
887
+ },
888
+ {
889
+ order: 4,
890
+ type: 'notification',
891
+ name: 'Slack Alert',
892
+ config: {
893
+ template: 'usage_critical',
894
+ channel: 'slack',
895
+ priority: 'high',
896
+ },
897
+ },
898
+ {
899
+ order: 5,
900
+ type: 'task',
901
+ name: 'Create Upsell Opportunity',
902
+ config: {
903
+ type: 'upsell-opportunity',
904
+ assignTo: 'account-manager',
905
+ data: ['customer.id', 'usage.current', 'recommended_plan'],
906
+ },
907
+ },
908
+ ],
909
+ });
910
+ export const IncidentAlertWorkflow = Workflow({
911
+ name: 'Incident Alert',
912
+ description: 'Automated incident detection and response',
913
+ trigger: { type: 'event', event: 'monitor.alert_triggered' },
914
+ actions: [
915
+ {
916
+ order: 1,
917
+ type: 'compute',
918
+ name: 'Determine Severity',
919
+ config: {
920
+ rules: [
921
+ { condition: 'errorRate > 10', severity: 'critical' },
922
+ { condition: 'errorRate > 5', severity: 'high' },
923
+ { condition: 'errorRate > 1', severity: 'medium' },
924
+ { condition: 'true', severity: 'low' },
925
+ ],
926
+ },
927
+ },
928
+ {
929
+ order: 2,
930
+ type: 'notification',
931
+ name: 'Page On-Call',
932
+ config: {
933
+ channel: 'pagerduty',
934
+ severity: '${severity}',
935
+ },
936
+ },
937
+ {
938
+ order: 3,
939
+ type: 'task',
940
+ name: 'Create Incident',
941
+ config: {
942
+ type: 'incident',
943
+ severity: '${severity}',
944
+ assignTo: 'sre-oncall',
945
+ },
946
+ },
947
+ {
948
+ order: 4,
949
+ type: 'condition',
950
+ name: 'Check Severity Critical',
951
+ condition: 'severity == "critical"',
952
+ },
953
+ {
954
+ order: 5,
955
+ type: 'notification',
956
+ name: 'Update Status Page',
957
+ config: {
958
+ channel: 'statuspage',
959
+ status: 'investigating',
960
+ component: '${affected_component}',
961
+ },
962
+ },
963
+ {
964
+ order: 6,
965
+ type: 'notification',
966
+ name: 'Notify Leadership',
967
+ config: {
968
+ channel: 'slack',
969
+ to: '#engineering-leadership',
970
+ template: 'critical_incident',
971
+ },
972
+ },
973
+ ],
974
+ });
975
+ export const NewDeveloperWorkflow = Workflow({
976
+ name: 'New Developer Engagement',
977
+ description: 'Onboard and engage new developers',
978
+ trigger: { type: 'event', event: 'developer.signup' },
979
+ actions: [
980
+ {
981
+ order: 1,
982
+ type: 'notification',
983
+ name: 'Welcome Email',
984
+ config: { template: 'developer_welcome', channel: 'email' },
985
+ },
986
+ {
987
+ order: 2,
988
+ type: 'wait',
989
+ name: 'Wait 1 Day',
990
+ duration: '1 day',
991
+ },
992
+ {
993
+ order: 3,
994
+ type: 'condition',
995
+ name: 'Check First API Call',
996
+ condition: 'developer.apiCallCount == 0',
997
+ },
998
+ {
999
+ order: 4,
1000
+ type: 'notification',
1001
+ name: 'Getting Started Nudge',
1002
+ config: { template: 'getting_started', channel: 'email' },
1003
+ },
1004
+ {
1005
+ order: 5,
1006
+ type: 'wait',
1007
+ name: 'Wait 3 Days',
1008
+ duration: '3 days',
1009
+ },
1010
+ {
1011
+ order: 6,
1012
+ type: 'condition',
1013
+ name: 'Check Still Inactive',
1014
+ condition: 'developer.apiCallCount < 10',
1015
+ },
1016
+ {
1017
+ order: 7,
1018
+ type: 'task',
1019
+ name: 'Assign DevRel Outreach',
1020
+ config: {
1021
+ type: 'developer-outreach',
1022
+ assignTo: 'devrel',
1023
+ },
1024
+ },
1025
+ {
1026
+ order: 8,
1027
+ type: 'wait',
1028
+ name: 'Wait 7 Days',
1029
+ duration: '7 days',
1030
+ },
1031
+ {
1032
+ order: 9,
1033
+ type: 'condition',
1034
+ name: 'Check Active Developer',
1035
+ condition: 'developer.apiCallCount >= 100',
1036
+ },
1037
+ {
1038
+ order: 10,
1039
+ type: 'notification',
1040
+ name: 'Power User Resources',
1041
+ config: { template: 'power_user_resources', channel: 'email' },
1042
+ },
1043
+ ],
1044
+ });
1045
+ // =============================================================================
1046
+ // 9. FINANCIALS
1047
+ // =============================================================================
1048
+ export const APIHubFinancials = financials({
1049
+ revenue: 14040000, // ARR
1050
+ cogs: 3510000, // 25% (infrastructure heavy)
1051
+ operatingExpenses: 9000000,
1052
+ depreciation: 300000,
1053
+ interestExpense: 0,
1054
+ otherIncome: 50000,
1055
+ taxes: 200000,
1056
+ });
1057
+ export const APIMetrics = {
1058
+ mrr: 1170000,
1059
+ arr: 14040000,
1060
+ developers: {
1061
+ total: 65000,
1062
+ active: 45000,
1063
+ paying: 3200,
1064
+ },
1065
+ apiCalls: {
1066
+ monthly: 6500000000,
1067
+ daily: 216666667,
1068
+ peakRps: 50000,
1069
+ },
1070
+ arpu: 365, // MRR / paying developers
1071
+ cac: 250,
1072
+ ltv: 4380, // 12 months avg * ARPU
1073
+ ltvToCac: 17.5,
1074
+ nrr: 125,
1075
+ freeToConversion: 3.8, // %
1076
+ infrastructureCostPerCall: 0.00004, // $
1077
+ grossMargin: 75, // %
1078
+ };
1079
+ // =============================================================================
1080
+ // 10. UTILITY FUNCTIONS
1081
+ // =============================================================================
1082
+ export function getBusinessSummary() {
1083
+ return {
1084
+ company: APIHubBusiness,
1085
+ vision: APIHubVision,
1086
+ goals: APIHubGoals,
1087
+ products: { gateway: APIGateway, integrations: IntegrationsHub, analytics: APIAnalytics },
1088
+ kpis: APIHubKPIs,
1089
+ okrs: APIHubOKRs,
1090
+ financials: APIHubFinancials,
1091
+ metrics: APIMetrics,
1092
+ };
1093
+ }
1094
+ export function getPlatformHealth() {
1095
+ return {
1096
+ uptime: `${APIMetrics.apiCalls.monthly > 0 ? 99.97 : 0}%`,
1097
+ latency: '45ms P99',
1098
+ errorRate: '0.08%',
1099
+ throughput: `${(APIMetrics.apiCalls.daily / 1000000).toFixed(0)}M calls/day`,
1100
+ };
1101
+ }
1102
+ export function getDeveloperMetrics() {
1103
+ return {
1104
+ total: APIMetrics.developers.total.toLocaleString(),
1105
+ active: APIMetrics.developers.active.toLocaleString(),
1106
+ paying: APIMetrics.developers.paying.toLocaleString(),
1107
+ conversionRate: `${((APIMetrics.developers.paying / APIMetrics.developers.total) * 100).toFixed(2)}%`,
1108
+ };
1109
+ }
1110
+ export default {
1111
+ business: APIHubBusiness,
1112
+ vision: APIHubVision,
1113
+ goals: APIHubGoals,
1114
+ products: { gateway: APIGateway, integrations: IntegrationsHub, analytics: APIAnalytics },
1115
+ pricing: Pricing,
1116
+ organization: APIHubOrg,
1117
+ kpis: APIHubKPIs,
1118
+ okrs: APIHubOKRs,
1119
+ processes: {
1120
+ integrationDevelopment: IntegrationDevelopmentProcess,
1121
+ incidentResponse: IncidentResponseProcess,
1122
+ developerOnboarding: DeveloperOnboardingProcess,
1123
+ },
1124
+ workflows: {
1125
+ usageAlert: UsageAlertWorkflow,
1126
+ incidentAlert: IncidentAlertWorkflow,
1127
+ newDeveloper: NewDeveloperWorkflow,
1128
+ },
1129
+ financials: APIHubFinancials,
1130
+ metrics: APIMetrics,
1131
+ };
1132
+ //# sourceMappingURL=index.js.map