@worktif/runtime 0.3.0-edge.0
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/LICENSE +101 -0
- package/README.md +495 -0
- package/out/dist/bin/index.js +212 -0
- package/out/dist/bin/purenow.js +218 -0
- package/out/dist/bin/templates/runtime-web/cdk/.gitignore.template +25 -0
- package/out/dist/bin/templates/runtime-web/cdk/README.md.template +267 -0
- package/out/dist/bin/templates/runtime-web/cdk/bin/app.ts.template +173 -0
- package/out/dist/bin/templates/runtime-web/cdk/cdk.json.template +79 -0
- package/out/dist/bin/templates/runtime-web/cdk/package.json.template +28 -0
- package/out/dist/bin/templates/runtime-web/cdk/tsconfig.json.template +38 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/.env.example +15 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/README.md +118 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/gitignore.template +64 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/package.json +34 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/purenow.config.ts +105 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/app.tsx +35 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/handlers/users/index.ts +17 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/handlers/users/users.handlers.ts +222 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/index.tsx +71 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/pages/about-page.tsx +65 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/pages/home-page.tsx +55 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/pages/users-page.tsx +66 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/routes.tsx +61 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/services/index.ts +17 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/services/users.service.ts +133 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/ties/index.ts +17 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/ties/users.ties.ts +53 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/tsconfig.json +53 -0
- package/out/dist/lib/index.d.ts +4 -0
- package/out/dist/lib/index.js +4 -0
- package/out/dist/lib/lib/index.d.ts +3 -0
- package/out/dist/lib/lib/runtime-web/index.d.ts +17 -0
- package/out/dist/lib/lib/runtime-web/pipelines/browser-pipeline.d.ts +110 -0
- package/out/dist/lib/lib/runtime-web/pipelines/index.d.ts +2 -0
- package/out/dist/lib/lib/runtime-web/pureweb.d.ts +65 -0
- package/out/dist/lib/lib/runtime-web/types/config.types.d.ts +301 -0
- package/out/dist/lib/lib/runtime-web/types/http.types.d.ts +171 -0
- package/out/dist/lib/lib/runtime-web/types/index.d.ts +14 -0
- package/out/dist/lib/lib/runtime-web/types/infra.types.d.ts +225 -0
- package/out/dist/lib/lib/runtime-web/types/lambda.types.d.ts +175 -0
- package/out/dist/lib/lib/runtime-web/types/microservice.types.d.ts +70 -0
- package/out/dist/lib/lib/runtime-web/types/runtime.types.d.ts +55 -0
- package/out/dist/lib/utils/index.d.ts +2 -0
- package/out/dist/lib/utils/types/index.d.ts +3 -0
- package/out/dist/lib/utils/types/runtime.config.types.d.ts +71 -0
- package/out/dist/src/bin/index.d.ts +5 -0
- package/out/dist/src/bin/index.unix.d.ts +5 -0
- package/out/dist/src/bin/purenow-runtime-cli.d.ts +31 -0
- package/out/dist/src/bin/services/index.d.ts +8 -0
- package/out/dist/src/bin/services/purenow-runtime-deployment.strategy.d.ts +37 -0
- package/out/dist/src/bin/services/purenow-runtime-stacks-deploy.service.d.ts +58 -0
- package/out/dist/src/bin/services/purenow-runtime-stacks-deploy.service.types.d.ts +18 -0
- package/out/dist/src/bin/services/runtime-web-cli-extensions.d.ts +2 -0
- package/out/dist/src/bin/services/template.service.d.ts +53 -0
- package/out/dist/src/bin/services/utils/index.d.ts +2 -0
- package/out/dist/src/bin/utils/errors.d.ts +68 -0
- package/out/dist/src/lib/runtime-web/index.d.ts +17 -0
- package/out/dist/src/lib/runtime-web/pipelines/browser-pipeline.d.ts +110 -0
- package/out/dist/src/lib/runtime-web/pipelines/index.d.ts +2 -0
- package/out/dist/src/lib/runtime-web/pureweb.d.ts +65 -0
- package/out/dist/src/lib/runtime-web/types/config.types.d.ts +301 -0
- package/out/dist/src/lib/runtime-web/types/http.types.d.ts +171 -0
- package/out/dist/src/lib/runtime-web/types/index.d.ts +14 -0
- package/out/dist/src/lib/runtime-web/types/infra.types.d.ts +225 -0
- package/out/dist/src/lib/runtime-web/types/lambda.types.d.ts +175 -0
- package/out/dist/src/lib/runtime-web/types/microservice.types.d.ts +70 -0
- package/out/dist/src/lib/runtime-web/types/runtime.types.d.ts +55 -0
- package/package.json +133 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
Licensed Work: Work Target Insight Function (Work TIF Platform, including all associated components)
|
|
6
|
+
Licensor: Raman Marozau <raman@worktif.com>
|
|
7
|
+
Re-licensed from: Business Source License 1.1 (BUSL-1.1) on 2025-09-22
|
|
8
|
+
|
|
9
|
+
## Acceptance
|
|
10
|
+
|
|
11
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
12
|
+
|
|
13
|
+
## Copyright License
|
|
14
|
+
|
|
15
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
16
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
17
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
18
|
+
the limitations and conditions below.
|
|
19
|
+
|
|
20
|
+
## Limitations
|
|
21
|
+
|
|
22
|
+
You may not provide the software to third parties as a hosted or managed
|
|
23
|
+
service, where the service provides users with access to any substantial set of
|
|
24
|
+
the features or functionality of the software.
|
|
25
|
+
|
|
26
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
27
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
28
|
+
software that is protected by the license key.
|
|
29
|
+
|
|
30
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
31
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
32
|
+
to applicable law.
|
|
33
|
+
|
|
34
|
+
## Patents
|
|
35
|
+
|
|
36
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
37
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
38
|
+
sale, import and have imported the software, in each case subject to the
|
|
39
|
+
limitations and conditions in this license. This license does not cover any
|
|
40
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
41
|
+
the software. If you or your company make any written claim that the software
|
|
42
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
43
|
+
the software granted under these terms ends immediately. If your company makes
|
|
44
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
45
|
+
company.
|
|
46
|
+
|
|
47
|
+
## Notices
|
|
48
|
+
|
|
49
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
50
|
+
also gets a copy of these terms.
|
|
51
|
+
|
|
52
|
+
If you modify the software, you must include in any modified copies of the
|
|
53
|
+
software prominent notices stating that you have modified the software.
|
|
54
|
+
|
|
55
|
+
## No Other Rights
|
|
56
|
+
|
|
57
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
58
|
+
these terms.
|
|
59
|
+
|
|
60
|
+
## Termination
|
|
61
|
+
|
|
62
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
63
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
64
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
65
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
66
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
67
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
68
|
+
to terminate automatically and permanently.
|
|
69
|
+
|
|
70
|
+
## No Liability
|
|
71
|
+
|
|
72
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
73
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
74
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
75
|
+
legal claim.*
|
|
76
|
+
|
|
77
|
+
## Definitions
|
|
78
|
+
|
|
79
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
80
|
+
software the licensor makes available under these terms, including any portion
|
|
81
|
+
of it.
|
|
82
|
+
|
|
83
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
84
|
+
|
|
85
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
86
|
+
organization that you work for, plus all organizations that have control over,
|
|
87
|
+
are under the control of, or are under common control with that
|
|
88
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
89
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
90
|
+
otherwise. Control can be direct or indirect.
|
|
91
|
+
|
|
92
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
93
|
+
these terms.
|
|
94
|
+
|
|
95
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
96
|
+
|
|
97
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
98
|
+
|
|
99
|
+
Additional Notices:
|
|
100
|
+
For attribution notices and full license texts of included third-party dependencies,
|
|
101
|
+
see THIRD_PARTY_LICENSES.txt.
|
package/README.md
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
# @worktif/runtime
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@worktif/runtime)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
**@worktif/runtime** is an extension package that builds upon the [@worktif/purenow](https://www.npmjs.com/package/@worktif/purenow) framework, adding three-stack deployment capabilities and enhanced development tools while preserving ALL existing purenow functionality.
|
|
13
|
+
|
|
14
|
+
**Extension Relationship:** This package extends @worktif/purenow using its established architectural patterns (CLI inheritance, deployment strategies, dependency injection) rather than replacing any functionality.
|
|
15
|
+
|
|
16
|
+
**What @worktif/purenow provides (included automatically):**
|
|
17
|
+
- **Complete SSR Framework** - Server-side rendering with React Router v7
|
|
18
|
+
- **AWS Infrastructure** - CloudFront CDN, API Gateway, Lambda, S3 caching
|
|
19
|
+
- **SEO Management** - DynamoDB-based metadata with CLI tools
|
|
20
|
+
- **Two-Stack Deployment** - Infrastructure and Runtime stacks
|
|
21
|
+
- **Development Server** - Local development with HMR
|
|
22
|
+
- **CLI Tools** - Complete command-line interface for all operations
|
|
23
|
+
|
|
24
|
+
**What @worktif/runtime adds:**
|
|
25
|
+
- **Three-Stack Architecture** - Extends two-stack deployment with additional runtime stack
|
|
26
|
+
- **Enhanced CLI** - Additional commands using purenow's extensible CLI architecture
|
|
27
|
+
- **Runtime Extensions** - Additional development and deployment capabilities
|
|
28
|
+
- **Extended Configuration** - Additional options that merge with purenow config
|
|
29
|
+
|
|
30
|
+
### Key Features
|
|
31
|
+
|
|
32
|
+
**All @worktif/purenow Features (Preserved):**
|
|
33
|
+
- **Server-Side Rendering** - React Router v7 with Lambda execution
|
|
34
|
+
- **Multi-Layer Caching** - CloudFront edge + S3 storage caching
|
|
35
|
+
- **SEO Management** - DynamoDB metadata with sync/clear commands
|
|
36
|
+
- **CDK Infrastructure** - Complete AWS stack deployment
|
|
37
|
+
- **Development Server** - Local development with hot module replacement
|
|
38
|
+
- **CLI Tools** - Full command-line interface (deploy, destroy, cache-clear, seo, etc.)
|
|
39
|
+
|
|
40
|
+
**Additional Runtime Extensions:**
|
|
41
|
+
- **Three-Stack Deployment** - Extends purenow's two-stack architecture with third stack
|
|
42
|
+
- **Extended CLI Commands** - Additional commands integrated via purenow's extensible CLI
|
|
43
|
+
- **Runtime Configuration** - Extended config options that merge with purenow settings
|
|
44
|
+
- **Enhanced Development Tools** - Additional debugging and diagnostic capabilities
|
|
45
|
+
|
|
46
|
+
### Architecture
|
|
47
|
+
|
|
48
|
+
**Extension Relationship:**
|
|
49
|
+
```
|
|
50
|
+
@worktif/runtime (Extension Package)
|
|
51
|
+
↓ extends via dependency
|
|
52
|
+
@worktif/purenow (Base Framework)
|
|
53
|
+
↓ provides complete infrastructure
|
|
54
|
+
CloudFront → API Gateway → Lambda (SSR) → S3 (Cache)
|
|
55
|
+
↓
|
|
56
|
+
DynamoDB (SEO)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Deployment Architecture:**
|
|
60
|
+
```
|
|
61
|
+
Runtime Three-Stack Deployment:
|
|
62
|
+
├── Infrastructure Stack (from purenow)
|
|
63
|
+
├── Runtime Stack (from purenow)
|
|
64
|
+
└── Additional Runtime Stack (added by runtime)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This package extends purenow's two-stack deployment to three stacks while preserving all existing functionality.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
### Extension Relationship
|
|
74
|
+
|
|
75
|
+
**@worktif/runtime extends @worktif/purenow** - When you install runtime, you automatically get the complete purenow framework plus additional three-stack deployment capabilities.
|
|
76
|
+
|
|
77
|
+
### New Projects (Recommended)
|
|
78
|
+
|
|
79
|
+
Initialize a new project with runtime extensions:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx @worktif/runtime init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This creates a complete project structure with:
|
|
86
|
+
- All @worktif/purenow functionality (SSR, CDK, CLI, caching, SEO)
|
|
87
|
+
- Three-stack deployment architecture
|
|
88
|
+
- Extended CLI commands
|
|
89
|
+
- Enhanced development capabilities
|
|
90
|
+
|
|
91
|
+
### Existing Purenow Projects
|
|
92
|
+
|
|
93
|
+
Add runtime extensions to your existing purenow project:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm install @worktif/runtime
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Migration:** Your existing purenow commands and configuration continue to work unchanged. Runtime adds new capabilities without breaking existing functionality.
|
|
100
|
+
|
|
101
|
+
### Prerequisites
|
|
102
|
+
|
|
103
|
+
- Node.js >= 18
|
|
104
|
+
- AWS Account with CLI configured
|
|
105
|
+
- AWS CDK CLI installed globally: `npm install -g aws-cdk`
|
|
106
|
+
|
|
107
|
+
**Dependency Structure:** Installing @worktif/runtime automatically includes @worktif/purenow as a dependency, ensuring you have the complete base framework plus runtime extensions.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Quick Start
|
|
112
|
+
|
|
113
|
+
Get your application running with runtime extensions in 3 minutes:
|
|
114
|
+
|
|
115
|
+
### 1. Initialize Project
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
mkdir my-app && cd my-app
|
|
119
|
+
npx @worktif/runtime init
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
You'll be prompted to set up AWS CDK infrastructure with three-stack deployment. Choose **Yes** to have everything configured automatically.
|
|
123
|
+
|
|
124
|
+
### 2. Start Development
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Start development server (from purenow base framework)
|
|
128
|
+
npx purenow dev
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Your app runs at `http://localhost:3000` with all purenow features (SSR, HMR, caching) plus runtime extensions.
|
|
132
|
+
|
|
133
|
+
### 3. Deploy to AWS
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Configure AWS credentials (if not already done)
|
|
137
|
+
aws configure
|
|
138
|
+
|
|
139
|
+
# Deploy with three-stack architecture (runtime extension)
|
|
140
|
+
npx purenow deploy --stage dev
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Your application is now live on CloudFront with three-stack deployment architecture!
|
|
144
|
+
|
|
145
|
+
**Clean Up Resources:**
|
|
146
|
+
```bash
|
|
147
|
+
# When you're done, destroy all stacks to avoid AWS charges
|
|
148
|
+
npx purenow destroy --stage dev
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Next Steps:**
|
|
152
|
+
- Use all [Purenow CLI Commands](https://www.npmjs.com/package/@worktif/purenow#cli-commands) (unchanged)
|
|
153
|
+
- Explore [Three-Stack Architecture](#three-stack-deployment)
|
|
154
|
+
- Learn about [Extended CLI Commands](#extended-cli-commands)
|
|
155
|
+
- Read the [Base Framework Documentation](https://www.npmjs.com/package/@worktif/purenow)
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Usage
|
|
160
|
+
|
|
161
|
+
### CLI Commands
|
|
162
|
+
|
|
163
|
+
**All Purenow Commands Available (Unchanged):**
|
|
164
|
+
The runtime package preserves all base purenow CLI functionality:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Development (from purenow base framework)
|
|
168
|
+
npx purenow dev # Start development server
|
|
169
|
+
npx purenow dev --port 8080 # Custom port
|
|
170
|
+
|
|
171
|
+
# Building (from purenow base framework)
|
|
172
|
+
npx purenow build # Build for deployment
|
|
173
|
+
npx purenow build --target lambda # Build specific target
|
|
174
|
+
|
|
175
|
+
# Deployment (from purenow base framework)
|
|
176
|
+
npx purenow deploy --stage dev # Deploy to AWS (now uses three stacks)
|
|
177
|
+
npx purenow destroy --stage dev # Destroy all stacks
|
|
178
|
+
|
|
179
|
+
# Resource Management (from purenow base framework)
|
|
180
|
+
npx purenow stacks list --outputs # List stack outputs
|
|
181
|
+
npx purenow cache-clear --stage dev # Clear CloudFront/S3 cache
|
|
182
|
+
|
|
183
|
+
# SEO Management (from purenow base framework)
|
|
184
|
+
npx purenow seo sync --stage dev # Sync SEO metadata
|
|
185
|
+
npx purenow seo clear --stage dev # Clear SEO data
|
|
186
|
+
|
|
187
|
+
# Diagnostics (from purenow base framework)
|
|
188
|
+
npx purenow doctor # System diagnostics
|
|
189
|
+
npx purenow info # Display configuration
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Extended CLI Commands
|
|
193
|
+
|
|
194
|
+
Runtime adds additional commands using purenow's extensible CLI architecture:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Runtime-specific diagnostics
|
|
198
|
+
npx purenow runtime:info # Display runtime extension information
|
|
199
|
+
npx purenow runtime:stacks # Show three-stack deployment status
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Complete CLI Reference:** See [@worktif/purenow CLI documentation](https://www.npmjs.com/package/@worktif/purenow#cli-commands) for all base commands
|
|
203
|
+
|
|
204
|
+
### Programmatic Usage
|
|
205
|
+
|
|
206
|
+
Initialize your application using runtime (includes all purenow functionality):
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { purenow, purenowRouter, ErrorBoundary } from '@worktif/runtime';
|
|
210
|
+
import { routes } from './routes';
|
|
211
|
+
import App from './App';
|
|
212
|
+
|
|
213
|
+
// Initialize with all purenow functionality + runtime extensions
|
|
214
|
+
purenow({
|
|
215
|
+
app: ({ router }) => <App router={router} />,
|
|
216
|
+
router: purenowRouter({
|
|
217
|
+
router: routes,
|
|
218
|
+
defaults: {
|
|
219
|
+
HydrateFallback: () => <div>Loading...</div>,
|
|
220
|
+
ErrorBoundary,
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
config: {
|
|
224
|
+
serviceName: process.env.PURE_ENV_STACK_NAME || 'my-app',
|
|
225
|
+
stage: (process.env.PURE_ENV_STAGE as 'dev' | 'staging' | 'prod') || 'dev',
|
|
226
|
+
// Runtime extensions can add additional config options here
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Extension Relationship:** This package re-exports all @worktif/purenow functionality unchanged, plus adds runtime-specific extensions.
|
|
232
|
+
|
|
233
|
+
### Three-Stack Deployment
|
|
234
|
+
|
|
235
|
+
Runtime extends purenow's two-stack deployment to three stacks:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
// When you deploy with runtime, you get three stacks instead of two:
|
|
239
|
+
// 1. Infrastructure Stack (from purenow)
|
|
240
|
+
// 2. Runtime Stack (from purenow)
|
|
241
|
+
// 3. Additional Runtime Stack (added by runtime)
|
|
242
|
+
|
|
243
|
+
// All purenow functionality remains unchanged
|
|
244
|
+
// Runtime adds additional deployment capabilities
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Three-Stack Benefits:**
|
|
248
|
+
- **Extended Infrastructure**: Additional AWS resources for enhanced functionality
|
|
249
|
+
- **Deployment Strategy**: Uses purenow's deployment strategy pattern
|
|
250
|
+
- **Resource Isolation**: Better separation of concerns across stacks
|
|
251
|
+
- **Backward Compatibility**: All existing purenow deployments continue to work
|
|
252
|
+
|
|
253
|
+
**Base Framework Features:** All SSR, caching, SEO, CLI tools, and other features from @worktif/purenow are available unchanged.
|
|
254
|
+
|
|
255
|
+
### CDK Construct Library
|
|
256
|
+
|
|
257
|
+
The runtime package provides access to purenow constructs plus runtime extensions:
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
import * as cdk from 'aws-cdk-lib';
|
|
261
|
+
import { PurenowStack } from '@worktif/runtime/infra';
|
|
262
|
+
import { RuntimeStack } from '@worktif/runtime/infra';
|
|
263
|
+
|
|
264
|
+
const app = new cdk.App();
|
|
265
|
+
|
|
266
|
+
// Base Purenow stacks (re-exported from @worktif/purenow)
|
|
267
|
+
const infraStack = new PurenowStack(app, 'MyApp-Infra-Dev', {
|
|
268
|
+
stage: 'dev',
|
|
269
|
+
serviceName: 'my-app',
|
|
270
|
+
enableSeo: true,
|
|
271
|
+
env: {
|
|
272
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
273
|
+
region: 'us-east-1',
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// Additional runtime stack (extends purenow's two-stack architecture)
|
|
278
|
+
new RuntimeStack(app, 'MyApp-Runtime-Dev', {
|
|
279
|
+
stage: 'dev',
|
|
280
|
+
serviceName: 'my-app',
|
|
281
|
+
// Extends existing purenow infrastructure
|
|
282
|
+
dependsOn: [infraStack],
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
app.synth();
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Extension Relationship:** Runtime constructs extend purenow's existing CDK patterns and integrate with the two-stack architecture.
|
|
289
|
+
|
|
290
|
+
**CDK Documentation:** See [@worktif/purenow CDK documentation](https://www.npmjs.com/package/@worktif/purenow#cdk-construct-library) for base constructs
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Runtime Extensions
|
|
295
|
+
|
|
296
|
+
### Three-Stack Deployment Architecture
|
|
297
|
+
|
|
298
|
+
Runtime extends purenow's deployment from two stacks to three:
|
|
299
|
+
|
|
300
|
+
**Stack Architecture:**
|
|
301
|
+
1. **Infrastructure Stack** (from purenow) - Core AWS resources
|
|
302
|
+
2. **Runtime Stack** (from purenow) - Lambda functions and API Gateway
|
|
303
|
+
3. **Additional Runtime Stack** (added by runtime) - Extended functionality
|
|
304
|
+
|
|
305
|
+
**Deployment Commands:**
|
|
306
|
+
```bash
|
|
307
|
+
# Deploy all three stacks (runtime extension)
|
|
308
|
+
npx purenow deploy --stage dev
|
|
309
|
+
|
|
310
|
+
# Destroy all three stacks (runtime extension)
|
|
311
|
+
npx purenow destroy --stage dev
|
|
312
|
+
|
|
313
|
+
# List all stack outputs (includes third stack)
|
|
314
|
+
npx purenow stacks list --outputs
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Extended CLI Architecture
|
|
318
|
+
|
|
319
|
+
Runtime uses purenow's extensible CLI architecture to add commands:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Runtime-specific commands (added via CLI extension)
|
|
323
|
+
npx purenow runtime:info # Display runtime extension information
|
|
324
|
+
npx purenow runtime:stacks # Show three-stack deployment status
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Complete Purenow Features (Preserved)
|
|
328
|
+
|
|
329
|
+
All features from @worktif/purenow are available unchanged:
|
|
330
|
+
|
|
331
|
+
- **SEO Integration** with DynamoDB (`npx purenow seo sync/clear`)
|
|
332
|
+
- **Cache Management** for S3, CloudFront (`npx purenow cache-clear`)
|
|
333
|
+
- **Development Server** with HMR (`npx purenow dev`)
|
|
334
|
+
- **CloudFormation Resource Resolution** (`npx purenow stacks list`)
|
|
335
|
+
- **HTML Template Customization** (all configuration options)
|
|
336
|
+
- **Complete CLI Commands** (deploy, destroy, build, doctor, info)
|
|
337
|
+
|
|
338
|
+
See the [@worktif/purenow documentation](https://www.npmjs.com/package/@worktif/purenow) for complete details on all base framework features.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Documentation
|
|
343
|
+
|
|
344
|
+
### Runtime Extension Documentation
|
|
345
|
+
- [Three-Stack Architecture](#three-stack-deployment-architecture) - Extended deployment architecture
|
|
346
|
+
- [Extended CLI Commands](#extended-cli-architecture) - Runtime-specific CLI additions
|
|
347
|
+
- [CDK Extensions](#cdk-construct-library) - Runtime CDK constructs
|
|
348
|
+
|
|
349
|
+
### Complete Base Framework Documentation
|
|
350
|
+
For complete documentation on all base framework features (which runtime extends), see [@worktif/purenow documentation](https://www.npmjs.com/package/@worktif/purenow):
|
|
351
|
+
|
|
352
|
+
- **Getting Started** - Project initialization and setup
|
|
353
|
+
- **CLI Commands** - Complete command reference (all available in runtime)
|
|
354
|
+
- **CDK & Deployment** - Infrastructure and deployment patterns
|
|
355
|
+
- **Development** - Local development server and workflows
|
|
356
|
+
- **SEO Integration** - DynamoDB metadata management
|
|
357
|
+
- **Cache Management** - S3, CloudFront, and CloudFormation caching
|
|
358
|
+
- **Architecture** - Complete framework architecture
|
|
359
|
+
- **API Reference** - Complete TypeScript API documentation
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Package Exports
|
|
364
|
+
|
|
365
|
+
The runtime package provides multiple entry points that extend purenow functionality:
|
|
366
|
+
|
|
367
|
+
| Export | Path | Description |
|
|
368
|
+
|--------|------|-------------|
|
|
369
|
+
| Main Library | `@worktif/runtime` | All @worktif/purenow exports + runtime extensions |
|
|
370
|
+
| Runtime Extensions | `@worktif/runtime/runtime-web` | Runtime-specific functionality |
|
|
371
|
+
| Extended CLI | `@worktif/runtime/cli` | CLI with runtime commands (extends purenow CLI) |
|
|
372
|
+
| CDK Constructs | `@worktif/runtime/infra` | Purenow constructs + runtime extensions |
|
|
373
|
+
|
|
374
|
+
**Example:**
|
|
375
|
+
```typescript
|
|
376
|
+
// Import runtime library (includes all purenow functionality + extensions)
|
|
377
|
+
import { purenow, PurenowRouter } from '@worktif/runtime';
|
|
378
|
+
|
|
379
|
+
// Import runtime-specific functionality
|
|
380
|
+
import { RuntimeExtensions } from '@worktif/runtime/runtime-web';
|
|
381
|
+
|
|
382
|
+
// Import CDK constructs (purenow + runtime extensions)
|
|
383
|
+
import { PurenowStack, RuntimeStack } from '@worktif/runtime/infra';
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Extension Relationship:** All exports include the complete @worktif/purenow functionality plus runtime-specific additions.
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Examples
|
|
391
|
+
|
|
392
|
+
### Basic Application with Runtime Extensions
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
import { purenow, purenowRouter } from '@worktif/runtime';
|
|
396
|
+
import { RouteObject } from 'react-router';
|
|
397
|
+
import { HomePage } from './pages/HomePage';
|
|
398
|
+
import { AboutPage } from './pages/AboutPage';
|
|
399
|
+
import App from './App';
|
|
400
|
+
|
|
401
|
+
const routes: RouteObject[] = [
|
|
402
|
+
{
|
|
403
|
+
path: '/',
|
|
404
|
+
element: <HomePage />,
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
path: '/about',
|
|
408
|
+
element: <AboutPage />,
|
|
409
|
+
},
|
|
410
|
+
];
|
|
411
|
+
|
|
412
|
+
// Uses all purenow functionality + runtime extensions
|
|
413
|
+
purenow({
|
|
414
|
+
app: ({ router }) => <App router={router} />,
|
|
415
|
+
router: purenowRouter({
|
|
416
|
+
router: routes,
|
|
417
|
+
}),
|
|
418
|
+
config: {
|
|
419
|
+
serviceName: 'my-app',
|
|
420
|
+
stage: 'dev',
|
|
421
|
+
// Runtime can extend config options here
|
|
422
|
+
},
|
|
423
|
+
});
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Three-Stack CDK Deployment
|
|
427
|
+
|
|
428
|
+
```typescript
|
|
429
|
+
import { PurenowStack, RuntimeStack } from '@worktif/runtime/infra';
|
|
430
|
+
import * as cdk from 'aws-cdk-lib';
|
|
431
|
+
|
|
432
|
+
const app = new cdk.App();
|
|
433
|
+
|
|
434
|
+
// Infrastructure stack (from purenow)
|
|
435
|
+
const infraStack = new PurenowStack(app, 'MyApp-Infra-Prod', {
|
|
436
|
+
stage: 'prod',
|
|
437
|
+
serviceName: 'my-app',
|
|
438
|
+
enableSeo: true,
|
|
439
|
+
lambdaMemorySize: 1024,
|
|
440
|
+
lambdaTimeout: 30,
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Additional runtime stack (extends purenow architecture)
|
|
444
|
+
new RuntimeStack(app, 'MyApp-Runtime-Prod', {
|
|
445
|
+
stage: 'prod',
|
|
446
|
+
serviceName: 'my-app',
|
|
447
|
+
dependsOn: [infraStack], // Extends existing infrastructure
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
app.synth();
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
**More Examples:** See [@worktif/purenow examples](https://www.npmjs.com/package/@worktif/purenow#examples) for all base framework examples (all work with runtime)
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Contributing
|
|
458
|
+
|
|
459
|
+
We welcome contributions! Please follow these steps:
|
|
460
|
+
|
|
461
|
+
1. Fork the repository
|
|
462
|
+
2. Create a feature branch
|
|
463
|
+
3. Make your changes with tests
|
|
464
|
+
4. Submit a pull request
|
|
465
|
+
|
|
466
|
+
For detailed contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
467
|
+
|
|
468
|
+
**Security:** Report vulnerabilities privately to [raman@worktif.com](mailto:raman@worktif.com)
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## License
|
|
473
|
+
|
|
474
|
+
This project is licensed under the [Elastic License 2.0](https://raw.githubusercontent.com/elastic/elasticsearch/v7.16.3/licenses/ELASTIC-LICENSE-2.0.txt).
|
|
475
|
+
|
|
476
|
+
- See [LICENSE](LICENSE) for the full license text
|
|
477
|
+
- See [NOTICE](NOTICE) for attribution and relicensing details
|
|
478
|
+
- See [CHANGELOG.md](CHANGELOG.md) for version history
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## Support
|
|
483
|
+
|
|
484
|
+
**Maintainer:** Raman Marozau - [raman@worktif.com](mailto:raman@worktif.com)
|
|
485
|
+
|
|
486
|
+
**Get Help:**
|
|
487
|
+
- [Documentation](docs/README.md)
|
|
488
|
+
- [GitHub Issues](https://github.com/worktif/purenow/issues)
|
|
489
|
+
- [Email Support](mailto:raman@worktif.com) (use "[purenow]" in subject)
|
|
490
|
+
|
|
491
|
+
For enterprise support and integration guidance, contact us via email.
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
**Ready to get started?** Run `npx @worktif/runtime init` to create your first serverless React application with three-stack deployment and all purenow features!
|