@hasna/microservices 0.0.19 → 0.0.20
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.md +19 -8
- package/bin/index.js +487 -131
- package/bin/mcp.js +710 -265
- package/dist/index.js +204 -38
- package/package.json +14 -2
package/README.md
CHANGED
|
@@ -6,18 +6,26 @@ Each microservice is an **independent npm package** with its own PostgreSQL sche
|
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@hasna/microservices)
|
|
8
8
|
|
|
9
|
-
## The
|
|
9
|
+
## The 21 Microservices
|
|
10
10
|
|
|
11
11
|
| Package | Binary | Schema | What it does |
|
|
12
12
|
|---------|--------|--------|--------------|
|
|
13
13
|
| `@hasna/microservice-auth` | `microservice-auth` | `auth.*` | Users, sessions, JWT, magic links, OAuth, 2FA, API keys |
|
|
14
14
|
| `@hasna/microservice-teams` | `microservice-teams` | `teams.*` | Workspaces, members, RBAC (owner/admin/member/viewer), invites |
|
|
15
15
|
| `@hasna/microservice-billing` | `microservice-billing` | `billing.*` | Stripe subscriptions, plans, invoices, usage-based billing |
|
|
16
|
+
| `@hasna/microservice-llm` | `microservice-llm` | `llm.*` | Multi-provider LLM gateway (OpenAI, Anthropic, DeepSeek) with cost tracking |
|
|
17
|
+
| `@hasna/microservice-agents` | `microservice-agents` | `agents.*` | Agent registry, orchestration, capabilities routing, multi-agent messaging |
|
|
18
|
+
| `@hasna/microservice-memory` | `microservice-memory` | `memory.*` | Long-term agent memory, collections, metadata, vector search |
|
|
19
|
+
| `@hasna/microservice-knowledge` | `microservice-knowledge` | `knowledge.*` | RAG, document ingestion, chunking, pgvector embeddings |
|
|
20
|
+
| `@hasna/microservice-guardrails` | `microservice-guardrails` | `guardrails.*` | AI safety, prompt injection detection, PII scanning, moderation |
|
|
21
|
+
| `@hasna/microservice-prompts` | `microservice-prompts` | `prompts.*` | Versioned prompt management, templates, A/B testing, rollback |
|
|
16
22
|
| `@hasna/microservice-notify` | `microservice-notify` | `notify.*` | Email, SMS, in-app, outbound webhooks, templates |
|
|
17
23
|
| `@hasna/microservice-files` | `microservice-files` | `files.*` | Uploads, S3 storage, presigned URLs, image transforms |
|
|
18
24
|
| `@hasna/microservice-audit` | `microservice-audit` | `audit.*` | Immutable event log, compliance trail, retention policies |
|
|
25
|
+
| `@hasna/microservice-traces` | `microservice-traces` | `traces.*` | Agent observability, spans, latency, token tracking |
|
|
19
26
|
| `@hasna/microservice-flags` | `microservice-flags` | `flags.*` | Feature flags, gradual rollouts, A/B experiments |
|
|
20
|
-
| `@hasna/microservice-jobs` | `microservice-jobs` | `jobs.*` | Background jobs, priority queues
|
|
27
|
+
| `@hasna/microservice-jobs` | `microservice-jobs` | `jobs.*` | Background jobs, priority queues, cron, retries |
|
|
28
|
+
| ...and 6 more! | | | `sessions`, `usage`, `waitlist`, `onboarding`, `webhooks`, `search` |
|
|
21
29
|
|
|
22
30
|
## Install
|
|
23
31
|
|
|
@@ -33,14 +41,17 @@ microservices install auth teams billing
|
|
|
33
41
|
## Quick Start
|
|
34
42
|
|
|
35
43
|
```bash
|
|
44
|
+
# 0. Start a local PostgreSQL instance (with pgvector)
|
|
45
|
+
docker-compose up -d
|
|
46
|
+
|
|
36
47
|
# 1. Install a service
|
|
37
48
|
bun install -g @hasna/microservice-auth
|
|
38
49
|
|
|
39
|
-
# 2.
|
|
40
|
-
|
|
50
|
+
# 2. Initialize and migrate your PostgreSQL
|
|
51
|
+
microservices init-all --db postgres://postgres:password@localhost:5432/microservices
|
|
41
52
|
|
|
42
|
-
# 3. Start the HTTP
|
|
43
|
-
|
|
53
|
+
# 3. Start the HTTP APIs
|
|
54
|
+
microservices serve-all
|
|
44
55
|
|
|
45
56
|
# 4. Or start the MCP server (for AI agents)
|
|
46
57
|
microservice-auth mcp
|
|
@@ -53,7 +64,7 @@ microservice-auth mcp
|
|
|
53
64
|
```ts
|
|
54
65
|
import { migrate, register, login } from '@hasna/microservice-auth'
|
|
55
66
|
|
|
56
|
-
const sql = getDb('postgres://localhost/
|
|
67
|
+
const sql = getDb('postgres://postgres:password@localhost:5432/microservices')
|
|
57
68
|
await migrate(sql)
|
|
58
69
|
|
|
59
70
|
const { user, access_token, session } = await register(sql, {
|
|
@@ -110,7 +121,7 @@ await enqueue(sql, { type: 'onboarding.setup', payload: { userId: user.id } })
|
|
|
110
121
|
```bash
|
|
111
122
|
microservices list # List all available microservices
|
|
112
123
|
microservices install auth teams # Install specific services
|
|
113
|
-
microservices install --all # Install all
|
|
124
|
+
microservices install --all # Install all 21
|
|
114
125
|
microservices status # Check what's installed
|
|
115
126
|
microservices info auth # Detailed info + required env
|
|
116
127
|
microservices migrate-all # Run migrations on all installed
|