create-harper 0.13.0 → 1.0.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/README.svg CHANGED
@@ -116,7 +116,7 @@
116
116
  class="sans"
117
117
  x="0"
118
118
  y="62"
119
- font-size="96"
119
+ font-size="128"
120
120
  font-weight="800"
121
121
  letter-spacing="-1.5"
122
122
  fill="url(#harperGrad)"
@@ -145,10 +145,10 @@
145
145
  font-size="22"
146
146
  fill="#e6f7ff"
147
147
  opacity="0.96"
148
- >$ npm create harper</text>
148
+ >$ npm create harper@latest</text>
149
149
 
150
150
  <!-- blinking cursor -->
151
- <rect x="350" y="17" width="3" height="24" fill="#e6f7ff" opacity="0.55">
151
+ <rect x="440" y="16" width="12" height="24" fill="#e6f7ff" opacity="0.55">
152
152
  <animate
153
153
  attributeName="opacity"
154
154
  values="0.1;0.8;0.1"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-harper",
3
3
  "description": "Scaffold a new Harper project in JavaScript or TypeScript.",
4
- "version": "0.13.0",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "HarperDB",
@@ -6,16 +6,17 @@ This repository contains "skills" that guide AI agents in developing Harper appl
6
6
 
7
7
  - [Adding Tables with Schemas](skills/adding-tables-with-schemas.md): Learn how to define schemas and enable automatic REST APIs for your database tables with schema .graphql files in Harper.
8
8
  - [Automatic APIs](skills/automatic-apis.md): Details on the CRUD endpoints automatically generated for exported tables with REST and WebSockets.
9
- - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
10
- - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
9
+ - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
10
+ - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
11
11
  - [Custom Resources](skills/custom-resources.md): How to define custom REST endpoints using JavaScript or TypeScript (Note: Paths are case-sensitive).
12
- - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
13
12
  - [Defining Relationships](skills/defining-relationships.md): Using the `@relationship` directive to link tables.
14
- - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
15
- - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
13
+ - [Deploying to Harper Fabric](skills/deploying-to-harper-fabric.md): Globally scaling your Harper application with our generous Free tier and beyond.
14
+ - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
16
15
  - [Handling Binary Data](skills/handling-binary-data.md): How to store and serve binary data like images or MP3s.
16
+ - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
17
+ - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
18
+ - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
17
19
  - [Serving Web Content](skills/serving-web-content): Two ways to serve web content from a Harper application.
18
- - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
19
- - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
20
+ - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
20
21
  - [Using Blobs](skills/using-blob-datatype.md): How to store and retrieve large data in HarperDB.
21
22
  - [Vector Indexing](skills/vector-indexing.md): How to define and use vector indexes for efficient similarity search.
@@ -22,15 +22,62 @@ npm run dev
22
22
 
23
23
  ### Define Your Schema
24
24
 
