@harperfast/template-react-studio 1.2.2 → 1.3.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.
Files changed (41) hide show
  1. package/.agents/skills/harper-best-practices/AGENTS.md +258 -0
  2. package/.agents/skills/harper-best-practices/SKILL.md +88 -0
  3. package/.agents/skills/harper-best-practices/rules/adding-tables-with-schemas.md +40 -0
  4. package/.agents/skills/harper-best-practices/rules/automatic-apis.md +34 -0
  5. package/.agents/skills/harper-best-practices/rules/caching.md +46 -0
  6. package/.agents/skills/harper-best-practices/rules/checking-authentication.md +165 -0
  7. package/.agents/skills/harper-best-practices/rules/custom-resources.md +35 -0
  8. package/.agents/skills/harper-best-practices/rules/defining-relationships.md +33 -0
  9. package/.agents/skills/harper-best-practices/rules/deploying-to-harper-fabric.md +24 -0
  10. package/.agents/skills/harper-best-practices/rules/extending-tables.md +37 -0
  11. package/.agents/skills/harper-best-practices/rules/handling-binary-data.md +43 -0
  12. package/.agents/skills/harper-best-practices/rules/programmatic-table-requests.md +39 -0
  13. package/.agents/skills/harper-best-practices/rules/querying-rest-apis.md +22 -0
  14. package/.agents/skills/harper-best-practices/rules/real-time-apps.md +37 -0
  15. package/.agents/skills/harper-best-practices/rules/serving-web-content.md +34 -0
  16. package/.agents/skills/harper-best-practices/rules/typescript-type-stripping.md +32 -0
  17. package/.agents/skills/harper-best-practices/rules/using-blob-datatype.md +36 -0
  18. package/.agents/skills/harper-best-practices/rules/vector-indexing.md +152 -0
  19. package/README.md +1 -1
  20. package/package.json +1 -1
  21. package/resources/README.md +3 -3
  22. package/schemas/README.md +2 -2
  23. package/skills-lock.json +10 -0
  24. package/AGENTS.md +0 -22
  25. package/skills/adding-tables-with-schemas.md +0 -34
  26. package/skills/automatic-apis.md +0 -53
  27. package/skills/automatic-rest-apis.md +0 -41
  28. package/skills/caching.md +0 -113
  29. package/skills/checking-authentication.md +0 -281
  30. package/skills/custom-resources.md +0 -86
  31. package/skills/defining-relationships.md +0 -71
  32. package/skills/deploying-to-harper-fabric.md +0 -20
  33. package/skills/extending-tables.md +0 -70
  34. package/skills/handling-binary-data.md +0 -67
  35. package/skills/programmatic-table-requests.md +0 -185
  36. package/skills/querying-rest-apis.md +0 -69
  37. package/skills/real-time-apps.md +0 -75
  38. package/skills/serving-web-content.md +0 -82
  39. package/skills/typescript-type-stripping.md +0 -47
  40. package/skills/using-blob-datatype.md +0 -131
  41. package/skills/vector-indexing.md +0 -215
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: defining-relationships
3
+ description: How to define and use relationships between tables in Harper using GraphQL.
4
+ ---
5
+
6
+ # Defining Relationships
7
+
8
+ Instructions for the agent to follow when defining relationships between Harper tables.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to link data across different tables, enabling automatic joins and efficient related-data fetching via REST APIs.
13
+
14
+ ## Steps
15
+
16
+ 1. **Identify the Relationship Type**: Determine if it's one-to-one, many-to-one, or one-to-many.
17
+ 2. **Use the `@relationship` Directive**: Apply it to a field in your GraphQL schema.
18
+ - **Many-to-One (Current table holds FK)**: Use `from`.
19
+ ```graphql
20
+ type Book @table @export {
21
+ authorId: ID
22
+ author: Author @relationship(from: "authorId")
23
+ }
24
+ ```
25
+ - **One-to-Many (Related table holds FK)**: Use `to` and an array type.
26
+ ```graphql
27
+ type Author @table @export {
28
+ books: [Book] @relationship(to: "authorId")
29
+ }
30
+ ```
31
+ 3. **Query with Relationships**: Use dot syntax in REST API calls for filtering or the `select()` operator for including related data.
32
+ - Example Filter: `GET /Book/?author.name=Harper`
33
+ - Example Select: `GET /Author/?select(name,books(title))`
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: deploying-to-harper-fabric
3
+ description: How to deploy a Harper application to the Harper Fabric cloud.
4
+ ---
5
+
6
+ # Deploying to Harper Fabric
7
+
8
+ Instructions for the agent to follow when deploying to Harper Fabric.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you are ready to move your Harper application from local development to a cloud-hosted environment.
13
+
14
+ ## Steps
15
+
16
+ 1. **Sign up**: Create an account at [https://fabric.harper.fast/](https://fabric.harper.fast/) and create a cluster.
17
+ 2. **Configure Environment**: Add your cluster credentials and cluster application URL to `.env`:
18
+ ```bash
19
+ CLI_TARGET_USERNAME='YOUR_CLUSTER_USERNAME'
20
+ CLI_TARGET_PASSWORD='YOUR_CLUSTER_PASSWORD'
21
+ CLI_TARGET='YOUR_CLUSTER_URL'
22
+ ```
23
+ 3. **Deploy From Local Environment**: Run `npm run deploy`.
24
+ 4. **Set up CI/CD**: Configure `.github/workflows/deploy.yaml` and set repository secrets for automated deployments.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: extending-tables
3
+ description: How to add custom logic to automatically generated table resources in Harper.
4
+ ---
5
+
6
+ # Extending Tables
7
+
8
+ Instructions for the agent to follow when extending table resources in Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to add custom validation, side effects (like webhooks), data transformation, or custom access control to the standard CRUD operations of a Harper table.
13
+
14
+ ## Steps
15
+
16
+ 1. **Define the Table in GraphQL**: In your `.graphql` schema, define the table using the `@table` directive. **Do not** use `@export` if you plan to extend it.
17
+ ```graphql
18
+ type MyTable @table {
19
+ id: ID @primaryKey
20
+ name: String
21
+ }
22
+ ```
23
+ 2. **Create the Extension File**: Create a `.ts` file in your `resources/` directory.
24
+ 3. **Extend the Table Resource**: Export a class that extends `tables.YourTableName`:
25
+ ```typescript
26
+ import { type RequestTargetOrId, tables } from 'harperdb';
27
+
28
+ export class MyTable extends tables.MyTable {
29
+ async post(target: RequestTargetOrId, record: any) {
30
+ // Custom logic here
31
+ if (!record.name) { throw new Error('Name required'); }
32
+ return super.post(target, record);
33
+ }
34
+ }
35
+ ```
36
+ 4. **Override Methods**: Override `get`, `post`, `put`, `patch`, or `delete` as needed. Always call `super[method]` to maintain default Harper functionality unless you intend to replace it entirely.
37
+ 5. **Implement Logic**: Use overrides for validation, side effects, or transforming data before/after database operations.
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: handling-binary-data
3
+ description: How to store and serve binary data like images or audio in Harper.
4
+ ---
5
+
6
+ # Handling Binary Data
7
+
8
+ Instructions for the agent to follow when handling binary data in Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to store binary files (images, audio, etc.) in the database or serve them back to clients via REST endpoints.
13
+
14
+ ## Steps
15
+
16
+ 1. **Store Base64 as Blobs**: In your resource's `post` or `put` method, convert incoming base64 strings to Buffers and then to Blobs using `createBlob`:
17
+ ```typescript
18
+ import { createBlob } from 'harperdb';
19
+
20
+ async post(target, record) {
21
+ if (record.data) {
22
+ record.data = createBlob(Buffer.from(record.data, 'base64'), {
23
+ type: 'image/jpeg',
24
+ });
25
+ }
26
+ return super.post(target, record);
27
+ }
28
+ ```
29
+ 2. **Serve Binary Data**: In your resource's `get` method, return a response object with the appropriate `Content-Type` and the binary data in the `body`:
30
+ ```typescript
31
+ async get(target) {
32
+ const record = await super.get(target);
33
+ if (record?.data) {
34
+ return {
35
+ status: 200,
36
+ headers: { 'Content-Type': 'image/jpeg' },
37
+ body: record.data,
38
+ };
39
+ }
40
+ return record;
41
+ }
42
+ ```
43
+ 3. **Use the Blob Type**: Ensure your GraphQL schema uses the `Blob` scalar for binary fields.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: programmatic-table-requests
3
+ description: How to interact with Harper tables programmatically using the `tables` object.
4
+ ---
5
+
6
+ # Programmatic Table Requests
7
+
8
+ Instructions for the agent to follow when interacting with Harper tables via code.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to perform database operations (CRUD, search, subscribe) from within Harper Resources or scripts.
13
+
14
+ ## Steps
15
+
16
+ 1. **Access the Table**: Use the global `tables` object followed by your table name (e.g., `tables.MyTable`).
17
+ 2. **Perform CRUD Operations**:
18
+ - **Get**: `await tables.MyTable.get(id)` for a single record or `await tables.MyTable.get({ conditions: [...] })` for multiple.
19
+ - **Create**: `await tables.MyTable.post(record)` (auto-generates ID) or `await tables.MyTable.put(id, record)`.
20
+ - **Update**: `await tables.MyTable.patch(id, partialRecord)` for partial updates.
21
+ - **Delete**: `await tables.MyTable.delete(id)`.
22
+ 3. **Use Updatable Records for Atomic Ops**: Call `update(id)` to get a reference, then use `addTo` or `subtractFrom` for atomic increments/decrements:
23
+ ```typescript
24
+ const stats = await tables.Stats.update('daily');
25
+ stats.addTo('viewCount', 1);
26
+ ```
27
+ 4. **Search and Stream**: Use `search(query)` for efficient streaming of large result sets:
28
+ ```typescript
29
+ for await (const record of tables.MyTable.search({ conditions: [...] })) {
30
+ // process record
31
+ }
32
+ ```
33
+ 5. **Real-time Subscriptions**: Use `subscribe(query)` to listen for changes:
34
+ ```typescript
35
+ for await (const event of tables.MyTable.subscribe(query)) {
36
+ // handle event
37
+ }
38
+ ```
39
+ 6. **Publish Events**: Use `publish(id, message)` to trigger subscriptions without necessarily persisting data.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: querying-rest-apis
3
+ description: How to use query parameters to filter, sort, and paginate Harper REST APIs.
4
+ ---
5
+
6
+ # Querying REST APIs
7
+
8
+ Instructions for the agent to follow when querying Harper's REST APIs.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to perform advanced data retrieval (filtering, sorting, pagination, joins) using Harper's automatic REST endpoints.
13
+
14
+ ## Steps
15
+
16
+ 1. **Basic Filtering**: Use attribute names as query parameters: `GET /Table/?key=value`.
17
+ 2. **Use Comparison Operators**: Append operators like `gt`, `ge`, `lt`, `le`, `ne` using FIQL-style syntax: `GET /Table/?price=gt=100`.
18
+ 3. **Apply Logic and Grouping**: Use `&` for AND, `|` for OR, and `()` for grouping: `GET /Table/?(rating=5|featured=true)&price=lt=50`.
19
+ 4. **Select Specific Fields**: Use `select()` to limit returned attributes: `GET /Table/?select(name,price)`.
20
+ 5. **Paginate Results**: Use `limit(count)` or `limit(offset, count)`: `GET /Table/?limit(20, 10)`.
21
+ 6. **Sort Results**: Use `sort()` with `+` (asc) or `-` (desc): `GET /Table/?sort(-price,+name)`.
22
+ 7. **Query Relationships**: Use dot syntax for tables linked with `@relationship`: `GET /Book/?author.name=Harper`.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: real-time-apps
3
+ description: How to build real-time features in Harper using WebSockets and Pub/Sub.
4
+ ---
5
+
6
+ # Real-time Applications
7
+
8
+ Instructions for the agent to follow when building real-time applications in Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to stream live updates to clients, implement chat features, or provide real-time data synchronization between the database and a frontend.
13
+
14
+ ## Steps
15
+
16
+ 1. **Check Automatic WebSockets**: If you only need to stream table changes, use [Automatic APIs](automatic-apis.md) which provide a WebSocket endpoint for every `@export`ed table.
17
+ 2. **Implement `connect` in a Resource**: For custom bi-directional logic, implement the `connect` method:
18
+ ```typescript
19
+ import { Resource, tables } from 'harperdb';
20
+
21
+ export class MySocket extends Resource {
22
+ async *connect(target, incomingMessages) {
23
+ // Subscribe to table changes
24
+ const subscription = await tables.MyTable.subscribe(target);
25
+ if (!incomingMessages) { return subscription; // SSE mode
26
+ }
27
+
28
+ // Handle incoming client messages
29
+ for await (let message of incomingMessages) {
30
+ yield { received: message };
31
+ }
32
+ }
33
+ }
34
+ ```
35
+ 3. **Use Pub/Sub**: Use `tables.TableName.subscribe(query)` to listen for specific data changes and stream them to the client.
36
+ 4. **Handle SSE**: Ensure your `connect` method gracefully handles cases where `incomingMessages` is null (Server-Sent Events).
37
+ 5. **Connect from Client**: Use standard WebSockets (`new WebSocket('ws://...')`) to connect to your resource endpoint.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: serving-web-content
3
+ description: How to serve static files and integrated Vite/React applications in Harper.
4
+ ---
5
+
6
+ # Serving Web Content
7
+
8
+ Instructions for the agent to follow when serving web content from Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to serve a frontend (HTML, CSS, JS, or a React app) directly from your Harper instance.
13
+
14
+ ## Steps
15
+
16
+ 1. **Choose a Method**: Decide between the simple Static Plugin or the integrated Vite Plugin.
17
+ 2. **Option A: Static Plugin (Simple)**:
18
+ - Add to `config.yaml`:
19
+ ```yaml
20
+ static:
21
+ files: 'web/*'
22
+ ```
23
+ - Place files in a `web/` folder in the project root.
24
+ - Files are served at the root URL (e.g., `http://localhost:9926/index.html`).
25
+ 3. **Option B: Vite Plugin (Advanced/Development)**:
26
+ - Add to `config.yaml`:
27
+ ```yaml
28
+ '@harperfast/vite-plugin':
29
+ package: '@harperfast/vite-plugin'
30
+ ```
31
+ - Ensure `vite.config.ts` and `index.html` are in the project root.
32
+ - Install dependencies: `npm install --save-dev vite @harperfast/vite-plugin`.
33
+ - Use `npm run dev` for development with HMR.
34
+ 4. **Deploy for Production**: For Vite apps, use a build script to generate static files into a `web/` folder and deploy them using the static handler pattern.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: typescript-type-stripping
3
+ description: How to run TypeScript files directly in Harper without a build step.
4
+ ---
5
+
6
+ # TypeScript Type Stripping
7
+
8
+ Instructions for the agent to follow when using TypeScript in Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you want to write Harper Resources in TypeScript and have them execute directly in Node.js without an intermediate build or compilation step.
13
+
14
+ ## Steps
15
+
16
+ 1. **Verify Node.js Version**: Ensure you are using Node.js v22.6.0 or higher.
17
+ 2. **Name Files with `.ts`**: Create your resource files in the `resources/` directory with a `.ts` extension.
18
+ 3. **Use TypeScript Syntax**: Write your resource classes using standard TypeScript (interfaces, types, etc.).
19
+ ```typescript
20
+ import { Resource } from 'harperdb';
21
+ export class MyResource extends Resource {
22
+ async get(): Promise<{ message: string }> {
23
+ return { message: 'Running TS directly!' };
24
+ }
25
+ }
26
+ ```
27
+ 4. **Use Explicit Extensions in Imports**: When importing other local modules, include the `.ts` extension: `import { helper } from './helper.ts'`.
28
+ 5. **Configure `config.yaml`**: Ensure `jsResource` points to your `.ts` files:
29
+ ```yaml
30
+ jsResource:
31
+ files: 'resources/*.ts'
32
+ ```
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: using-blob-datatype
3
+ description: How to use the Blob data type for efficient binary storage in Harper.
4
+ ---
5
+
6
+ # Using Blob Datatype
7
+
8
+ Instructions for the agent to follow when working with the Blob data type in Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to store unstructured or large binary data (media, documents) that is too large for standard JSON fields. Blobs provide efficient storage and integrated streaming support.
13
+
14
+ ## Steps
15
+
16
+ 1. **Define Blob Fields**: In your GraphQL schema, use the `Blob` type:
17
+ ```graphql
18
+ type MyTable @table {
19
+ id: ID @primaryKey
20
+ data: Blob
21
+ }
22
+ ```
23
+ 2. **Create and Store Blobs**: Use `createBlob()` from `harperdb` to wrap Buffers or Streams:
24
+ ```javascript
25
+ import { createBlob, tables } from 'harperdb';
26
+ const blob = createBlob(largeBuffer);
27
+ await tables.MyTable.put('my-id', { data: blob });
28
+ ```
29
+ 3. **Use Streaming (Optional)**: For very large files, pass a stream to `createBlob()` to avoid loading the entire file into memory.
30
+ 4. **Read Blob Data**: Retrieve the record and use `.bytes()` or streaming interfaces on the blob field:
31
+ ```javascript
32
+ const record = await tables.MyTable.get('my-id');
33
+ const buffer = await record.data.bytes();
34
+ ```
35
+ 5. **Ensure Write Completion**: Use `saveBeforeCommit: true` in `createBlob` options if you need the blob fully written before the record is committed.
36
+ 6. **Handle Errors**: Attach error listeners to the blob object to handle streaming failures.
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: vector-indexing
3
+ description: How to enable and query vector indexes for similarity search in Harper.
4
+ ---
5
+
6
+ # Vector Indexing
7
+
8
+ Instructions for the agent to follow when implementing vector search in Harper.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when you need to perform similarity searches on high-dimensional data, such as AI embeddings for semantic search, recommendations, or image retrieval.
13
+
14
+ ## Steps
15
+
16
+ 1. **Enable Vector Indexing**: In your GraphQL schema, add `@indexed(type: "HNSW")` to a numeric array field:
17
+ ```graphql
18
+ type Product @table {
19
+ id: ID @primaryKey
20
+ textEmbeddings: [Float] @indexed(type: "HNSW")
21
+ }
22
+ ```
23
+ 2. **Configure Index Options (Optional)**: Fine-tune the index with parameters like `distance` (`cosine` or `euclidean`), `M`, and `efConstruction`.
24
+ 3. **Query with Vector Search**: Use `tables.Table.search()` with a `sort` object containing the `target` vector:
25
+ ```javascript
26
+ const results = await tables.Product.search({
27
+ select: ['name', '$distance'],
28
+ sort: {
29
+ attribute: 'textEmbeddings',
30
+ target: [0.1, 0.2, ...], // query vector
31
+ },
32
+ limit: 5,
33
+ });
34
+ ```
35
+ 4. **Filter by Distance**: Use `conditions` with a `target` vector and a `comparator` (e.g., `lt`) to return results within a similarity threshold:
36
+ ```javascript
37
+ const results = await tables.Product.search({
38
+ conditions: {
39
+ attribute: 'textEmbeddings',
40
+ comparator: 'lt',
41
+ value: 0.1,
42
+ target: searchVector,
43
+ },
44
+ });
45
+ ```
46
+ 5. **Generate Embeddings**: Use external services (OpenAI, Ollama) to generate the numeric vectors before storing or searching them in Harper.
47
+
48
+ const { Product } = tables;
49
+
50
+ import OpenAI from 'openai';
51
+ const openai = new OpenAI();
52
+ // the name of the OpenAI embedding model
53
+ const OPENAI_EMBEDDING_MODEL = 'text-embedding-3-small';
54
+
55
+ const SIMILARITY_THRESHOLD = 0.5;
56
+
57
+ export class ProductSearch extends Resource {
58
+ // based on env variable we choose the appropriate embedding generator
59
+ generateEmbedding = process.env.EMBEDDING_GENERATOR === 'ollama'
60
+ ? this._generateOllamaEmbedding
61
+ : this._generateOpenAIEmbedding;
62
+
63
+ /**
64
+ * Executes a search query using a generated text embedding and returns the matching products.
65
+ *
66
+ * @param {Object} data - The input data for the request.
67
+ * @param {string} data.prompt - The prompt to generate the text embedding from.
68
+ * @return {Promise<Array>} Returns a promise that resolves to an array of products matching the conditions,
69
+ * including fields: name, description, price, and $distance.
70
+ */
71
+ async post(data) {
72
+ const embedding = await this.generateEmbedding(data.prompt);
73
+
74
+ return await Product.search({
75
+ select: ['name', 'description', 'price', '$distance'],
76
+ conditions: {
77
+ attribute: 'textEmbeddings',
78
+ comparator: 'lt',
79
+ value: SIMILARITY_THRESHOLD,
80
+ target: embedding[0],
81
+ },
82
+ limit: 5,
83
+ });
84
+ }
85
+
86
+ /**
87
+ * Generates an embedding using the Ollama API.
88
+ *
89
+ * @param {string} promptData - The input data for which the embedding is to be generated.
90
+ * @return {Promise<number[][]>} A promise that resolves to the generated embedding as an array of numbers.
91
+ */
92
+ async _generateOllamaEmbedding(promptData) {
93
+ const embedding = await ollama.embed({
94
+ model: OLLAMA_EMBEDDING_MODEL,
95
+ input: promptData,
96
+ });
97
+ return embedding?.embeddings;
98
+ }
99
+
100
+ /**
101
+ * Generates OpenAI embeddings based on the given prompt data.
102
+ *
103
+ * @param {string} promptData - The input data used for generating the embedding.
104
+ * @return {Promise<number[][]>} A promise that resolves to an array of embeddings, where each embedding is an array of floats.
105
+ */
106
+ async _generateOpenAIEmbedding(promptData) {
107
+ const embedding = await openai.embeddings.create({
108
+ model: OPENAI_EMBEDDING_MODEL,
109
+ input: promptData,
110
+ encoding_format: 'float',
111
+ });
112
+
113
+ let embeddings = [];
114
+ embedding.data.forEach((embeddingData) => {
115
+ embeddings.push(embeddingData.embedding);
116
+ });
117
+
118
+ return embeddings;
119
+ }
120
+
121
+ }
122
+
123
+ ````
124
+ Sample request to the `ProductSearch` resource which prompts to find "shorts for the gym":
125
+
126
+ ```bash
127
+ curl -X POST "http://localhost:9926/ProductSearch/" \
128
+ -H "accept: \
129
+ -H "Content-Type: application/json" \
130
+ -H "Authorization: Basic <YOUR_AUTH>" \
131
+ -d '{"prompt": "shorts for the gym"}'
132
+ ````
133
+
134
+ ---
135
+
136
+ ## When to Use Vector Indexing
137
+
138
+ Vector indexing is ideal when:
139
+
140
+ - Storing embedding vectors from ML models
141
+ - Performing semantic or similarity-based search
142
+ - Working with high-dimensional numeric data
143
+ - Exact-match indexes are insufficient
144
+
145
+ ---
146
+
147
+ ## Summary
148
+
149
+ - Vector indexing enables fast similarity search on numeric arrays
150
+ - Defined using `@indexed(type: "HNSW")`
151
+ - Queried using a target vector in search sorting
152
+ - Tunable for performance and accuracy
package/README.md CHANGED
@@ -11,7 +11,7 @@ Here's what you should do next:
11
11
  3. Save your changes.
12
12
  4. Tap "Restart Cluster" and your changes will be live!
13
13
 
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).
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 [endpoints automatically](./.agents/skills/harper-best-practices/rules/automatic-apis.md).
15
15
 
16
16
  ### Add Custom Endpoints
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harperfast/template-react-studio",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "repository": "github:HarperFast/create-harper",
6
6
  "scripts": {},
@@ -1,11 +1,11 @@
1
1
  # Resources
2
2
 
3
- The [schemas you define in .GraphQL files](../skills/adding-tables-with-schemas.md) will [automatically stand-up REST APIs](../skills/automatic-apis.md).
3
+ The [schemas you define in .GraphQL files](../.agents/skills/harper-best-practices/rules/adding-tables-with-schemas.md) will [automatically stand-up REST APIs](../.agents/skills/harper-best-practices/rules/automatic-apis.md).
4
4
 
5
- But you can [extend your tables with custom logic](../skills/extending-tables.md) and [create your own resources](../skills/custom-resources.md) in this directory.
5
+ But you can [extend your tables with custom logic](../.agents/skills/harper-best-practices/rules/extending-tables.md) and [create your own resources](../.agents/skills/harper-best-practices/rules/custom-resources.md) in this directory.
6
6
 
7
7
  ## Want to read more?
8
8
 
9
9
  Check out the rest of the "skills" documentation!
10
10
 
11
- [AGENTS.md](../AGENTS.md)
11
+ [Harper Best Practices Skill](../.agents/skills/harper-best-practices/SKILL.md)
package/schemas/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Your schemas are defined in `.graphql` files within this `schemas` directory. These files contain the structure and types for your database tables, allowing Harper to automatically generate REST APIs for CRUD operations.
4
4
 
5
- Take a look at the [Adding Tables with Schemas](../skills/adding-tables-with-schemas.md) to learn more!
5
+ Take a look at the [Adding Tables with Schemas](../.agents/skills/harper-best-practices/rules/adding-tables-with-schemas.md) to learn more!
6
6
 
7
7
  ## Want to read more?
8
8
 
9
9
  Check out the rest of the "skills" documentation!
10
10
 
11
- [AGENTS.md](../AGENTS.md)
11
+ [Harper Best Practices Skill](../.agents/skills/harper-best-practices/SKILL.md)
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "skills": {
4
+ "harper-best-practices": {
5
+ "source": "harperfast/skills",
6
+ "sourceType": "github",
7
+ "computedHash": "60af017817f78d6ef938b03b5ed9b301dd71655804c3ec43cf8b5a9e3109acd2"
8
+ }
9
+ }
10
+ }
package/AGENTS.md DELETED
@@ -1,22 +0,0 @@
1
- # Harper Agent Skills
2
-
3
- This repository contains "skills" that guide AI agents in developing Harper applications.
4
-
5
- ## Available Skills
6
-
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
- - [Automatic APIs](skills/automatic-apis.md): Details on the CRUD endpoints automatically generated for exported tables with REST and WebSockets.
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
- - [Custom Resources](skills/custom-resources.md): How to define custom REST endpoints using JavaScript or TypeScript (Note: Paths are case-sensitive).
12
- - [Defining Relationships](skills/defining-relationships.md): Using the `@relationship` directive to link tables.
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.
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.
19
- - [Serving Web Content](skills/serving-web-content): Two ways to serve web content from a Harper application.
20
- - [TypeScript Type Stripping](skills/typescript-type-stripping.md): Using TypeScript directly without build tools via Node.js Type Stripping.
21
- - [Using Blobs](skills/using-blob-datatype.md): How to store and retrieve large data in HarperDB.
22
- - [Vector Indexing](skills/vector-indexing.md): How to define and use vector indexes for efficient similarity search.
@@ -1,34 +0,0 @@
1
- # Adding Tables to Harper
2
-
3
- To add tables to a Harper database, follow these guidelines:
4
-
5
- 1. **Dedicated Schema Files**: Prefer having a dedicated schema `.graphql` file for each table. Check the `config.yaml` file under `graphqlSchema.files` to see how it's configured. It typically accepts wildcards (e.g., `schemas/*.graphql`), but may be configured to point at a single file.
6
-
7
- 2. **Directives**: All available directives for defining your schema are defined in `node_modules/harperdb/schema.graphql`. Common directives include `@table`, `@export`, `@primaryKey`, `@indexed`, and `@relationship`.
8
-
9
- 3. **Defining Relationships**: You can link tables together using the `@relationship` directive. For more details, see the [Defining Relationships](defining-relationships.md) skill.
10
-
11
- 4. **Automatic APIs**: If you add `@table @export` to a schema type, Harper automatically sets up REST and WebSocket APIs for basic CRUD operations against that table. For a detailed list of available endpoints and how to use them, see the [Automatic REST APIs](automatic-apis.md) skill.
12
-
13
- - `GET /{TableName}`: Describes the schema itself.
14
- - `GET /{TableName}/`: Lists all records (supports filtering, sorting, and pagination via query parameters). See the [Querying REST APIs](querying-rest-apis.md) skill for details.
15
- - `GET /{TableName}/{id}`: Retrieves a single record by its ID.
16
- - `POST /{TableName}/`: Creates a new record.
17
- - `PUT /{TableName}/{id}`: Updates an existing record.
18
- - `PATCH /{TableName}/{id}`: Performs a partial update on a record.
19
- - `DELETE /{TableName}/`: Deletes all records or filtered records.
20
- - `DELETE /{TableName}/{id}`: Deletes a single record by its ID.
21
-
22
- ### Example
23
-
24
- In `schemas/ExamplePerson.graphql`:
25
-
26
- ```graphql
27
- type ExamplePerson @table @export {
28
- id: ID @primaryKey
29
- name: String
30
- tag: String @indexed
31
- }
32
- ```
33
-
34
- Tip: if you are going to [extend the table](./extending-tables.md) in your resources, then do not `@export` the table from the schema.