@harperfast/template-react-studio 1.5.1 → 1.5.3
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/.agents/skills/harper-best-practices/AGENTS.md +104 -4
- package/.agents/skills/harper-best-practices/SKILL.md +1 -0
- package/.agents/skills/harper-best-practices/rules/creating-a-fabric-account-and-cluster.md +23 -0
- package/.agents/skills/harper-best-practices/rules/deploying-to-harper-fabric.md +74 -1
- package/package.json +1 -1
- package/skills-lock.json +1 -1
|
@@ -25,8 +25,9 @@ Guidelines for building scalable, secure, and performant applications on Harper.
|
|
|
25
25
|
- 3.5 [Caching](#35-caching)
|
|
26
26
|
4. [Infrastructure & Ops](#4-infrastructure--ops) — **MEDIUM**
|
|
27
27
|
- 4.1 [Creating Harper Applications](#41-creating-harper-applications)
|
|
28
|
-
- 4.2 [
|
|
29
|
-
- 4.3 [
|
|
28
|
+
- 4.2 [Creating a Fabric Account and Cluster](#42-creating-a-fabric-account-and-cluster)
|
|
29
|
+
- 4.3 [Deploying to Harper Fabric](#43-deploying-to-harper-fabric)
|
|
30
|
+
- 4.4 [Serving Web Content](#44-serving-web-content)
|
|
30
31
|
|
|
31
32
|
---
|
|
32
33
|
|
|
@@ -266,7 +267,25 @@ pnpm create harper@latest
|
|
|
266
267
|
bun create harper@latest
|
|
267
268
|
```
|
|
268
269
|
|
|
269
|
-
### 4.2
|
|
270
|
+
### 4.2 Creating a Fabric Account and Cluster
|
|
271
|
+
|
|
272
|
+
Follow these steps to set up your Harper Fabric environment for deployment.
|
|
273
|
+
|
|
274
|
+
#### Steps
|
|
275
|
+
|
|
276
|
+
1. **Sign Up/In**: Go to [https://fabric.harper.fast/](https://fabric.harper.fast/) and sign up or sign in.
|
|
277
|
+
2. **Create an Organization**: Create an organization (org) to manage your projects.
|
|
278
|
+
3. **Create a Cluster**: Create a new cluster. This can be on the free tier, no credit card required.
|
|
279
|
+
4. **Set Credentials**: During setup, set the cluster username and password to finish configuring it.
|
|
280
|
+
5. **Get Application URL**: Navigate to the **Config** tab and copy the **Application URL**.
|
|
281
|
+
6. **Configure Environment**: Update your `.env` file or GitHub Actions secrets with these cluster-specific credentials:
|
|
282
|
+
```bash
|
|
283
|
+
CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
|
|
284
|
+
CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
|
|
285
|
+
CLI_TARGET='YOUR_CLUSTER_URL'
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### 4.3 Deploying to Harper Fabric
|
|
270
289
|
|
|
271
290
|
Globally scaling your Harper application.
|
|
272
291
|
|
|
@@ -275,7 +294,88 @@ Globally scaling your Harper application.
|
|
|
275
294
|
- **Automatic Sync**: Data is synced across the fabric automatically.
|
|
276
295
|
- **Free Tier**: Start for free and scale as you grow.
|
|
277
296
|
|
|
278
|
-
|
|
297
|
+
#### Steps
|
|
298
|
+
1. **Sign up**: Follow the [Creating a Fabric Account and Cluster](#42-creating-a-fabric-account-and-cluster) steps to create a Harper Fabric account, organization, and cluster.
|
|
299
|
+
2. **Configure Environment**: Add your cluster credentials and cluster application URL to `.env`:
|
|
300
|
+
```bash
|
|
301
|
+
CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
|
|
302
|
+
CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
|
|
303
|
+
CLI_TARGET='YOUR_CLUSTER_URL'
|
|
304
|
+
```
|
|
305
|
+
3. **Deploy From Local Environment**: Run `npm run deploy`.
|
|
306
|
+
4. **Set up CI/CD**: Configure `.github/workflows/deploy.yaml` and set repository secrets for automated deployments.
|
|
307
|
+
|
|
308
|
+
#### Manual Setup for Existing Apps
|
|
309
|
+
|
|
310
|
+
If your application was not created with `npm create harper`, you'll need to manually configure the deployment scripts and CI/CD workflow.
|
|
311
|
+
|
|
312
|
+
##### 1. Update `package.json`
|
|
313
|
+
|
|
314
|
+
Add the following scripts and dependencies to your `package.json`:
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"scripts": {
|
|
319
|
+
"deploy": "dotenv -- npm run deploy:component",
|
|
320
|
+
"deploy:component": "harperdb deploy_component . restart=rolling replicated=true"
|
|
321
|
+
},
|
|
322
|
+
"devDependencies": {
|
|
323
|
+
"dotenv-cli": "^11.0.0",
|
|
324
|
+
"harperdb": "^4.7.20"
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
###### Why split the scripts?
|
|
330
|
+
|
|
331
|
+
The `deploy` script is separated from `deploy:component` to ensure environment variables from your `.env` file are properly loaded and passed to the Harper CLI.
|
|
332
|
+
|
|
333
|
+
- `deploy`: Uses `dotenv-cli` to load environment variables (like `CLI_TARGET`, `CLI_TARGET_USERNAME`, and `CLI_TARGET_PASSWORD`) before executing the next command.
|
|
334
|
+
- `deploy:component`: The actual command that performs the deployment.
|
|
335
|
+
|
|
336
|
+
By using `dotenv -- npm run deploy:component`, the environment variables are correctly set in the shell session before `harperdb deploy_component` is called, allowing it to authenticate with your cluster.
|
|
337
|
+
|
|
338
|
+
##### 2. Configure GitHub Actions
|
|
339
|
+
|
|
340
|
+
Create a `.github/workflows/deploy.yaml` file with the following content:
|
|
341
|
+
|
|
342
|
+
```yaml
|
|
343
|
+
name: Deploy to Harper Fabric
|
|
344
|
+
on:
|
|
345
|
+
workflow_dispatch:
|
|
346
|
+
# push:
|
|
347
|
+
# branches:
|
|
348
|
+
# - main
|
|
349
|
+
concurrency:
|
|
350
|
+
group: main
|
|
351
|
+
cancel-in-progress: false
|
|
352
|
+
jobs:
|
|
353
|
+
deploy:
|
|
354
|
+
runs-on: ubuntu-latest
|
|
355
|
+
steps:
|
|
356
|
+
- name: Checkout code
|
|
357
|
+
uses: actions/checkout@v4
|
|
358
|
+
- name: Set up Node.js
|
|
359
|
+
uses: actions/setup-node@v4
|
|
360
|
+
with:
|
|
361
|
+
cache: 'npm'
|
|
362
|
+
node-version: '20'
|
|
363
|
+
- name: Install dependencies
|
|
364
|
+
run: npm ci
|
|
365
|
+
- name: Run unit tests
|
|
366
|
+
run: npm test
|
|
367
|
+
- name: Run lint
|
|
368
|
+
run: npm run lint
|
|
369
|
+
- name: Deploy
|
|
370
|
+
run: npm run deploy
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Be sure to set the following repository secrets in your GitHub repository:
|
|
374
|
+
- `CLI_TARGET`
|
|
375
|
+
- `CLI_TARGET_USERNAME`
|
|
376
|
+
- `CLI_TARGET_PASSWORD`
|
|
377
|
+
|
|
378
|
+
### 4.4 Serving Web Content
|
|
279
379
|
|
|
280
380
|
Two ways to serve web content from a Harper application.
|
|
281
381
|
|
|
@@ -72,6 +72,7 @@ Reference these guidelines when:
|
|
|
72
72
|
### 4. Infrastructure & Ops (MEDIUM)
|
|
73
73
|
|
|
74
74
|
- `deploying-to-harper-fabric` - Scale globally with Harper Fabric
|
|
75
|
+
- `creating-a-fabric-account-and-cluster` - Setting up your Harper Fabric cloud infrastructure
|
|
75
76
|
- `creating-harper-apps` - Quickstart with `npm create harper@latest`
|
|
76
77
|
- `serving-web-content` - Ways to serve web content from Harper
|
|
77
78
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: creating-a-fabric-account-and-cluster
|
|
3
|
+
description: How to create a Harper Fabric account, organization, and cluster.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating a Harper Fabric Account and Cluster
|
|
7
|
+
|
|
8
|
+
Follow these steps to set up your Harper Fabric environment for deployment.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Sign Up/In**: Go to [https://fabric.harper.fast/](https://fabric.harper.fast/) and sign up or sign in.
|
|
13
|
+
2. **Create an Organization**: Create an organization (org) to manage your projects.
|
|
14
|
+
3. **Create a Cluster**: Create a new cluster. This can be on the free tier, no credit card required.
|
|
15
|
+
4. **Set Credentials**: During setup, set the cluster username and password to finish configuring it.
|
|
16
|
+
5. **Get Application URL**: Navigate to the **Config** tab and copy the **Application URL**.
|
|
17
|
+
6. **Configure Environment**: Update your `.env` file or GitHub Actions secrets with these cluster-specific credentials:
|
|
18
|
+
```bash
|
|
19
|
+
CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
|
|
20
|
+
CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
|
|
21
|
+
CLI_TARGET='YOUR_CLUSTER_URL'
|
|
22
|
+
```
|
|
23
|
+
7. **Next Steps**: See the [deploying-to-harper-fabric](deploying-to-harper-fabric.md) rule for detailed instructions on deploying your application successfully.
|
|
@@ -13,7 +13,7 @@ Use this skill when you are ready to move your Harper application from local dev
|
|
|
13
13
|
|
|
14
14
|
## Steps
|
|
15
15
|
|
|
16
|
-
1. **Sign up**:
|
|
16
|
+
1. **Sign up**: Follow the [creating-a-fabric-account-and-cluster](creating-a-fabric-account-and-cluster.md) rule to create a Harper Fabric account, organization, and cluster.
|
|
17
17
|
2. **Configure Environment**: Add your cluster credentials and cluster application URL to `.env`:
|
|
18
18
|
```bash
|
|
19
19
|
CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
|
|
@@ -22,3 +22,76 @@ Use this skill when you are ready to move your Harper application from local dev
|
|
|
22
22
|
```
|
|
23
23
|
3. **Deploy From Local Environment**: Run `npm run deploy`.
|
|
24
24
|
4. **Set up CI/CD**: Configure `.github/workflows/deploy.yaml` and set repository secrets for automated deployments.
|
|
25
|
+
|
|
26
|
+
## Manual Setup for Existing Apps
|
|
27
|
+
|
|
28
|
+
If your application was not created with `npm create harper`, you'll need to manually configure the deployment scripts and CI/CD workflow.
|
|
29
|
+
|
|
30
|
+
### 1. Update `package.json`
|
|
31
|
+
|
|
32
|
+
Add the following scripts and dependencies to your `package.json`:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"scripts": {
|
|
37
|
+
"deploy": "dotenv -- npm run deploy:component",
|
|
38
|
+
"deploy:component": "harperdb deploy_component . restart=rolling replicated=true"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"dotenv-cli": "^11.0.0",
|
|
42
|
+
"harperdb": "^4.7.20"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Why split the scripts?
|
|
48
|
+
|
|
49
|
+
The `deploy` script is separated from `deploy:component` to ensure environment variables from your `.env` file are properly loaded and passed to the Harper CLI.
|
|
50
|
+
|
|
51
|
+
- `deploy`: Uses `dotenv-cli` to load environment variables (like `CLI_TARGET`, `CLI_TARGET_USERNAME`, and `CLI_TARGET_PASSWORD`) before executing the next command.
|
|
52
|
+
- `deploy:component`: The actual command that performs the deployment.
|
|
53
|
+
|
|
54
|
+
By using `dotenv -- npm run deploy:component`, the environment variables are correctly set in the shell session before `harperdb deploy_component` is called, allowing it to authenticate with your cluster.
|
|
55
|
+
|
|
56
|
+
### 2. Configure GitHub Actions
|
|
57
|
+
|
|
58
|
+
Create a `.github/workflows/deploy.yaml` file with the following content:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
name: Deploy to Harper Fabric
|
|
62
|
+
on:
|
|
63
|
+
workflow_dispatch:
|
|
64
|
+
# push:
|
|
65
|
+
# branches:
|
|
66
|
+
# - main
|
|
67
|
+
concurrency:
|
|
68
|
+
group: main
|
|
69
|
+
cancel-in-progress: false
|
|
70
|
+
jobs:
|
|
71
|
+
deploy:
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- name: Checkout code
|
|
75
|
+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
76
|
+
with:
|
|
77
|
+
fetch-depth: 0
|
|
78
|
+
fetch-tags: true
|
|
79
|
+
- name: Set up Node.js
|
|
80
|
+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
81
|
+
with:
|
|
82
|
+
cache: 'npm'
|
|
83
|
+
node-version-file: '.nvmrc'
|
|
84
|
+
- name: Install dependencies
|
|
85
|
+
run: npm ci
|
|
86
|
+
- name: Run unit tests
|
|
87
|
+
run: npm test
|
|
88
|
+
- name: Run lint
|
|
89
|
+
run: npm run lint
|
|
90
|
+
- name: Deploy
|
|
91
|
+
run: npm run deploy
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Be sure to set the following repository secrets in your GitHub repository's /settings/secrets/actions:
|
|
95
|
+
- `CLI_TARGET`
|
|
96
|
+
- `CLI_TARGET_USERNAME`
|
|
97
|
+
- `CLI_TARGET_PASSWORD`
|
package/package.json
CHANGED
package/skills-lock.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"harper-best-practices": {
|
|
5
5
|
"source": "harperfast/skills",
|
|
6
6
|
"sourceType": "github",
|
|
7
|
-
"computedHash": "
|
|
7
|
+
"computedHash": "165c6115ea772cdfb0f5d3f02003d63f85d265ed4950d274db5cdc1e7da40e7e"
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|