Examples

Production-ready templates to jumpstart your project. Clone, customize, and ship.

Next.js RAG App

Next.js 14 pgvector OpenAI
README.md - nextjs-rag-app

SymbioseDB RAG App

AI-powered search and Q&A application built with SymbioseDB and Next.js 14.

Features

  • Semantic Search - Find relevant documents using natural language
  • Q&A System - Ask questions and get source-backed answers
  • Auto-Embedding - Documents automatically vectorized
  • Multi-Query Fusion - Better results through query variations
  • Citation Verification - Prevents hallucination with source tracking
  • Fast - Sub-millisecond cache lookups, <10ms queries
  • Beautiful UI - Clean, responsive interface

Quick Start (5 minutes)

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/nextjs-rag-app
npm install

2. Run Development Server

npm run dev

3. Open Browser

Navigate to http://localhost:3000

That's it! Sample documents are automatically indexed on first run.

How It Works

Document Processing

Documents in data/sample-docs.ts are automatically:

  • Chunked into semantic segments
  • Converted to embeddings (vectors)
  • Indexed for semantic search

Search

The search interface uses Reciprocal Rank Fusion (RRF):

  • Generates 3 query variations
  • Searches each variation
  • Combines results for better recall

Q&A

The Q&A interface:

  • Finds relevant context for the question
  • Generates answer from retrieved documents
  • Provides confidence score and sources

Performance

  • Sub-millisecond cache lookups
  • <10ms average query time
  • 75%+ cache hit rate
  • Automatic query optimization

License

MIT

Multi-Database App

PostgreSQL pgvector Apache AGE Ethereum L2
README.md - multi-db-app

Multi-Database App

SymbioseDB starter template with all 4 database types unified in one API.

Features

  • PostgreSQL - SQL queries and relational data
  • pgvector - AI embeddings and semantic search
  • Apache AGE - Graph relationships and traversal
  • Ethereum L2 - Blockchain attestations and verification

Quick Start

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/multi-db-app
npm install

2. Configure Environment

cp .env.example .env
# Edit .env with your database URLs

3. Run Tests

npm test

All tests should pass. This validates your setup is correct.

4. Start Development Server

npm run dev

Open http://localhost:3000 to see your app.

Using the Unified Database Client

import { db, initializeDatabase, generateEmbedding } from '@/lib/symbiosedb';

// Initialize connections
await initializeDatabase();

// Create an entity across all 4 databases
const user = await db.create({
  type: 'User',
  sql: {
    tableName: 'users',
    data: { email: 'john@example.com', name: 'John Doe' }
  },
  vector: {
    collectionName: 'user_embeddings',
    embedding: await generateEmbedding('John Doe'),
    metadata: { name: 'John Doe' }
  },
  graph: {
    nodeLabel: 'User',
    properties: { name: 'John Doe' },
    relationships: []
  },
  blockchain: {
    action: 'USER_CREATED',
    data: { userId: user.id, timestamp: Date.now() }
  }
});

Testing

This template includes complete Jest setup with all necessary polyfills and mocks.

npm test              # Run all tests
npm run test:watch    # Watch mode
npm test -- --coverage # With coverage

License

MIT

Social Graph

Apache AGE React D3.js
README.md - social-graph

Social Graph App

Build social networks with graph traversal, friend recommendations, and relationship analysis using Apache AGE.

Features

  • Graph Relationships - Model friends, followers, connections as graph edges
  • Friend Recommendations - Find friends-of-friends with Cypher queries
  • Path Finding - Discover shortest paths between users
  • Community Detection - Identify clusters and groups
  • Real-time Updates - Live graph visualization with D3.js
  • Fast Traversal - Sub-10ms graph queries

Quick Start

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/social-graph
npm install

2. Configure Environment

cp .env.example .env
# Edit .env with your database URL

3. Run Development Server

npm run dev

Open http://localhost:3000 to see your app.

Using Graph Queries

import { db } from '@/lib/symbiosedb';

// Create a user node
const user = await db.graph.createNode('User', {
  name: 'Alice',
  email: 'alice@example.com'
});

// Create friendship relationship
await db.graph.createEdge(
  user.id,
  friendId,
  'FRIENDS_WITH',
  { since: Date.now() }
);

// Find friends of friends
const recommendations = await db.graph.query(`
  MATCH (me:User {id: $userId})-[:FRIENDS_WITH]->(friend)-[:FRIENDS_WITH]->(fof)
  WHERE NOT (me)-[:FRIENDS_WITH]->(fof) AND me <> fof
  RETURN DISTINCT fof, COUNT(friend) as mutualFriends
  ORDER BY mutualFriends DESC
  LIMIT 10
`, { userId });

Performance

  • < 10ms graph traversal queries
  • 100k+ nodes supported
  • Real-time D3.js visualization
  • Indexed node properties

License

MIT

DAO Voting

Ethereum L2 Solidity Web3.js
README.md - dao-voting

DAO Voting App

Decentralized voting system with blockchain verification, immutable audit trails, and transparent governance.

Features

  • On-chain Voting - Tamper-proof vote recording on Ethereum L2
  • Proposal Management - Create, discuss, and vote on proposals
  • Immutable Audit Trail - Every vote permanently recorded
  • Quorum Tracking - Automatic quorum detection
  • Delegation - Delegate voting power to representatives
  • Results Verification - Anyone can verify vote counts

Quick Start

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/dao-voting
npm install

2. Configure Environment

