Extensible knowledge graph foundation for AI systems with dynamic schema management.
interrealm-graph/
βββ packages/
β βββ graph-types/ # TypeScript type definitions
β βββ postgres/ # PostgreSQL metadata layer (Prisma)
β βββ graph-service/ # REST API service
β βββ client-test/ # Test client application
βββ package.json
βββ turbo.json
βββ README.md
Core TypeScript type definitions for graph schemas.
- Node type definitions
- Edge type definitions
- Schema validation
- Query types
- Deployment types
PostgreSQL metadata layer using Prisma ORM.
- Stores schema definitions
- Tracks node/edge types
- Manages dependencies
- Records deployments
Express-based REST API service.
- Schema deployment endpoints
- Graph instance management
- Compatibility checking
- Metadata queries
Test client for validating the system.
- Basic functionality tests
- Document schema tests
- Integration examples
- Node.js >= 18
- pnpm >= 8
- PostgreSQL >= 14
- Docker (optional, for PostgreSQL)
# Clone the repo
git clone https://github.com/your-org/interrealm-graph
cd interrealm-graph
# Install dependencies
pnpm install
# Build all packages
pnpm build# Start PostgreSQL with Docker
docker run -d \
--name interrealm-postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=interrealm \
-p 5432:5432 \
postgres:16
# Or use your existing PostgreSQL instance# Create .env file in packages/postgres
cd packages/postgres
cat > .env << EOF
DATABASE_URL="postgresql://postgres:password@localhost:5432/interrealm?schema=public"
EOF
# Run migrations
pnpm db:migrate
# Generate Prisma client
pnpm db:generate# From root directory
cd packages/graph-service
# Create .env file
cat > .env << EOF
PORT=3000
DATABASE_URL="postgresql://postgres:password@localhost:5432/interrealm?schema=public"
EOF
# Start the server
pnpm devServer will be running at http://localhost:3000
# In another terminal
cd packages/client-test
# Run basic tests
pnpm test:basic
# Run document schema tests
pnpm test:document-schema
# Run all tests
pnpm test:allimport { defineSchema } from '@interrealm/graph-types';
const mySchema = defineSchema({
name: 'my-app',
version: '1.0.0',
nodeTypes: {
User: {
properties: {
email: { type: 'string', required: true },
name: { type: 'string' }
}
},
Post: {
properties: {
title: { type: 'string', required: true },
content: { type: 'string' }
}
}
},
edgeTypes: {
AUTHORED: {
from: 'User',
to: 'Post',
cardinality: '1:N'
}
}
});curl -X POST http://localhost:3000/api/schemas \
-H "Content-Type: application/json" \
-H "x-user-id: duncan" \
-d @my-schema.jsoncurl http://localhost:3000/api/schemascurl http://localhost:3000/api/schemas/my-app/1.0.0# Build all packages
pnpm build
# Build specific package
cd packages/graph-types
pnpm build# Watch all packages
pnpm dev
# Watch specific package
cd packages/graph-service
pnpm dev# Open Prisma Studio
cd packages/postgres
pnpm db:studio
# Create new migration
pnpm db:migrate
# Reset database
pnpm db:push --force-reset# Run all tests
pnpm test
# Run tests for specific package
cd packages/graph-types
pnpm testThe PostgreSQL metadata layer stores:
- schemas: Deployed schema versions
- node_types: Node type definitions
- edge_types: Edge type definitions
- schema_dependencies: Dependency graph
- graph_instances: Connected graph databases
- deployed_schemas: Deployment tracking
POST /api/schemas- Deploy a schemaGET /api/schemas- List all schemasGET /api/schemas/:name- Get latest versionGET /api/schemas/:name/:version- Get specific versionPOST /api/schemas/check-compatibility- Check compatibility
POST /api/instances- Register graph instanceGET /api/instances- List instancesPOST /api/instances/:id/deploy/:schema- Deploy schema to instance
GET /health- Service health check
- Core type system
- PostgreSQL metadata layer
- REST API service
- Basic test client
- ArangoDB adapter
- Neo4j adapter
- Schema versioning & migration
- GraphQL API generation
- Web UI for schema management
- Schema marketplace/registry
Contributions welcome! Please see CONTRIBUTING.md for guidelines.
MIT