25
- The [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
25
+ 1. Create a new yourTableName.graphql file in the [schemas](./schemas) directory.
26
+ 2. Craft your schema by hand.
27
+ 3. Save your changes.
26
28
 
27
- Open your [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
28
-
29
- These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
29
+ These schemas are the heart of a great Harper app, specifying which tables you want and what attributes/fields they should have. Any table you `@export` stands up [REST endpoints automatically](./skills/automatic-rest-apis.md).
30
30
 
31
31
  ### Add Custom Endpoints
32
32
 
33
- The [resources/greeting.js](./resources/greeting.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
33
+ 1. Create a new greeting.js file in the [resources](./resources) directory.
34
+
35
+ 2. Customize your resource:
36
+
37
+ ```javascript
38
+ export class Greeting extends Resource {
39
+ static loadAsInstance = false;
40
+
41
+ async post(
42
+ target,
43
+ newRecord,
44
+ ) {
45
+ // By default, only super users can access these endpoints.
46
+ return { greeting: 'Greetings, post!' };
47
+ }
48
+
49
+ async get(target) {
50
+ // But if we want anyone to be able to access it, we can turn off the permission checks!
51
+ target.checkPermission = false;
52
+ return { greeting: 'Greetings, get! ' + process.version };
53
+ }
54
+
55
+ async put(
56
+ target,
57
+ record,
58
+ ) {
59
+ target.checkPermission = false;
60
+ if (this.getCurrentUser()?.name?.includes('Coffee')) {
61
+ // You can add your own authorization guards, of course.
62
+ return new Response('Coffee? COFFEE?!', { status: 418 });
63
+ }
64
+ return { greeting: 'Sssssssssssssss!' };
65
+ }
66
+
67
+ async patch(
68
+ target,
69
+ record,
70
+ ) {
71
+ return { greeting: 'We can make this work!' };
72
+ }
73
+
74
+ async delete(target) {
75
+ return true;
76
+ }
77
+ }
78
+ ```
79
+
80
+ 3. Save your changes.
34
81
 
35
82
  ### View Your Website
36
83
 
@@ -58,7 +105,7 @@ Take a look at the [default configuration](./config.yaml), which specifies how f
58
105
 
59
106
  When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
60
107
 
61
- Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
108
+ Come back here and configure your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
62
109
 
63
110
  Then you can deploy your app to your cluster:
64
111
 
@@ -0,0 +1,20 @@
1
+ # Deploying to Harper Fabric
2
+
3
+ To deploy your application to Harper Fabric, follow these steps:
4
+
5
+ 1. **Sign up**: Create an account at [https://fabric.harper.fast](https://fabric.harper.fast) and create a cluster.
6
+
7
+ 2. **Configure Environment**: Add your credentials and cluster URL to your `.env` file:
8
+ ```bash
9
+ # Deployments
10
+ CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
11
+ CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
12
+ CLI_TARGET='YOUR_FABRIC.HARPER.FAST_CLUSTER_URL_HERE'
13
+ ```
14
+
15
+ 3. **Deploy Locally**: Run the following command to deploy from your local environment:
16
+ ```bash
17
+ npm run deploy
18
+ ```
19
+
20
+ 4. **Set up CI/CD**: Customize the included `.github/workflow/deploy.yaml` file and define your secrets in your GitHub repository's action settings to enable continuous deployment.
@@ -6,16 +6,17 @@ This repository contains "skills" that guide AI agents in developing Harper appl
6
6
 
7
7
  - [Adding Tables with Schemas](skills/adding-tables-with-schemas.md): Learn how to define schemas and enable automatic REST APIs for your database tables with schema .graphql files in Harper.
8
8
  - [Automatic APIs](skills/automatic-apis.md): Details on the CRUD endpoints automatically generated for exported tables with REST and WebSockets.
9
- - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
10
- - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
9
+ - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
10
+ - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
11
11
  - [Custom Resources](skills/custom-resources.md): How to define custom REST endpoints using JavaScript or TypeScript (Note: Paths are case-sensitive).
12
- - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
13
12
  - [Defining Relationships](skills/defining-relationships.md): Using the `@relationship` directive to link tables.
14
- - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
15
- - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
13
+ - [Deploying to Harper Fabric](skills/deploying-to-harper-fabric.md): Globally scaling your Harper application with our generous Free tier and beyond.
14
+ - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
16
15
  - [Handling Binary Data](skills/handling-binary-data.md): How to store and serve binary data like images or MP3s.
16
+ - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
17
+ - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
18
+ - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
17
19
  - [Serving Web Content](skills/serving-web-content): Two ways to serve web content from a Harper application.
18
- - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
19
- - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
20
+ - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
20
21
  - [Using Blobs](skills/using-blob-datatype.md): How to store and retrieve large data in HarperDB.
21
22
  - [Vector Indexing](skills/vector-indexing.md): How to define and use vector indexes for efficient similarity search.
@@ -24,15 +24,72 @@ TypeScript is supported at runtime in Node.js through [type stripping](https://n
24
24
 
25
25
  ### Define Your Schema
26
26
 
27
- The [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
27
+ 1. Create a new yourTableName.graphql file in the [schemas](./schemas) directory.
28
+ 2. Craft your schema by hand.
29
+ 3. Save your changes.
28
30
 
29
- Open your [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
30
-
31
- These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
31
+ These schemas are the heart of a great Harper app, specifying which tables you want and what attributes/fields they should have. Any table you `@export` stands up [REST endpoints automatically](./skills/automatic-rest-apis.md).
32
32
 
33
33
  ### Add Custom Endpoints
34
34
 
35
- The [resources/greeting.ts](./resources/greeting.ts) provides a template for defining TypeScript resource classes, for customized application logic in your endpoints.
35
+ 1. Create a new greeting.ts file in the [resources](./resources) directory.
36
+
37
+ 2. Customize your resource:
38
+
39
+ ```typescript
40
+ import {
41
+ type RecordObject,
42
+ type RequestTargetOrId,
43
+ Resource,
44
+ } from 'harperdb';
45
+
46
+ interface GreetingRecord {
47
+ greeting: string;
48
+ }
49
+
50
+ export class Greeting extends Resource<GreetingRecord> {
51
+ static loadAsInstance = false;
52
+
53
+ async post(
54
+ target: RequestTargetOrId,
55
+ newRecord: Partial<GreetingRecord & RecordObject>,
56
+ ): Promise<GreetingRecord> {
57
+ // By default, only super users can access these endpoints.
58
+ return { greeting: 'Greetings, post!' };
59
+ }
60
+
61
+ async get(target?: RequestTargetOrId): Promise<GreetingRecord> {
62
+ // But if we want anyone to be able to access it, we can turn off the permission checks!
63
+ target.checkPermission = false;
64
+ return { greeting: 'Greetings, get! ' + process.version };
65
+ }
66
+
67
+ async put(
68
+ target: RequestTargetOrId,
69
+ record: GreetingRecord & RecordObject,
70
+ ): Promise<GreetingRecord> {
71
+ target.checkPermission = false;
72
+ if (this.getCurrentUser()?.name?.includes('Coffee')) {
73
+ // You can add your own authorization guards, of course.
74
+ return new Response('Coffee? COFFEE?!', { status: 418 });
75
+ }
76
+ return { greeting: 'Sssssssssssssss!' };
77
+ }
78
+
79
+ async patch(
80
+ target: RequestTargetOrId,
81
+ record: Partial<GreetingRecord & RecordObject>,
82
+ ): Promise<GreetingRecord> {
83
+ return { greeting: 'We can make this work!' };
84
+ }
85
+
86
+ async delete(target: RequestTargetOrId): Promise<boolean> {
87
+ return true;
88
+ }
89
+ }
90
+ ```
91
+
92
+ 3. Save your changes.
36
93
 
37
94
  ### View Your Website
38
95
 
@@ -60,7 +117,7 @@ Take a look at the [default configuration](./config.yaml), which specifies how f
60
117
 
61
118
  When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
62
119
 
63
- Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
120
+ Come back here and configure your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
64
121
 
65
122
  Then you can deploy your app to your cluster:
66
123
 
@@ -0,0 +1,20 @@
1
+ # Deploying to Harper Fabric
2
+
3
+ To deploy your application to Harper Fabric, follow these steps:
4
+
5
+ 1. **Sign up**: Create an account at [https://fabric.harper.fast](https://fabric.harper.fast) and create a cluster.
6
+
7
+ 2. **Configure Environment**: Add your credentials and cluster URL to your `.env` file:
8
+ ```bash
9
+ # Deployments
10
+ CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
11
+ CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
12
+ CLI_TARGET='YOUR_FABRIC.HARPER.FAST_CLUSTER_URL_HERE'
13
+ ```
14
+
15
+ 3. **Deploy Locally**: Run the following command to deploy from your local environment:
16
+ ```bash
17
+ npm run deploy
18
+ ```
19
+
20
+ 4. **Set up CI/CD**: Customize the included `.github/workflow/deploy.yaml` file and define your secrets in your GitHub repository's action settings to enable continuous deployment.
@@ -6,16 +6,17 @@ This repository contains "skills" that guide AI agents in developing Harper appl
6
6
 
7
7
  - [Adding Tables with Schemas](skills/adding-tables-with-schemas.md): Learn how to define schemas and enable automatic REST APIs for your database tables with schema .graphql files in Harper.
8
8
  - [Automatic APIs](skills/automatic-apis.md): Details on the CRUD endpoints automatically generated for exported tables with REST and WebSockets.
9
- - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
10
- - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
9
+ - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
10
+ - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
11
11
  - [Custom Resources](skills/custom-resources.md): How to define custom REST endpoints using JavaScript or TypeScript (Note: Paths are case-sensitive).
12
- - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
13
12
  - [Defining Relationships](skills/defining-relationships.md): Using the `@relationship` directive to link tables.
14
- - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
15
- - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
13
+ - [Deploying to Harper Fabric](skills/deploying-to-harper-fabric.md): Globally scaling your Harper application with our generous Free tier and beyond.
14
+ - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
16
15
  - [Handling Binary Data](skills/handling-binary-data.md): How to store and serve binary data like images or MP3s.
16
+ - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
17
+ - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
18
+ - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
17
19
  - [Serving Web Content](skills/serving-web-content): Two ways to serve web content from a Harper application.
18
- - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
19
- - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
20
+ - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
20
21
  - [Using Blobs](skills/using-blob-datatype.md): How to store and retrieve large data in HarperDB.
21
22
  - [Vector Indexing](skills/vector-indexing.md): How to define and use vector indexes for efficient similarity search.
@@ -22,15 +22,62 @@ npm run dev
22
22
 
23
23
  ### Define Your Schema
24
24
 
25
- The [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
25
+ 1. Create a new yourTableName.graphql file in the [schemas](./schemas) directory.
26
+ 2. Craft your schema by hand.
27
+ 3. Save your changes.
26
28
 
27
- Open your [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
28
-
29
- These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
29
+ These schemas are the heart of a great Harper app, specifying which tables you want and what attributes/fields they should have. Any table you `@export` stands up [REST endpoints automatically](./skills/automatic-rest-apis.md).
30
30
 
31
31
  ### Add Custom Endpoints
32
32
 
33
- The [resources/greeting.js](./resources/greeting.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
33
+ 1. Create a new greeting.js file in the [resources](./resources) directory.
34
+
35
+ 2. Customize your resource:
36
+
37
+ ```javascript
38
+ export class Greeting extends Resource {
39
+ static loadAsInstance = false;
40
+
41
+ async post(
42
+ target,
43
+ newRecord,
44
+ ) {
45
+ // By default, only super users can access these endpoints.
46
+ return { greeting: 'Greetings, post!' };
47
+ }
48
+
49
+ async get(target) {
50
+ // But if we want anyone to be able to access it, we can turn off the permission checks!
51
+ target.checkPermission = false;
52
+ return { greeting: 'Greetings, get! ' + process.version };
53
+ }
54
+
55
+ async put(
56
+ target,
57
+ record,
58
+ ) {
59
+ target.checkPermission = false;
60
+ if (this.getCurrentUser()?.name?.includes('Coffee')) {
61
+ // You can add your own authorization guards, of course.
62
+ return new Response('Coffee? COFFEE?!', { status: 418 });
63
+ }
64
+ return { greeting: 'Sssssssssssssss!' };
65
+ }
66
+
67
+ async patch(
68
+ target,
69
+ record,
70
+ ) {
71
+ return { greeting: 'We can make this work!' };
72
+ }
73
+
74
+ async delete(target) {
75
+ return true;
76
+ }
77
+ }
78
+ ```
79
+
80
+ 3. Save your changes.
34
81
 
35
82
  ### View Your Website
36
83
 
@@ -58,7 +105,7 @@ Take a look at the [default configuration](./config.yaml), which specifies how f
58
105
 
59
106
  When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
60
107
 
61
- Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
108
+ Come back here and configure your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
62
109
 
63
110
  Then you can deploy your app to your cluster:
64
111
 
@@ -0,0 +1,20 @@
1
+ # Deploying to Harper Fabric
2
+
3
+ To deploy your application to Harper Fabric, follow these steps:
4
+
5
+ 1. **Sign up**: Create an account at [https://fabric.harper.fast](https://fabric.harper.fast) and create a cluster.
6
+
7
+ 2. **Configure Environment**: Add your credentials and cluster URL to your `.env` file:
8
+ ```bash
9
+ # Deployments
10
+ CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
11
+ CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
12
+ CLI_TARGET='YOUR_FABRIC.HARPER.FAST_CLUSTER_URL_HERE'
13
+ ```
14
+
15
+ 3. **Deploy Locally**: Run the following command to deploy from your local environment:
16
+ ```bash
17
+ npm run deploy
18
+ ```
19
+
20
+ 4. **Set up CI/CD**: Customize the included `.github/workflow/deploy.yaml` file and define your secrets in your GitHub repository's action settings to enable continuous deployment.
@@ -6,16 +6,17 @@ This repository contains "skills" that guide AI agents in developing Harper appl
6
6
 
7
7
  - [Adding Tables with Schemas](skills/adding-tables-with-schemas.md): Learn how to define schemas and enable automatic REST APIs for your database tables with schema .graphql files in Harper.
8
8
  - [Automatic APIs](skills/automatic-apis.md): Details on the CRUD endpoints automatically generated for exported tables with REST and WebSockets.
9
- - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
10
- - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
9
+ - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
10
+ - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
11
11
  - [Custom Resources](skills/custom-resources.md): How to define custom REST endpoints using JavaScript or TypeScript (Note: Paths are case-sensitive).
12
- - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
13
12
  - [Defining Relationships](skills/defining-relationships.md): Using the `@relationship` directive to link tables.
14
- - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
15
- - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
13
+ - [Deploying to Harper Fabric](skills/deploying-to-harper-fabric.md): Globally scaling your Harper application with our generous Free tier and beyond.
14
+ - [Extending Table Resources](skills/extending-tables.md): Adding custom logic to automatically generated table resources.
16
15
  - [Handling Binary Data](skills/handling-binary-data.md): How to store and serve binary data like images or MP3s.
16
+ - [Programmatic Table Requests](skills/programmatic-table-requests.md): How to use filters, operators, sorting, and pagination in programmatic table requests.
17
+ - [Querying REST APIs](skills/querying-rest-apis.md): How to use filters, operators, sorting, and pagination in REST requests.
18
+ - [Real-time Applications](skills/real-time-apps.md): Implementing WebSockets and Pub/Sub for live data updates.
17
19
  - [Serving Web Content](skills/serving-web-content): Two ways to serve web content from a Harper application.
18
- - [Checking Authentication](skills/checking-authentication.md): How to use sessions to verify user identity and roles.
19
- - [Caching](skills/caching.md): How caching is defined and implemented in Harper applications.
20
+ - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
20
21
  - [Using Blobs](skills/using-blob-datatype.md): How to store and retrieve large data in HarperDB.
21
22
  - [Vector Indexing](skills/vector-indexing.md): How to define and use vector indexes for efficient similarity search.
@@ -24,15 +24,72 @@ TypeScript is supported at runtime in Node.js through [type stripping](https://n
24
24
 
25
25
  ### Define Your Schema
26
26
 
27
- The [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
27
+ 1. Create a new yourTableName.graphql file in the [schemas](./schemas) directory.
28
+ 2. Craft your schema by hand.
29
+ 3. Save your changes.
28
30
 
29
- Open your [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
30
-
31
- These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
31
+ These schemas are the heart of a great Harper app, specifying which tables you want and what attributes/fields they should have. Any table you `@export` stands up [REST endpoints automatically](./skills/automatic-rest-apis.md).
32
32
 
33
33
  ### Add Custom Endpoints
34
34
 
35
- The [resources/greeting.ts](./resources/greeting.ts) provides a template for defining TypeScript resource classes, for customized application logic in your endpoints.
35
+ 1. Create a new greeting.ts file in the [resources](./resources) directory.
36
+
37
+ 2. Customize your resource:
38
+
39
+ ```typescript
40
+ import {
41
+ type RecordObject,
42
+ type RequestTargetOrId,
43
+ Resource,
44
+ } from 'harperdb';
45
+
46
+ interface GreetingRecord {
47
+ greeting: string;
48
+ }
49
+
50
+ export class Greeting extends Resource<GreetingRecord> {
51
+ static loadAsInstance = false;
52
+
53
+ async post(
54
+ target: RequestTargetOrId,
55
+ newRecord: Partial<GreetingRecord & RecordObject>,
56
+ ): Promise<GreetingRecord> {
57
+ // By default, only super users can access these endpoints.
58
+ return { greeting: 'Greetings, post!' };
59
+ }
60
+
61
+ async get(target?: RequestTargetOrId): Promise<GreetingRecord> {
62
+ // But if we want anyone to be able to access it, we can turn off the permission checks!
63
+ target.checkPermission = false;
64
+ return { greeting: 'Greetings, get! ' + process.version };
65
+ }
66
+
67
+ async put(
68
+ target: RequestTargetOrId,
69
+ record: GreetingRecord & RecordObject,
70
+ ): Promise<GreetingRecord> {
71
+ target.checkPermission = false;
72
+ if (this.getCurrentUser()?.name?.includes('Coffee')) {
73
+ // You can add your own authorization guards, of course.
74
+ return new Response('Coffee? COFFEE?!', { status: 418 });
75
+ }
76
+ return { greeting: 'Sssssssssssssss!' };
77
+ }
78
+
79
+ async patch(
80
+ target: RequestTargetOrId,
81
+ record: Partial<GreetingRecord & RecordObject>,
82
+ ): Promise<GreetingRecord> {
83
+ return { greeting: 'We can make this work!' };
84
+ }
85
+
86
+ async delete(target: RequestTargetOrId): Promise<boolean> {
87
+ return true;
88
+ }
89
+ }
90
+ ```
91
+
92
+ 3. Save your changes.
36
93
 
37
94
  ### View Your Website
38
95
 
@@ -60,7 +117,7 @@ Take a look at the [default configuration](./config.yaml), which specifies how f
60
117
 
61
118
  When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
62
119
 
63
- Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
120
+ Come back here and configure your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
64
121
 
65
122
  Then you can deploy your app to your cluster:
66
123
 
@@ -0,0 +1,20 @@
1
+ # Deploying to Harper Fabric
2
+
3
+ To deploy your application to Harper Fabric, follow these steps:
4
+
5
+ 1. **Sign up**: Create an account at [https://fabric.harper.fast](https://fabric.harper.fast) and create a cluster.
6
+
7
+ 2. **Configure Environment**: Add your credentials and cluster URL to your `.env` file:
8
+ ```bash
9
+ # Deployments
10
+ CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
11
+ CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
12
+ CLI_TARGET='YOUR_FABRIC.HARPER.FAST_CLUSTER_URL_HERE'
13
+ ```
14
+
15
+ 3. **Deploy Locally**: Run the following command to deploy from your local environment:
16
+ ```bash
17
+ npm run deploy
18
+ ```
19
+
20
+ 4. **Set up CI/CD**: Customize the included `.github/workflow/deploy.yaml` file and define your secrets in your GitHub repository's action settings to enable continuous deployment.