@venturekit/infra 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 +109 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# @venturekit/infra
|
|
2
|
+
|
|
3
|
+
> **Warning:** This package is in active development and not production-ready. APIs may change without notice.
|
|
4
|
+
|
|
5
|
+
Infrastructure package for [VentureKit](https://venturekit.dev) — SST constructs for AWS.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @venturekit/infra@dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`@venturekit/infra` provides the `defineVenture()` function, which is the main entry point for all VentureKit applications. It:
|
|
16
|
+
|
|
17
|
+
- Validates your configuration
|
|
18
|
+
- Discovers file-based routes
|
|
19
|
+
- Translates infrastructure intents into AWS resources via SST
|
|
20
|
+
- Creates Lambda functions, API Gateway, VPC, WebSocket API, and more
|
|
21
|
+
- Hides all SST/CDK complexity behind a clean, declarative API
|
|
22
|
+
|
|
23
|
+
Consumers never interact with SST directly — `@venturekit/infra` is the abstraction layer.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Create a `venturekit.config.ts` at your project root:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { defineVenture } from '@venturekit/infra';
|
|
31
|
+
import { base } from './config/base';
|
|
32
|
+
import { security } from './config/security';
|
|
33
|
+
import { dev } from './config/dev';
|
|
34
|
+
import { prod } from './config/prod';
|
|
35
|
+
|
|
36
|
+
export default defineVenture({
|
|
37
|
+
base,
|
|
38
|
+
security,
|
|
39
|
+
envs: { dev, prod },
|
|
40
|
+
routesDir: 'src/routes',
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### With Infrastructure Intents
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
export default defineVenture({
|
|
48
|
+
base,
|
|
49
|
+
security,
|
|
50
|
+
envs: { dev, prod },
|
|
51
|
+
routesDir: 'src/routes',
|
|
52
|
+
infrastructure: {
|
|
53
|
+
databases: [
|
|
54
|
+
{ id: 'main', type: 'postgres', size: 'small', name: 'mydb' },
|
|
55
|
+
],
|
|
56
|
+
storage: [
|
|
57
|
+
{ id: 'uploads', purpose: 'uploads', cdn: true },
|
|
58
|
+
],
|
|
59
|
+
auth: [
|
|
60
|
+
{ id: 'users', signInWith: ['email'], allowSignUp: true },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## File-Based Routing
|
|
67
|
+
|
|
68
|
+
Routes are auto-discovered from `routesDir`:
|
|
69
|
+
|
|
70
|
+
| File | Route |
|
|
71
|
+
|------|-------|
|
|
72
|
+
| `src/routes/health/get.ts` | `GET /health` |
|
|
73
|
+
| `src/routes/projects/post.ts` | `POST /projects` |
|
|
74
|
+
| `src/routes/projects/[id]/get.ts` | `GET /projects/{id}` |
|
|
75
|
+
| `src/routes/projects/[id]/delete.ts` | `DELETE /projects/{id}` |
|
|
76
|
+
|
|
77
|
+
## Environment Selection
|
|
78
|
+
|
|
79
|
+
The current environment is determined by the `VENTURE_STAGE` environment variable:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
VENTURE_STAGE=prod vk deploy # Uses prod config
|
|
83
|
+
VENTURE_STAGE=stage vk deploy # Uses stage config
|
|
84
|
+
vk dev # Defaults to dev
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## API
|
|
88
|
+
|
|
89
|
+
### `defineVenture(definition)`
|
|
90
|
+
|
|
91
|
+
Creates a VentureKit application from a `VentureDefinition`:
|
|
92
|
+
|
|
93
|
+
- `base` — `BaseConfig` (project identity)
|
|
94
|
+
- `security` — `SecurityConfig` (scopes, clients)
|
|
95
|
+
- `envs` — `{ dev?, stage?, prod? }` environment configurations
|
|
96
|
+
- `routesDir` — path to file-based routes directory
|
|
97
|
+
- `infrastructure?` — `VentureIntent` for declarative infrastructure
|
|
98
|
+
|
|
99
|
+
### `getResolvedConfig(base, security, envInput)`
|
|
100
|
+
|
|
101
|
+
Returns the fully resolved `ResolvedConfig` for the current environment. Useful for accessing config values in handler code.
|
|
102
|
+
|
|
103
|
+
## API Reference
|
|
104
|
+
|
|
105
|
+
See the [API reference](https://venturekit.dev/api-reference/infra) for full documentation.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Apache-2.0 — see [LICENSE](../../LICENSE) for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venturekit/infra",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.20260310105525",
|
|
4
4
|
"description": "VentureKit infrastructure - SST constructs for AWS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@venturekit/core": "0.0.0-dev.
|
|
28
|
+
"@venturekit/core": "0.0.0-dev.20260310105525",
|
|
29
29
|
"sst": "^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|