@tsproxy/api 0.0.1 → 0.0.2

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 (2) hide show
  1. package/README.md +69 -0
  2. package/package.json +13 -11
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @tsproxy/api
2
+
3
+ HonoJS proxy server for [Typesense](https://typesense.org) with caching, rate limiting, and a BullMQ ingestion queue.
4
+
5
+ > **This project is under heavy development.**
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @tsproxy/api
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Create a `tsproxy.config.ts`:
16
+
17
+ ```ts
18
+ import { defineConfig } from "@tsproxy/api";
19
+
20
+ export default defineConfig({
21
+ typesense: {
22
+ host: "localhost",
23
+ port: 8108,
24
+ apiKey: "your-api-key",
25
+ },
26
+ server: { port: 3000, apiKey: "your-ingest-secret" },
27
+ cache: { ttl: 60, maxSize: 1000 },
28
+ queue: { concurrency: 5, maxSize: 10000 },
29
+ rateLimit: { search: 100, ingest: 30 },
30
+ collections: {
31
+ products: {
32
+ fields: {
33
+ name: { type: "string", searchable: true },
34
+ price: { type: "float", sortable: true },
35
+ category: { type: "string", facet: true },
36
+ },
37
+ },
38
+ },
39
+ });
40
+ ```
41
+
42
+ ## Endpoints
43
+
44
+ | Method | Path | Auth | Description |
45
+ |--------|------|------|-------------|
46
+ | `POST` | `/api/search` | No | InstantSearch-compatible multi-search |
47
+ | `GET` | `/api/health` | No | Health check (Typesense + Redis) |
48
+ | `POST` | `/api/ingest/:collection/documents` | Yes | Upsert document |
49
+ | `POST` | `/api/ingest/:collection/documents/import` | Yes | Bulk import |
50
+ | `PATCH` | `/api/ingest/:collection/documents/:id` | Yes | Partial update |
51
+ | `DELETE` | `/api/ingest/:collection/documents/:id` | Yes | Delete document |
52
+ | `GET` | `/api/ingest/queue/status` | Yes | Queue stats |
53
+
54
+ ## Features
55
+
56
+ - LRU cache with configurable TTL (error-aware — never caches failures)
57
+ - Per-IP rate limiting
58
+ - BullMQ queue (Redis) with in-memory fallback
59
+ - Computed fields during ingestion
60
+ - Multilingual collection routing
61
+ - Config file with `defineConfig`
62
+
63
+ ## Documentation
64
+
65
+ [tsproxy.akshit.io](https://tsproxy.akshit.io)
66
+
67
+ ## License
68
+
69
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsproxy/api",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "HonoJS proxy server for Typesense with caching, rate limiting, and ingestion queue",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,14 +8,16 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
12
13
  }
13
14
  },
14
15
  "bin": {
15
16
  "tsproxy-server": "./dist/cli.js"
16
17
  },
17
18
  "files": [
18
- "dist"
19
+ "dist",
20
+ "README.md"
19
21
  ],
20
22
  "publishConfig": {
21
23
  "access": "public"
@@ -34,6 +36,13 @@
34
36
  "cache",
35
37
  "rate-limit"
36
38
  ],
39
+ "scripts": {
40
+ "dev": "tsx watch src/cli.ts dev",
41
+ "build": "tsup src/index.ts src/server.ts src/cli.ts --format esm --dts --tsconfig tsconfig.build.json",
42
+ "start": "node dist/cli.js start",
43
+ "test": "vitest run",
44
+ "typecheck": "tsc --noEmit"
45
+ },
37
46
  "dependencies": {
38
47
  "@hono/node-server": "^1.13.0",
39
48
  "@hono/zod-openapi": "^0.18.0",
@@ -48,12 +57,5 @@
48
57
  "tsup": "^8.4.0",
49
58
  "tsx": "^4.19.0",
50
59
  "vitest": "^3.2.0"
51
- },
52
- "scripts": {
53
- "dev": "tsx watch src/cli.ts dev",
54
- "build": "tsup src/index.ts src/server.ts src/cli.ts --format esm --dts --tsconfig tsconfig.build.json",
55
- "start": "node dist/cli.js start",
56
- "test": "vitest run",
57
- "typecheck": "tsc --noEmit"
58
60
  }
59
- }
61
+ }