@venturekit/core 0.0.0-dev.20260308002709 → 0.0.0-dev.20260310105525
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.
- package/README.md +134 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# @venturekit/core
|
|
2
|
+
|
|
3
|
+
> **Warning:** This package is in active development and not production-ready. APIs may change without notice.
|
|
4
|
+
|
|
5
|
+
Core types, presets, and configuration resolution for [VentureKit](https://venturekit.dev).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @venturekit/core@dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`@venturekit/core` is the foundation of the VentureKit framework. It provides:
|
|
16
|
+
|
|
17
|
+
- **Type definitions** for all configuration layers (base, security, environment)
|
|
18
|
+
- **Presets** for quick environment sizing (`nano`, `micro`, `medium`, `large`)
|
|
19
|
+
- **Configuration resolution** that merges base + security + environment into a single resolved config
|
|
20
|
+
- **Validation** utilities for all configuration types
|
|
21
|
+
- **Infrastructure intent types** for declarative resource provisioning
|
|
22
|
+
|
|
23
|
+
Every other VentureKit package depends on `@venturekit/core`.
|
|
24
|
+
|
|
25
|
+
## Configuration Layers
|
|
26
|
+
|
|
27
|
+
VentureKit uses a layered configuration system:
|
|
28
|
+
|
|
29
|
+
| Layer | Purpose | Changes per environment? |
|
|
30
|
+
|-------|---------|--------------------------|
|
|
31
|
+
| `BaseConfig` | Project identity (name, region) | No |
|
|
32
|
+
| `SecurityConfig` | OAuth scopes, app clients | No |
|
|
33
|
+
| `EnvConfigInput` | Resource sizing, scaling | Yes |
|
|
34
|
+
|
|
35
|
+
### Base Config
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import type { BaseConfig } from '@venturekit/core';
|
|
39
|
+
|
|
40
|
+
const base: BaseConfig = {
|
|
41
|
+
name: 'my-api',
|
|
42
|
+
displayName: 'My API',
|
|
43
|
+
region: 'eu-west-1',
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Security Config
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import type { SecurityConfig } from '@venturekit/core';
|
|
51
|
+
|
|
52
|
+
const security: SecurityConfig = {
|
|
53
|
+
scopes: [
|
|
54
|
+
{ name: 'api.read', description: 'Read API data' },
|
|
55
|
+
{ name: 'api.write', description: 'Write API data' },
|
|
56
|
+
],
|
|
57
|
+
appClients: [
|
|
58
|
+
{
|
|
59
|
+
name: 'web-app',
|
|
60
|
+
allowedScopes: ['api.read', 'api.write'],
|
|
61
|
+
supportsRefreshTokens: true,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Environment Config
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import type { EnvConfigInput } from '@venturekit/core';
|
|
71
|
+
|
|
72
|
+
const dev: EnvConfigInput = {
|
|
73
|
+
preset: 'nano',
|
|
74
|
+
dataSafety: 'relaxed',
|
|
75
|
+
api: { cors: { allowOrigins: ['http://localhost:3000'] } },
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Presets
|
|
80
|
+
|
|
81
|
+
| Preset | Lambda | Timeout | API Rate | VPC | Est. Cost |
|
|
82
|
+
|--------|--------|---------|----------|-----|-----------|
|
|
83
|
+
| `nano` | 128 MB | 10s | 10/s | No | ~$5–15/mo |
|
|
84
|
+
| `micro` | 256 MB | 10s | 50/s | Yes | ~$30–80/mo |
|
|
85
|
+
| `medium` | 512 MB | 15s | 100/s | Yes | ~$100–300/mo |
|
|
86
|
+
| `large` | 1024 MB | 30s | 500/s | Yes | ~$500+/mo |
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { getPreset, PRESET_NANO } from '@venturekit/core';
|
|
90
|
+
|
|
91
|
+
const preset = getPreset('nano'); // Returns full PresetConfig
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Config Resolution
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { resolveConfig } from '@venturekit/core';
|
|
98
|
+
|
|
99
|
+
const resolved = resolveConfig(base, security, 'dev', devEnvInput);
|
|
100
|
+
// Returns a fully resolved ResolvedConfig with no undefined values
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Validation
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { validateBaseConfig, validateSecurityConfig, assertValid } from '@venturekit/core';
|
|
107
|
+
|
|
108
|
+
const result = validateBaseConfig(base);
|
|
109
|
+
assertValid(result); // Throws if invalid
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Infrastructure Intents
|
|
113
|
+
|
|
114
|
+
Declare what infrastructure you need without provider-specific details:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import type { VentureIntent } from '@venturekit/core';
|
|
118
|
+
|
|
119
|
+
const infrastructure: VentureIntent = {
|
|
120
|
+
databases: [{ id: 'main', type: 'postgres', size: 'small', name: 'mydb' }],
|
|
121
|
+
storage: [{ id: 'uploads', purpose: 'uploads', cdn: true }],
|
|
122
|
+
queues: [{ id: 'jobs', type: 'standard', deadLetterQueue: true }],
|
|
123
|
+
caches: [{ id: 'sessions', type: 'redis', size: 'small' }],
|
|
124
|
+
schedules: [{ id: 'cleanup', handler: 'src/jobs/cleanup.handler', schedule: { rate: '1 day' } }],
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## API Reference
|
|
129
|
+
|
|
130
|
+
See the [API reference](https://venturekit.dev/api-reference/core) for full type documentation.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
Apache-2.0 — see [LICENSE](../../LICENSE) for details.
|
package/package.json
CHANGED