cp .env.example .env
# Edit .env with your blockchain RPC URL and contract address

3. Run Development Server

npm run dev

Open http://localhost:3000 to see your app.

Using Blockchain Attestations

import { db } from '@/lib/symbiosedb';

// Cast a vote with blockchain attestation
const vote = await db.blockchain.attest({
  action: 'VOTE_CAST',
  data: {
    proposalId,
    voter: walletAddress,
    choice: 'YES',
    weight: votingPower,
    timestamp: Date.now()
  }
});

// Verify vote on-chain
const isValid = await db.blockchain.verify(vote.attestationId);

// Get all votes for a proposal (verifiable)
const votes = await db.blockchain.query({
  action: 'VOTE_CAST',
  filter: { proposalId }
});

Security

  • Immutable - Votes cannot be changed after casting
  • Verifiable - Anyone can audit vote counts
  • Transparent - All proposals and votes are public
  • Sybil-resistant - One address, one vote

License

MIT

E-commerce Platform

PostgreSQL pgvector Stripe
README.md - ecommerce-platform

E-commerce Platform

Full-featured e-commerce with semantic product search, personalized recommendations, and order management.

Features

  • Semantic Search - Find products using natural language
  • Recommendations - AI-powered product suggestions
  • Shopping Cart - Persistent cart with real-time sync
  • Order Management - Track orders from placement to delivery
  • Inventory Sync - Real-time stock updates
  • Payment Integration - Stripe checkout

Quick Start

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/ecommerce-platform
npm install

2. Configure Environment

cp .env.example .env
# Edit .env with your database URLs and Stripe keys

3. Run Development Server

npm run dev

Open http://localhost:3000 to see your app.

Using Unified Database

import { db, generateEmbedding } from '@/lib/symbiosedb';

// Add product with embedding for semantic search
const product = await db.create({
  type: 'Product',
  sql: {
    tableName: 'products',
    data: {
      name: 'Wireless Headphones',
      description: 'Premium noise-canceling headphones',
      price: 299.99,
      stock: 50
    }
  },
  vector: {
    collectionName: 'products',
    embedding: await generateEmbedding('wireless headphones'),
    metadata: { productId: product.id }
  }
});

// Semantic product search
const results = await db.vector.search({
  collection: 'products',
  query: await generateEmbedding('comfortable headphones for work'),
  topK: 10
});

Performance

  • < 50ms semantic search
  • Real-time inventory updates
  • Optimized for high traffic
  • Cached product data

License

MIT

Real-time Dashboard

WebSockets Chart.js Redis
README.md - realtime-dashboard

Real-time Dashboard

Analytics dashboard with live WebSocket updates, time-series visualization, and interactive charts.

Features

  • Live Updates - WebSocket-powered real-time data
  • Time-series Charts - Visualize trends over time
  • Multiple Metrics - Track various KPIs simultaneously
  • Alerts - Threshold-based notifications
  • Historical Data - Query and compare past periods
  • Responsive - Works on desktop and mobile

Quick Start

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/realtime-dashboard
npm install

2. Configure Environment

cp .env.example .env
# Edit .env with your database URL and WebSocket settings

3. Run Development Server

npm run dev

Open http://localhost:3000 to see your app.

Using Real-time Features

import { db } from '@/lib/symbiosedb';
import { useRealtime } from '@/lib/websocket';

// Record a metric
await db.sql.insert('metrics', {
  name: 'page_views',
  value: 1523,
  timestamp: Date.now()
});

// Subscribe to real-time updates
const { data, isConnected } = useRealtime('metrics', {
  filter: { name: 'page_views' },
  onUpdate: (newMetric) => {
    console.log('New metric:', newMetric);
  }
});

Performance

  • < 100ms WebSocket latency
  • 1000+ concurrent connections
  • Efficient time-series queries
  • Automatic data retention

License

MIT

Multi-tenant SaaS

PostgreSQL Clerk Stripe
README.md - multi-tenant-saas

Multi-tenant SaaS

SaaS boilerplate with tenant isolation, billing integration, authentication, and admin dashboard.

Features

  • Tenant Isolation - Row-level security for data separation
  • Authentication - Clerk integration for user management
  • Billing - Stripe subscriptions and usage billing
  • Admin Dashboard - Tenant management and analytics
  • Role-based Access - Granular permissions per tenant
  • Custom Domains - Support for tenant subdomains

Quick Start

1. Clone and Install

git clone https://github.com/501336North/ORG-SymbioseDB
cd SymbioseDB/templates/multi-tenant-saas
npm install

2. Configure Environment

cp .env.example .env
# Edit .env with your database URL, Clerk keys, and Stripe keys

3. Run Migrations

npm run db:migrate

4. Run Development Server

npm run dev

Open http://localhost:3000 to see your app.

Using Row-Level Security

import { db, withTenant } from '@/lib/symbiosedb';

// All queries automatically scoped to tenant
const client = withTenant(db, tenantId);

// Create a resource (tenant_id automatically added)
const project = await client.sql.insert('projects', {
  name: 'My Project',
  description: 'A new project'
});

// Query only returns tenant's data
const projects = await client.sql.query('SELECT * FROM projects');
// Only returns projects where tenant_id = tenantId

Security

  • Row-Level Security - Database enforces tenant isolation
  • JWT Validation - All requests authenticated
  • Role Checks - Middleware validates permissions
  • Audit Logging - Track sensitive operations

License

MIT