Simple CRUD server for GTS (Graph Type System) entities, layouts, and settings. It's primary purpose is to serve GTS entities to the GTS Viewer web app for development and testing purposes.
NOTE: This is a simple server for development and testing purposes. It is not intended for production use. It doesn't provide any security features - authentication, authorization, multi-user/multi-tenancy support, etc.
- GTS Entity Discovery: Automatically scans directories for GTS entities (JSON files with IDs starting with
gts.) - Layout Management: Save and retrieve visual layouts with versioning
- Settings Storage: Global settings persistence
- In-Memory Entity Cache: Fast access to discovered GTS entities via REST API
- Configurable: File-based config, environment variables, and CLI overrides
If you use nvm:
nvm install 20
nvm use 20
cd apps/server
rm -rf node_modules package-lock.json
npm install
npm run dev # for development
# or
npm run build && npm start # for productionIf you use Homebrew:
brew install node@20
echo 'export PATH="/opt/homebrew/opt/node@20/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
node -v # verify v20.x
cd apps/server
rm -rf node_modules package-lock.json
npm install
npm run devThe server can be configured through multiple sources (priority: CLI > Config File > Environment > Defaults).
Create a .gts-server.json file in one of these locations:
- Current directory:
.gts-server.jsonorgts-server.json - Home directory:
~/.gts-server.json - Custom path via
--configflag
Example config file:
{
"port": 7806,
"homeFolder": "~/.gts-viewer/server",
"scanFolder": ".",
"verbosity": "normal",
"dbFile": "viewer.db"
}gts-server [options]
Options:
--port, -p <number> Port to listen on (default: 7806)
--home, --home-folder <path> Home folder for server data (default: ~/.gts-viewer/server/)
--scan, --scan-folder <path> Folder to scan for GTS entities (default: current directory)
--verbosity, -v <level> Verbosity level: silent, normal, debug (default: normal)
--debug Enable debug verbosity
--silent Enable silent verbosity
--db, --db-file <path> Database file path (default: <home-folder>/viewer.db)
--config, -c <path> Path to config file
--help, -h Show help messageGTS_SERVER_PORT: Port to listen onGTS_SERVER_HOME_FOLDER: Home folder pathGTS_SERVER_SCAN_FOLDER: Folder to scan for GTS entitiesGTS_SERVER_VERBOSITY: Verbosity level (silent/normal/debug)GTS_SERVER_DB_FILE: Database file path
# Start with debug logging
npm run dev -- --debug
# Scan a specific directory
npm run dev -- --scan-folder /path/to/gts/entities
# Use custom port and config
npm run dev -- --port 8080 --config /path/to/config.json
# Production mode with custom settings
npm run build
node dist/index-cli.js --port 9000 --scan ../examples --verbosity debugGET /gts/:name- Get a GTS entity by ID (e.g.,/gts/gts.vendor.app.namespace.type.v1)- Returns:
{ id, content, file: { path, name }, isSchema } - 404 if entity not found
- Returns:
GET /health- Server health check- Returns:
{ status, db, backendVersion, gtsEntities }
- Returns:
GET /layouts- Get latest layout (query params: workspaceName, id, filename, schemaId, version)POST /layouts- Save new layout versionGET /layouts/versions- List versions for a targetGET /layouts/:layoutId/versions/:version- Get specific versionPOST /layouts/:layoutId/versions/:version- Restore version as latest
GET /settings- Get global settingsPUT /settings- Update global settings
GET /docs- API documentation (Swagger UI)GET /openapi.yaml- OpenAPI specification
The server only discovers and serves entities with IDs starting with gts.. Non-GTS JSON files are ignored during scanning.
Valid GTS entity example:
{
"id": "gts.example.type.user.profile.v1",
"type": "object",
"properties": { ... }
}Ignored (non-GTS):
{
"id": "my-custom-id",
"data": "..."
}- Scanner: Recursively scans configured folder for
.jsonand.gtsfiles - Entity Filter: Only includes entities with IDs starting with
gts. - In-Memory Cache: Loaded entities stored in Map for fast lookup
- Database: SQLite for layouts, versions, and settings
- Express API: RESTful endpoints with CORS support