@harperfast/template-react-studio 0.13.1 → 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/AGENTS.md CHANGED
@@ -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.
package/README.md CHANGED
@@ -6,17 +6,64 @@ Here's what you should do next:
6
6
 
7
7
  ### Define Your Schema
8
8
 
9
- Tap [+ New Table](./schemas/examplePeople.graphql?ShowNewTableModal=true) when viewing a schema file, and you'll be guided through the available options.
9
+ 1. Create a new [yourTableName.graphql](./schemas?ShowAddDirectoryOrFileModalType=file) file in the [schemas](./schemas) directory.
10
+ 2. Craft your schema by hand or tap "+ New Table" in the action bar for a bit of guidance.
11
+ 3. Save your changes.
12
+ 4. Tap "Restart Cluster" and your changes will be live!
10
13
 
11
- The [schemas/examplePeople.graphql](./schemas/examplePeople.graphql) is an example table schema definition. This is the main starting point for defining your [database schema](./databases), specifying which tables you want and what attributes/fields they should have.
12
-
13
- 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.
14
-
15
- These schemas are the heart of a great Harper app. This is the main starting point for defining your [database schema](./databases), specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
14
+ 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).
16
15
 
17
16
  ### Add Custom Endpoints
18
17
 
19
- The [resources/greeting.js](./resources/greeting.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
18
+ 1. Create a new [greeting.js](./resources?ShowAddDirectoryOrFileModalType=file) file in the [resources](./resources) directory.
19
+
20
+ 2. Customize your resource:
21
+
22
+ ```javascript
23
+ export class Greeting extends Resource {
24
+ static loadAsInstance = false;
25
+
26
+ async post(
27
+ target,
28
+ newRecord,
29
+ ) {
30
+ // By default, only super users can access these endpoints.
31
+ return { greeting: 'Greetings, post!' };
32
+ }
33
+
34
+ async get(target) {
35
+ // But if we want anyone to be able to access it, we can turn off the permission checks!
36
+ target.checkPermission = false;
37
+ return { greeting: 'Greetings, get! ' + process.version };
38
+ }
39
+
40
+ async put(
41
+ target,
42
+ record,
43
+ ) {
44
+ target.checkPermission = false;
45
+ if (this.getCurrentUser()?.name?.includes('Coffee')) {
46
+ // You can add your own authorization guards, of course.
47
+ return new Response('Coffee? COFFEE?!', { status: 418 });
48
+ }
49
+ return { greeting: 'Sssssssssssssss!' };
50
+ }
51
+
52
+ async patch(
53
+ target,
54
+ record,
55
+ ) {
56
+ return { greeting: 'We can make this work!' };
57
+ }
58
+
59
+ async delete(target) {
60
+ return true;
61
+ }
62
+ }
63
+ ```
64
+
65
+ 3. Save your changes.
66
+ 4. Tap "Restart Cluster" and your changes will be live!
20
67
 
21
68
  ### View Your Website
22
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harperfast/template-react-studio",
3
- "version": "0.13.1",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "repository": "github:HarperFast/create-harper",
6
6
  "scripts": {},
@@ -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.