nicefox-graphdb 1.0.2 → 1.0.3

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 +26 -35
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -17,9 +17,8 @@ npm install nicefox-graphdb
17
17
  import { GraphDB } from 'nicefox-graphdb';
18
18
 
19
19
  const db = await GraphDB({
20
- url: 'https://my-graphdb.example.com',
21
- project: 'myapp',
22
- apiKey: process.env.GRAPHDB_API_KEY,
20
+ project: 'myapp', // or process.env.GRAPHDB_PROJECT
21
+ apiKey: 'nfx_xxx', // or process.env.GRAPHDB_API_KEY
23
22
  });
24
23
 
25
24
  // Create nodes and relationships
@@ -47,11 +46,7 @@ This means you can use the **exact same code** in both environments:
47
46
 
48
47
  ```typescript
49
48
  // Works in both development and production!
50
- const db = await GraphDB({
51
- url: 'https://my-graphdb.example.com',
52
- project: 'myapp',
53
- apiKey: process.env.GRAPHDB_API_KEY,
54
- });
49
+ const db = await GraphDB({ project: 'myapp' });
55
50
  ```
56
51
 
57
52
  ### Development Mode
@@ -82,38 +77,37 @@ NODE_ENV=production GRAPHDB_API_KEY=xxx node app.js
82
77
 
83
78
  | Option | Type | Required | Default | Description |
84
79
  |--------|------|----------|---------|-------------|
85
- | `url` | `string` | Yes | - | Base URL of the GraphDB server (used in production) |
86
- | `project` | `string` | Yes | - | Project name |
87
- | `apiKey` | `string` | No | - | API key for authentication (used in production) |
88
- | `env` | `'production' \| 'test'` | No | `'production'` | Environment (determines database isolation) |
89
- | `dataPath` | `string` | No | `'./data'` | Path for local data storage (development only). Use `':memory:'` for in-memory database |
80
+ | `url` | `string` | No | `GRAPHDB_URL` or `https://graphdb.nicefox.net` | Base URL of the GraphDB server (production only) |
81
+ | `project` | `string` | Yes | `GRAPHDB_PROJECT` | Project name |
82
+ | `apiKey` | `string` | No | `GRAPHDB_API_KEY` | API key for authentication (production only) |
83
+ | `env` | `string` | No | `NODE_ENV` or `production` | Environment (determines database isolation) |
84
+ | `dataPath` | `string` | No | `GRAPHDB_DATA_PATH` or `./data` | Path for local data storage (development only). Use `':memory:'` for in-memory database |
90
85
 
91
86
  ### Examples
92
87
 
88
+ **Production** (default when `NODE_ENV` is unset or `production`):
93
89
  ```typescript
94
- // Production: connect to remote server
95
90
  const db = await GraphDB({
96
- url: 'https://graphdb.example.com',
97
- project: 'myapp',
98
- apiKey: 'your-api-key',
99
- env: 'production',
91
+ project: 'myapp', // or process.env.GRAPHDB_PROJECT
92
+ apiKey: 'nfx_xxx', // or process.env.GRAPHDB_API_KEY
93
+ url: 'https://my-server', // or process.env.GRAPHDB_URL (default: graphdb.nicefox.net)
100
94
  });
95
+ ```
101
96
 
102
- // Development: use local SQLite (url/apiKey ignored)
103
- // NODE_ENV=development
97
+ **Development** (when `NODE_ENV=development`):
98
+ ```typescript
104
99
  const db = await GraphDB({
105
- url: 'https://graphdb.example.com', // ignored
106
- project: 'myapp',
107
- apiKey: 'your-api-key', // ignored
108
- dataPath: './local-data', // custom data directory
100
+ project: 'myapp', // or process.env.GRAPHDB_PROJECT
101
+ dataPath: './local-data', // or process.env.GRAPHDB_DATA_PATH (default: ./data)
109
102
  });
103
+ // url and apiKey are ignored - uses local SQLite
104
+ ```
110
105
 
111
- // Testing: use in-memory database
112
- // NODE_ENV=development
106
+ **Testing** (when `NODE_ENV=development`):
107
+ ```typescript
113
108
  const db = await GraphDB({
114
- url: 'https://graphdb.example.com',
115
109
  project: 'test-project',
116
- dataPath: ':memory:', // resets on each run
110
+ dataPath: ':memory:', // in-memory database, resets on each run
117
111
  });
118
112
  ```
119
113
 
@@ -305,15 +299,12 @@ npx nicefox-graphdb serve --port 3000 --host 0.0.0.0 --data ./data
305
299
  ### Creating Projects
306
300
 
307
301
  ```bash
308
- # Create a new project (generates API keys)
302
+ # Create a new project (generates API key)
309
303
  npx nicefox-graphdb create myapp --data ./data
310
304
 
311
305
  # Output:
312
306
  # [created] production/myapp.db
313
- # [created] test/myapp.db
314
- # API Keys:
315
- # production: nfx_abc123...
316
- # test: nfx_def456...
307
+ # API Key: nfx_abc123...
317
308
  ```
318
309
 
319
310
  ### CLI Reference
@@ -332,8 +323,8 @@ nicefox-graphdb delete <project> Delete project (use --force)
332
323
  nicefox-graphdb list List all projects
333
324
 
334
325
  # Environment management
335
- nicefox-graphdb clone <project> Copy production to test
336
- nicefox-graphdb wipe <project> Clear test database
326
+ nicefox-graphdb clone <project> --from <env> --to <env> Copy between environments
327
+ nicefox-graphdb wipe <project> --env <env> Clear environment database
337
328
 
338
329
  # Direct queries
339
330
  nicefox-graphdb query <env> <project> "CYPHER"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nicefox-graphdb",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "SQLite-based graph database with Cypher query support",
5
5
  "type": "module",
6
6
  "main": "packages/nicefox-graphdb/dist/index.js",