<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documentation | TapirusDB — Embedded Quad-Model AI Database & Memory Engine</title>
<meta name="description" content="Comprehensive documentation, SDK guides, API references, and interactive playground for TapirusDB — The 100% Safe-Rust Embedded Quad-Model Database.">
<link rel="canonical" href="https://tapirusdb.com/docs.html">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Blinker:wght@100;200;300;400;600;700;800;900&family=Michroma&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.lineicons.com/4.0/lineicons.css">
<style>
:root {
--corp-primary: #2b3a7e;
--corp-primary-dark: #1b2654;
--corp-primary-light: #3e50a2;
--corp-primary-glow: rgba(43, 58, 126, 0.25);
--corp-subtle: rgba(43, 58, 126, 0.08);
--bg-base: #f8fafc;
--bg-surface: #ffffff;
--bg-surface-elevated: #f1f5f9;
--bg-card: rgba(255, 255, 255, 0.95);
--border-subtle: rgba(43, 58, 126, 0.1);
--border-strong: rgba(43, 58, 126, 0.2);
--text-main: #0f172a;
--text-muted: #475569;
--text-dim: #64748b;
--accent-emerald: #059669;
--accent-emerald-glow: rgba(5, 150, 105, 0.15);
--accent-cyan: #0284c7;
--accent-blue: #2b3a7e;
--accent-purple: #7c3aed;
--code-bg: #0f172a;
--sidebar-width: 290px;
--toc-width: 240px;
--header-height: 64px;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Blinker', -apple-system, BlinkMacSystemFont, sans-serif;
font-weight: 600;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
background-color: var(--bg-base);
color: var(--text-main);
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
line-height: 1.65;
font-size: 15px;
overflow-x: hidden;
}
.doc-nav {
position: fixed;
top: 0; left: 0; right: 0;
height: var(--header-height);
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border-subtle);
z-index: 100;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.doc-nav-left {
display: flex;
align-items: center;
gap: 16px;
}
.doc-brand {
display: flex;
align-items: center;
gap: 10px;
text-decoration: none;
color: #2b3a7e;
font-family: 'Michroma', sans-serif;
font-weight: 700;
font-size: 17px;
letter-spacing: -0.02em;
}
.doc-brand-glyph {
width: 32px; height: 32px;
background: linear-gradient(135deg, #2b3a7e 0%, #1d4ed8 100%);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
font-weight: 700;
color: #ffffff;
font-family: 'Michroma', sans-serif;
box-shadow: 0 0 14px rgba(43, 58, 126, 0.35);
}
.doc-tag {
font-size: 9.5px;
background: rgba(43, 58, 126, 0.08);
color: #2b3a7e;
border: 1px solid rgba(43, 58, 126, 0.25);
padding: 2px 7px;
border-radius: 999px;
font-family: 'Michroma', sans-serif;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.back-home-link {
color: var(--text-muted);
text-decoration: none;
font-size: 13px;
font-weight: 500;
display: flex;
align-items: center;
gap: 6px;
padding: 5px 12px;
border-radius: 6px;
background: rgba(15, 23, 42, 0.04);
border: 1px solid var(--border-subtle);
transition: all 0.2s;
}
.back-home-link:hover {
color: #0f172a;
background: rgba(15, 23, 42, 0.08);
border-color: var(--border-strong);
}
.doc-nav-right {
display: flex;
align-items: center;
gap: 16px;
}
.doc-search-box {
position: relative;
width: 260px;
}
.doc-search-box input {
width: 100%;
background: #f1f5f9;
border: 1px solid var(--border-subtle);
color: #0f172a;
font-size: 13px;
padding: 7px 12px 7px 34px;
border-radius: 8px;
outline: none;
transition: all 0.2s;
}
.doc-search-box input:focus {
border-color: var(--accent-cyan);
box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
background: #ffffff;
}
.doc-search-box i {
position: absolute;
left: 11px; top: 10px;
color: var(--text-dim);
font-size: 14px;
}
.doc-search-shortcut {
position: absolute;
right: 8px; top: 7px;
font-size: 10px;
padding: 2px 5px;
background: rgba(15, 23, 42, 0.08);
border-radius: 4px;
color: var(--text-muted);
font-family: monospace;
}
.doc-search-dropdown {
position: absolute;
top: calc(100% + 8px);
left: 0;
width: 320px;
background: #ffffff;
border: 1px solid var(--border-subtle);
border-radius: 10px;
box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
max-height: 380px;
overflow-y: auto;
display: none;
z-index: 1000;
padding: 8px;
}
.doc-search-dropdown.show {
display: block;
}
.doc-search-item {
display: flex;
flex-direction: column;
padding: 8px 12px;
border-radius: 6px;
text-decoration: none;
transition: background 0.15s;
}
.doc-search-item:hover, .doc-search-item.selected {
background: rgba(43, 58, 126, 0.06);
}
.doc-search-item-title {
font-size: 13.5px;
font-weight: 600;
color: var(--corp-primary);
display: flex;
align-items: center;
gap: 6px;
}
.doc-search-item-category {
font-size: 11px;
color: var(--text-dim);
margin-top: 2px;
}
.doc-github-btn {
background: #0f172a;
color: #ffffff;
text-decoration: none;
font-size: 13px;
font-weight: 600;
padding: 7px 14px;
border-radius: 8px;
display: flex;
align-items: center;
gap: 6px;
border: 1px solid #1e293b;
transition: all 0.2s;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
.doc-github-btn:hover {
background: #1e293b;
box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}
.mobile-menu-toggle {
display: none;
background: rgba(15, 23, 42, 0.04);
border: 1px solid var(--border-subtle);
color: #0f172a;
font-size: 18px;
cursor: pointer;
width: 36px;
height: 36px;
border-radius: 8px;
align-items: center;
justify-content: center;
transition: all 0.15s;
}
.mobile-menu-toggle:hover {
background: rgba(15, 23, 42, 0.08);
}
.doc-layout {
display: flex;
margin-top: var(--header-height);
min-height: calc(100vh - var(--header-height));
}
.doc-backdrop {
display: none;
position: fixed;
inset: 0;
background: rgba(15, 23, 42, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 104;
opacity: 0;
transition: opacity 0.25s ease;
}
.doc-backdrop.active {
display: block;
opacity: 1;
}
.doc-sidebar {
width: var(--sidebar-width);
position: fixed;
top: var(--header-height);
bottom: 0;
left: 0;
background: var(--bg-surface);
border-right: 1px solid var(--border-subtle);
overflow-y: auto;
padding: 24px 16px 48px;
z-index: 90;
}
.doc-sidebar-header {
display: none;
align-items: center;
justify-content: space-between;
padding-bottom: 14px;
margin-bottom: 16px;
border-bottom: 1px solid var(--border-subtle);
}
.doc-sidebar-header-title {
font-size: 11px;
font-weight: 700;
color: #2b3a7e;
font-family: 'Michroma', sans-serif;
text-transform: uppercase;
letter-spacing: 0.08em;
}
.sidebar-close-btn {
background: rgba(15, 23, 42, 0.05);
border: 1px solid var(--border-subtle);
border-radius: 6px;
color: var(--text-muted);
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
}
.sidebar-close-btn:hover {
background: rgba(15, 23, 42, 0.1);
color: var(--text-main);
}
.doc-group {
margin-bottom: 24px;
}
.doc-group-title {
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
color: #2b3a7e;
font-family: 'Michroma', sans-serif;
padding: 0 10px 8px;
display: flex;
align-items: center;
justify-content: space-between;
opacity: 0.85;
}
.doc-link {
font-family: 'Blinker', sans-serif;
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
font-size: 14.5px;
color: var(--text-muted);
text-decoration: none;
border-radius: 6px;
transition: all 0.15s ease;
font-weight: 600;
}
.doc-link i { font-size: 14px; color: var(--text-dim); transition: color 0.15s; }
.doc-link:hover {
color: #2b3a7e;
background: rgba(43, 58, 126, 0.04);
}
.doc-link:hover i { color: #2b3a7e; }
.doc-link.active {
color: #2b3a7e;
background: rgba(43, 58, 126, 0.08);
font-weight: 700;
}
.doc-link.active i { color: #2b3a7e; }
.doc-main {
margin-left: var(--sidebar-width);
flex: 1;
max-width: 900px;
padding: 40px 48px 100px;
}
.doc-breadcrumbs {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
color: var(--text-dim);
margin-bottom: 20px;
}
.doc-breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.doc-breadcrumbs a:hover { color: #0f172a; }
.doc-header h1 {
font-family: 'Blinker', sans-serif;
font-size: 34px;
font-weight: 600;
letter-spacing: -0.01em;
color: #0f172a;
margin-bottom: 12px;
line-height: 1.2;
}
.doc-lead {
font-size: 17px;
color: var(--text-muted);
line-height: 1.6;
margin-bottom: 32px;
padding-bottom: 24px;
border-bottom: 1px solid var(--border-subtle);
}
.doc-section {
margin-bottom: 56px;
scroll-margin-top: 90px;
}
.doc-section h2 {
font-family: 'Blinker', sans-serif;
font-size: 24px;
font-weight: 600;
letter-spacing: -0.01em;
color: #0f172a;
margin-bottom: 16px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border-subtle);
display: flex;
align-items: center;
gap: 10px;
}
.doc-section h2 a.anchor-link {
color: var(--text-dim);
text-decoration: none;
font-size: 18px;
opacity: 0;
transition: opacity 0.2s;
}
.doc-section h2:hover a.anchor-link { opacity: 1; }
.doc-section h3 {
font-family: 'Blinker', sans-serif;
font-size: 19px;
font-weight: 600;
color: #1e293b;
margin: 28px 0 12px;
}
.doc-section p {
color: var(--text-muted);
margin-bottom: 16px;
}
.doc-section ul, .doc-section ol {
margin: 0 0 20px 24px;
color: var(--text-muted);
}
.doc-section li { margin-bottom: 6px; }
.callout {
padding: 16px 20px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
display: flex;
gap: 14px;
align-items: flex-start;
border-left: 4px solid;
}
.callout-info {
background: rgba(43, 58, 126, 0.06);
border-color: #2b3a7e;
color: #1b2654;
}
.callout-success {
background: rgba(5, 150, 105, 0.08);
border-color: var(--accent-emerald);
color: #065f46;
}
.callout-warn {
background: rgba(217, 119, 6, 0.08);
border-color: #d97706;
color: #92400e;
}
.callout i { font-size: 18px; margin-top: 2px; }
.code-box {
background: var(--code-bg);
border: 1px solid rgba(15, 23, 42, 0.15);
border-radius: 8px;
margin: 18px 0 24px;
overflow: hidden;
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
max-width: 100%;
}
.code-header {
background: rgba(255, 255, 255, 0.05);
padding: 8px 16px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
color: #94a3b8;
}
.code-copy-btn {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
color: #cbd5e1;
font-size: 11px;
padding: 3px 8px;
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
gap: 4px;
transition: all 0.15s;
}
.code-copy-btn:hover {
background: rgba(255, 255, 255, 0.16);
color: #ffffff;
}
.code-copy-btn.copied {
background: rgba(5, 150, 105, 0.25) !important;
border-color: #10b981 !important;
color: #34d399 !important;
font-weight: 600;
}
pre code {
display: block;
padding: 16px;
overflow-x: auto;
font-family: 'JetBrains Mono', monospace;
font-size: 13.5px;
line-height: 1.6;
color: #e2e8f0;
-webkit-overflow-scrolling: touch;
}
inline-code, code:not(pre code) {
font-family: 'JetBrains Mono', monospace;
font-size: 12.5px;
background: #f1f5f9;
padding: 2px 6px;
border-radius: 4px;
color: #0284c7;
border: 1px solid rgba(15, 23, 42, 0.08);
font-weight: 500;
}
.table-scroll-wrap {
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
margin: 20px 0 28px;
border: 1px solid var(--border-subtle);
border-radius: 8px;
background: #ffffff;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.doc-table {
width: 100%;
min-width: 600px;
border-collapse: collapse;
font-size: 13.5px;
background: #ffffff;
}
.doc-table th {
background: #f8fafc;
padding: 12px 16px;
text-align: left;
font-weight: 700;
color: #0f172a;
border-bottom: 1px solid var(--border-subtle);
}
.doc-table td {
padding: 12px 16px;
border-bottom: 1px solid var(--border-subtle);
color: #334155;
}
.doc-table tr:last-child td { border-bottom: none; }
.doc-table tr:hover td { background: #f8fafc; }
.license-tag {
font-size: 11px;
font-weight: 700;
padding: 3px 8px;
border-radius: 4px;
font-family: 'JetBrains Mono', monospace;
display: inline-block;
}
.license-tag.mit {
background: #eff6ff;
color: #2563eb;
border: 1px solid #bfdbfe;
}
.license-tag.busl {
background: #fef3c7;
color: #d97706;
border: 1px solid #fde68a;
}
.doc-pager {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-top: 56px;
padding-top: 36px;
border-top: 1px solid var(--border-subtle);
}
.doc-pager-card {
display: flex;
flex-direction: column;
padding: 18px 22px;
border-radius: 12px;
border: 1px solid var(--border-subtle);
background: var(--bg-surface);
text-decoration: none;
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.doc-pager-card:hover {
border-color: var(--corp-primary);
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(43, 58, 126, 0.1);
}
.doc-pager-card.next {
text-align: right;
align-items: flex-end;
}
.doc-pager-label {
font-size: 11.5px;
font-weight: 600;
color: var(--text-dim);
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 6px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.doc-pager-title {
font-family: 'Blinker', sans-serif;
font-size: 17px;
font-weight: 700;
color: var(--corp-primary);
}
@media (max-width: 600px) {
.doc-pager {
grid-template-columns: 1fr;
}
.doc-pager-card.next {
text-align: left;
align-items: flex-start;
}
}
.studio-container {
background: #0f172a;
border: 1px solid rgba(5, 150, 105, 0.3);
border-radius: 12px;
padding: 20px;
margin: 24px 0 32px;
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.studio-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
gap: 12px;
}
.studio-modes {
display: flex;
gap: 6px;
background: rgba(255, 255, 255, 0.06);
padding: 4px;
border-radius: 8px;
}
.studio-mode-btn {
background: none;
border: none;
color: #94a3b8;
font-size: 12px;
font-weight: 600;
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
}
.studio-mode-btn:hover {
color: #f1f5f9;
}
.studio-mode-btn.active {
background: #2b3a7e;
color: #ffffff;
box-shadow: 0 2px 8px rgba(43, 58, 126, 0.35);
}
.studio-run-btn {
background: linear-gradient(135deg, #2b3a7e 0%, #1d4ed8 100%);
border: none;
color: #ffffff;
font-family: 'Blinker', sans-serif;
font-size: 14.5px;
font-weight: 700;
letter-spacing: 0.02em;
padding: 7px 20px;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
gap: 6px;
box-shadow: 0 0 15px rgba(43, 58, 126, 0.35);
transition: all 0.15s;
white-space: nowrap;
}
.studio-run-btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 18px rgba(43, 58, 126, 0.5);
}
.studio-editor {
width: 100%;
height: 110px;
background: #090d16;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 6px;
padding: 12px;
color: #38bdf8;
font-family: 'JetBrains Mono', monospace;
font-size: 13px;
resize: vertical;
outline: none;
}
.studio-editor:focus {
border-color: #0284c7;
box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}
.studio-output-box {
margin-top: 14px;
background: #050811;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 6px;
padding: 14px;
max-height: 240px;
overflow-y: auto;
font-family: 'JetBrains Mono', monospace;
font-size: 12.5px;
color: #34d399;
white-space: pre-wrap;
word-break: break-all;
}
.doc-toc {
width: var(--toc-width);
position: fixed;
top: var(--header-height);
right: 24px;
bottom: 0;
padding: 40px 0;
overflow-y: auto;
}
.doc-toc-title {
font-family: 'Michroma', sans-serif;
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
color: #2b3a7e;
margin-bottom: 12px;
}
.doc-toc a {
display: block;
color: var(--text-dim);
text-decoration: none;
font-size: 12.5px;
padding: 5px 0 5px 12px;
border-left: 2px solid transparent;
transition: all 0.15s;
line-height: 1.4;
}
.doc-toc a:hover {
color: #0f172a;
}
.doc-toc a {
font-family: 'Blinker', sans-serif;
font-size: 13.5px;
font-weight: 600;
color: var(--text-dim);
text-decoration: none;
display: block;
padding: 5px 0 5px 12px;
border-left: 2px solid transparent;
transition: all 0.15s;
line-height: 1.4;
}
.doc-toc a:hover {
color: #2b3a7e;
}
.doc-toc a.active {
color: #2b3a7e;
border-left-color: #2b3a7e;
font-weight: 700;
}
@media (max-width: 1200px) {
.doc-toc { display: none; }
.doc-main { max-width: 100%; margin-right: 0; }
}
@media (max-width: 860px) {
.mobile-menu-toggle {
display: flex;
}
.doc-sidebar-header {
display: flex;
}
.doc-sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
width: 300px;
max-width: 85vw;
height: 100vh;
z-index: 105;
padding: 20px 16px 40px;
transform: translateX(-100%);
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
box-shadow: 10px 0 35px rgba(15, 23, 42, 0.15);
}
.doc-sidebar.open {
transform: translateX(0);
}
.doc-main {
margin-left: 0;
padding: 28px 20px 80px;
}
.doc-search-box {
display: none;
}
}
@media (max-width: 640px) {
.doc-main {
padding: 20px 16px 60px;
}
.doc-header h1 {
font-size: 26px;
}
.doc-lead {
font-size: 15px;
}
.doc-section h2 {
font-size: 20px;
}
.doc-section h3 {
font-size: 16px;
}
.studio-container {
padding: 16px 12px;
}
.studio-header {
flex-direction: column;
align-items: stretch;
}
.studio-modes {
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
padding: 4px;
gap: 4px;
}
.studio-mode-btn {
flex: 1 0 auto;
text-align: center;
padding: 6px 10px;
font-size: 11.5px;
}
.studio-run-btn {
justify-content: center;
width: 100%;
padding: 9px 16px;
}
.studio-editor {
font-size: 12px;
padding: 10px;
}
.studio-output-box {
font-size: 11.5px;
padding: 10px;
}
.code-header {
padding: 7px 12px;
font-size: 11px;
}
pre code {
padding: 12px;
font-size: 12px;
}
.callout {
padding: 12px 14px;
font-size: 13px;
gap: 10px;
}
}
@media (max-width: 520px) {
.doc-nav {
padding: 0 12px;
}
.doc-nav-left {
gap: 8px;
}
.doc-brand span:not(.doc-tag) {
font-size: 15px;
}
.doc-tag {
display: none;
}
.back-home-link span {
display: none;
}
.back-home-link {
padding: 6px 8px;
}
.doc-github-btn span {
display: none;
}
.doc-github-btn {
padding: 6px 10px;
}
}
</style>
</head>
<body>
<header class="doc-nav">
<div class="doc-nav-left">
<button class="mobile-menu-toggle" id="menuToggle" aria-label="Toggle Navigation">
<i class="lni lni-menu"></i>
</button>
<a href="index.html" class="doc-brand">
<div class="doc-brand-glyph">T</div>
<span>TapirusDB</span>
<span class="doc-tag">Docs</span>
</a>
<a href="index.html" class="back-home-link" title="Back to Homepage">
<i class="lni lni-arrow-left"></i> <span>Home</span>
</a>
<a href="tutorial.html" class="back-home-link" title="Hands-On Tutorials" style="color:var(--corp-primary); font-weight:600;">
<i class="lni lni-graduation"></i> <span>Tutorials</span>
</a>
</div>
<div class="doc-nav-right">
<div class="doc-search-box">
<i class="lni lni-search-alt"></i>
<input type="text" id="docSearch" placeholder="Search documentation (⌘K or /)..." autocomplete="off">
<span class="doc-search-shortcut">⌘K</span>
<div class="doc-search-dropdown" id="docSearchDropdown"></div>
</div>
<a href="https://github.com/tapiruslab/TapirusDB" target="_blank" class="doc-github-btn" title="GitHub Repository">
<i class="lni lni-github-original"></i> <span>GitHub</span>
</a>
</div>
</header>
<div class="doc-layout">
<div class="doc-backdrop" id="docBackdrop"></div>
<aside class="doc-sidebar" id="docSidebar">
<div class="doc-sidebar-header">
<span class="doc-sidebar-header-title">Documentation Menu</span>
<button class="sidebar-close-btn" id="sidebarCloseBtn" aria-label="Close Documentation Menu">
<i class="lni lni-close"></i>
</button>
</div>
<div class="doc-group">
<div class="doc-group-title">Getting Started</div>
<a href="#overview" class="doc-link active"><i class="lni lni-rocket"></i> Overview & Philosophy</a>
<a href="#why-tapirus" class="doc-link"><i class="lni lni-shield"></i> Why TapirusDB</a>
<a href="#installation" class="doc-link"><i class="lni lni-download"></i> Installation & Packages</a>
<a href="#quickstart" class="doc-link"><i class="lni lni-bolt"></i> 30-Second Quickstart</a>
<a href="tutorial.html" class="doc-link" style="color:var(--accent-cyan); font-weight:700;"><i class="lni lni-graduation"></i> Tutorials Portal ↗</a>
</div>
<div class="doc-group">
<div class="doc-group-title">The Quad Models</div>
<a href="#sql-engine" class="doc-link"><i class="lni lni-database"></i> Relational SQL-92</a>
<a href="#vector-engine" class="doc-link"><i class="lni lni-layers"></i> HNSW Vector Search</a>
<a href="#graph-engine" class="doc-link"><i class="lni lni-network"></i> openCypher GraphRAG</a>
<a href="#doc-store" class="doc-link"><i class="lni lni-files"></i> JSON Document Collections</a>
</div>
<div class="doc-group">
<div class="doc-group-title">Interactive Tooling</div>
<a href="#studio" class="doc-link"><i class="lni lni-code-alt"></i> In-Browser SLM Studio</a>
</div>
<div class="doc-group">
<div class="doc-group-title">Storage & Internals</div>
<a href="#disk-format" class="doc-link"><i class="lni lni-harddrive"></i> The .tapir Disk Format</a>
<a href="#memory-internals" class="doc-link"><i class="lni lni-dashboard"></i> Memory & Cache (<4MB)</a>
<a href="#security-encryption" class="doc-link"><i class="lni lni-lock"></i> ChaCha20-Poly1305 AEAD</a>
</div>
<div class="doc-group">
<div class="doc-group-title">Official Client SDKs</div>
<a href="#sdk-rust" class="doc-link"><i class="lni lni-code"></i> Rust (crates.io)</a>
<a href="#sdk-python" class="doc-link"><i class="lni lni-python"></i> Python (PyPI)</a>
<a href="#sdk-nodejs" class="doc-link"><i class="lni lni-javascript"></i> Node.js & TS (npm)</a>
<a href="#sdk-go" class="doc-link"><i class="lni lni-code-alt"></i> Go (pkg.go.dev)</a>
<a href="#sdk-php" class="doc-link"><i class="lni lni-php"></i> PHP (Packagist)</a>
</div>
<div class="doc-group">
<div class="doc-group-title">Server & Deployment</div>
<a href="#server-daemon" class="doc-link"><i class="lni lni-server"></i> Standalone Daemon</a>
<a href="#mcp-server" class="doc-link"><i class="lni lni-bot"></i> Model Context Protocol (MCP)</a>
<a href="#docker-deployment" class="doc-link"><i class="lni lni-docker"></i> Docker & Containers</a>
<a href="#edge-deployment" class="doc-link"><i class="lni lni-cloud"></i> Serverless & Cloudflare Edge</a>
</div>
<div class="doc-group">
<div class="doc-group-title">Reference</div>
<a href="#benchmarks-matrix" class="doc-link"><i class="lni lni-bar-chart"></i> Benchmarks & Specs</a>
<a href="#comparison-matrix" class="doc-link"><i class="lni lni-grid-alt"></i> Industry Duel Matrix</a>
</div>
</aside>
<main class="doc-main">
<div class="doc-breadcrumbs">
<a href="index.html">Home</a>
<span>/</span>
<a href="docs.html">Docs</a>
<span>/</span>
<span id="currentCrumb">Getting Started</span>
</div>
<div class="doc-header">
<h1>TapirusDB Documentation</h1>
<p class="doc-lead">
The embedded cognitive memory and multi-model database engine engineered in 100% Safe Rust (<code style="color:#059669; font-weight:600;">#![forbid(unsafe_code)]</code>). Unifies Relational SQL, HNSW Vectors, GraphRAG, and JSON Documents in a single encrypted disk file with sub-microsecond latency.
</p>
</div>
<section class="doc-section" id="overview">
<h2>
<span>Overview & Design Philosophy</span>
<a href="#overview" class="anchor-link">#</a>
</h2>
<p>
Traditional software systems force engineers into <strong>Fragmented Polyglot Persistence</strong>. Building an intelligent application or AI agent routinely requires orchestrating four disparate database daemons: PostgreSQL for structured tables, Pinecone or Qdrant for vector embeddings, Neo4j for relationship graphs, and MongoDB for schemaless documents.
</p>
<p>
This "Frankenstack" introduces severe network socket serialization overhead (40–90 ms roundtrips), heavy memory consumption (> 2 GB idle RAM), synchronization drift, and operational fragility.
</p>
<div class="callout callout-success">
<i class="lni lni-checkmark-circle"></i>
<div>
<strong>The TapirusDB Solution:</strong> A zero-daemon, in-process engine compiled directly into your application runtime. All four data paradigms share the same unified memory space, executing cross-paradigm chaining in <strong>0.55 microseconds</strong>.
</div>
</div>
<h3>Core Tenets</h3>
<ul>
<li><strong>100% Safe Rust:</strong> Zero unsafe code blocks. Protected at compile-time against memory corruption, dangling pointers, buffer overflows, and use-after-free vulnerabilities.</li>
<li><strong>Single File Atomic Storage:</strong> The entire database resides in a single, robust <code>.tapir</code> binary file protected by ChaCha20-Poly1305 AEAD authenticated page encryption.</li>
<li><strong>Micro-Footprint:</strong> Consumes less than 4 MB of idle RAM, making it optimal for robotics, mobile applications, edge silicon, and serverless containers.</li>
<li><strong>Zero Cloud Lock-in:</strong> Fully sovereign and self-contained. Runs anywhere from an air-gapped embedded device to massive cloud microservices.</li>
</ul>
</section>
<section class="doc-section" id="why-tapirus">
<h2>
<span>Why TapirusDB (Kill the Frankenstack)</span>
<a href="#why-tapirus" class="anchor-link">#</a>
</h2>
<p>
Observe the architectural contrast between traditional multi-database deployments and TapirusDB's unified in-process model:
</p>
<div style="margin: 24px 0; text-align: center;">
<picture>
<source media="(max-width: 768px)" srcset="assets/architecture-mobile.svg">
<img src="assets/architecture-comparison.svg" alt="TapirusDB Architecture vs The Frankenstack" style="width:100%; max-width:860px; border-radius:10px; border:1px solid var(--border-subtle);">
</picture>
</div>
<div class="table-scroll-wrap">
<table class="doc-table">
<thead>
<tr>
<th>Metric</th>
<th>The Polyglot "Frankenstack"</th>
<th>TapirusDB v1.0.0</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Query Latency</strong></td>
<td>40 – 90 ms (TCP/HTTP/gRPC sockets)</td>
<td><span style="color:var(--accent-emerald); font-weight:700;">0.55 µs</span> (Direct memory bus)</td>
</tr>
<tr>
<td><strong>Idle RAM</strong></td>
<td>> 2,000 MB (4 separate JVM / C++ runtimes)</td>
<td><span style="color:var(--accent-emerald); font-weight:700;">< 4 MB</span> (Single process)</td>
</tr>
<tr>
<td><strong>Memory Safety</strong></td>
<td>Unsafe C/C++ or JVM Garbage Collection pauses</td>
<td><span style="color:var(--accent-emerald); font-weight:700;">100% Safe Rust</span></td>
</tr>
<tr>
<td><strong>Sync Drift</strong></td>
<td>Fragile ETL pipelines and eventual consistency lag</td>
<td><span style="color:var(--accent-emerald); font-weight:700;">Zero</span> (Single atomic .tapir disk file)</td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="doc-section" id="installation">
<h2>
<span>Installation & Ecosystem Packages</span>
<a href="#installation" class="anchor-link">#</a>
</h2>
<p>
TapirusDB provides first-class native distribution across all major programming ecosystems and operating system package managers.
</p>
<h3>Package Managers (Terminal CLI)</h3>
<div class="code-box">
<div class="code-header">
<span>Terminal (macOS & Linux via Homebrew)</span>
<button class="code-copy-btn" onclick="copyText('brew install https://raw.githubusercontent.com/tapiruslab/TapirusDB/main/Formula/tapirus.rb', this)">Copy</button>
</div>
<pre><code>brew install https://raw.githubusercontent.com/tapiruslab/TapirusDB/main/Formula/tapirus.rb</code></pre>
</div>
<div class="code-box">
<div class="code-header">
<span>Windows (Windows Package Manager - Winget)</span>
<button class="code-copy-btn" onclick="copyText('winget install --manifest https://raw.githubusercontent.com/tapiruslab/TapirusDB/main/winget/tapirus.yaml', this)">Copy</button>
</div>
<pre><code>winget install --manifest https://raw.githubusercontent.com/tapiruslab/TapirusDB/main/winget/tapirus.yaml</code></pre>
</div>
<div class="code-box">
<div class="code-header">
<span>Linux Automated Quick Install</span>
<button class="code-copy-btn" onclick="copyText('curl -fsSL https://raw.githubusercontent.com/tapiruslab/TapirusDB/main/install.sh | bash', this)">Copy</button>
</div>
<pre><code>curl -fsSL https://raw.githubusercontent.com/tapiruslab/TapirusDB/main/install.sh | bash</code></pre>
</div>
<h3>Language Client Libraries</h3>
<div class="table-scroll-wrap">
<table class="doc-table">
<thead>
<tr>
<th>Language</th>
<th>Registry Package</th>
<th>Installation Command</th>
<th>License</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Rust</strong></td>
<td><a href="https://crates.io/crates/tapirus" target="_blank" style="color:var(--accent-cyan); font-weight:600;">crates.io/crates/tapirus</a></td>
<td><code>cargo add tapirus</code></td>
<td><span class="license-tag busl">BUSL-1.1</span></td>
</tr>
<tr>
<td><strong>Python</strong></td>
<td><a href="https://pypi.org/project/tapirus/" target="_blank" style="color:var(--accent-cyan); font-weight:600;">pypi.org/project/tapirus</a></td>
<td><code>pip install tapirus</code></td>
<td><span class="license-tag mit">MIT</span></td>
</tr>
<tr>
<td><strong>Node.js / TS</strong></td>
<td><a href="https://www.npmjs.com/package/tapirus" target="_blank" style="color:var(--accent-cyan); font-weight:600;">npmjs.com/package/tapirus</a></td>
<td><code>npm install tapirus</code></td>
<td><span class="license-tag mit">MIT</span></td>
</tr>
<tr>
<td><strong>Go (Golang)</strong></td>
<td><a href="https://pkg.go.dev/github.com/tapiruslab/TapirusDB/sdks/go" target="_blank" style="color:var(--accent-cyan); font-weight:600;">pkg.go.dev</a></td>
<td><code>go get github.com/tapiruslab/TapirusDB/sdks/go</code></td>
<td><span class="license-tag mit">MIT</span></td>
</tr>
<tr>
<td><strong>PHP</strong></td>
<td><a href="https://packagist.org/packages/tapiruslab/tapirusdb" target="_blank" style="color:var(--accent-cyan); font-weight:600;">packagist.org/packages/tapiruslab/tapirusdb</a></td>
<td><code>composer require tapiruslab/tapirusdb</code></td>
<td><span class="license-tag mit">MIT</span></td>
</tr>
<tr>
<td><strong>Docker</strong></td>
<td><a href="https://github.com/tapiruslab/TapirusDB/pkgs/container/tapirusdb" target="_blank" style="color:var(--accent-cyan); font-weight:600;">ghcr.io/tapiruslab/tapirusdb</a></td>
<td><code>docker pull ghcr.io/tapiruslab/tapirusdb:latest</code></td>
<td><span class="license-tag busl">BUSL-1.1</span></td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="doc-section" id="quickstart">
<h2>
<span>30-Second Quickstart</span>
<a href="#quickstart" class="anchor-link">#</a>
</h2>
<p>
Initialize an in-memory or encrypted single-file database, create structured tables with vector columns, execute graph traversals, and query via SQL in under 30 seconds:
</p>
<div class="code-box">
<div class="code-header">
<span>Rust Quickstart (main.rs)</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>use tapirus::{Connection, DistanceMetric, Result};
use serde_json::json;
fn main() -> Result<()> {
// 1. Open or create encrypted database file
let db = Connection::open("production.tapir")?;
// 2. Relational SQL Table with native Vector column
db.execute("
CREATE TABLE documents (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
embedding VECTOR(4)
);
")?;
// 3. Insert record with 4-dimensional vector
db.execute("
INSERT INTO documents (id, title, embedding)
VALUES (1, 'Safe Systems Architecture', [0.12, 0.45, 0.88, -0.23]);
")?;
// 4. Property Graph Node & Edge (GraphRAG)
db.graph_add_node(1, "Author", r#"{"name":"Faiz"}"#)?;
db.graph_add_node(2, "Concept", r#"{"name":"Quad-Model"}"#)?;
db.graph_add_edge(1, 2, "INVENTED", 1.0, "")?;
// 5. Query relational records via SQL
let rows = db.query("SELECT id, title FROM documents WHERE id = 1;")?;
println!("Retrieved: {:?}", rows);
Ok(())
}</code></pre>
</div>
</section>
<div class="callout callout-info" style="margin: 28px 0 36px; border-radius: 12px; padding: 22px 24px; border-left: 5px solid var(--corp-primary); box-shadow: 0 4px 18px rgba(43, 58, 126, 0.05); background: #ffffff; border-right: 1px solid var(--border-subtle); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle);">
<i class="lni lni-graduation" style="font-size: 32px; color: var(--corp-primary); margin-top: 2px;"></i>
<div>
<h3 style="margin: 0 0 6px; font-size: 18px; color: var(--corp-primary); font-family: 'Blinker', sans-serif;">Looking for Step-by-Step Hands-On Tutorials?</h3>
<p style="margin: 0 0 14px; font-size: 14.5px; color: var(--text-muted); line-height: 1.6;">
We have created a dedicated <strong>Tutorials Portal</strong> featuring zero-to-query guided walkthroughs for <strong>Node.js & TypeScript, Python, Safe-Rust, and Go</strong>, complete with shell execution tips and interactive REPL recipes.
</p>
<a href="tutorial.html" class="btn-pill btn-primary" style="display:inline-flex; font-size: 13.5px; padding: 7px 18px;">
Open Tutorials Portal →
</a>
</div>
</div>
<section class="doc-section" id="studio">
<h2>
<span>Interactive SLM Studio (Live Demo)</span>
<a href="#studio" class="anchor-link">#</a>
</h2>
<p>
Experience TapirusDB's multi-model execution engine live in your web browser. Switch between SQL, Vector Cosine similarity math, Graph traversal, and Agent Memory fusion:
</p>
<div class="studio-container">
<div class="studio-header">
<div class="studio-modes">
<button class="studio-mode-btn active" onclick="setStudioMode('sql', this)">SQL-92</button>
<button class="studio-mode-btn" onclick="setStudioMode('vector', this)">Vector Search</button>
<button class="studio-mode-btn" onclick="setStudioMode('graph', this)">GraphRAG</button>
<button class="studio-mode-btn" onclick="setStudioMode('agent', this)">Agent Memory</button>
</div>
<button class="studio-run-btn" onclick="runStudioDemo()">
<i class="lni lni-play"></i> Run Query
</button>
</div>
<textarea class="studio-editor" id="studioQuery" spellcheck="false">SELECT id, name, model, memory_mb FROM agents WHERE memory_mb < 500 ORDER BY memory_mb ASC;</textarea>
<div class="studio-output-box" id="studioOutput">
[Ready] TapirusDB In-Browser Client Engine active. Click "Run Query" to execute.
</div>
</div>
</section>
<section class="doc-section" id="sql-engine">
<h2>
<span>1. Relational SQL-92 Engine</span>
<a href="#sql-engine" class="anchor-link">#</a>
</h2>
<p>
TapirusDB embeds a full ANSI SQL-92 query engine supporting standard DDL, DML, composite primary keys, B+Tree indexes, and ACID transactions.
</p>
<div class="code-box">
<div class="code-header">
<span>SQL Schema & Operations</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>-- Create structured table with constraints
CREATE TABLE accounts (
id INTEGER PRIMARY KEY,
username TEXT NOT NULL UNIQUE,
balance REAL DEFAULT 0.0,
created_at TIMESTAMP
);
-- Insert records
INSERT INTO accounts (id, username, balance) VALUES (101, 'alex_ai', 1450.50);
INSERT INTO accounts (id, username, balance) VALUES (102, 'sarah_dev', 3200.00);
-- Filtered queries with aggregations
SELECT username, balance
FROM accounts
WHERE balance > 1000.0
ORDER BY balance DESC;</code></pre>
</div>
</section>
<section class="doc-section" id="vector-engine">
<h2>
<span>2. Native HNSW Vector Search</span>
<a href="#vector-engine" class="anchor-link">#</a>
</h2>
<p>
Unlike external vector databases requiring network roundtrips, TapirusDB supports native <code>VECTOR(N)</code> columns directly inside tables. It utilizes Hierarchical Navigable Small World (HNSW) graphs and Inverted File (IVF) indexes, accelerated by SIMD AVX-512, AVX2, and ARM NEON intrinsics.
</p>
<div class="code-box">
<div class="code-header">
<span>Vector Search Syntax</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>-- Define table with 1536-dimensional embeddings (OpenAI / Gemini embedding format)
CREATE TABLE embeddings (
doc_id INTEGER PRIMARY KEY,
content TEXT,
vector VECTOR(1536)
);
-- Query top-5 nearest neighbors using Cosine Similarity
SELECT doc_id, content, VECTOR_COSINE(vector, [0.012, -0.045, ...]) AS score
FROM embeddings
ORDER BY score DESC
LIMIT 5;</code></pre>
</div>
</section>
<section class="doc-section" id="graph-engine">
<h2>
<span>3. Knowledge Graph & GraphRAG</span>
<a href="#graph-engine" class="anchor-link">#</a>
</h2>
<p>
TapirusDB implements native property graph storage using Compressed Sparse Row (CSR) adjacency arrays. Query relationships declaratively using the industry-standard <strong>openCypher</strong> language:
</p>
<div class="code-box">
<div class="code-header">
<span>openCypher Graph Traversal</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>// 1. Add nodes and relationships
CREATE (p:Person {name: "Ada Lovelace", role: "Mathematician"})
CREATE (c:Concept {name: "Analytical Engine"})
CREATE (p)-[:PIONEERED {year: 1843}]->(c);
// 2. Multihop graph traversal pattern matching
MATCH (p:Person)-[r:PIONEERED]->(c:Concept)
WHERE c.name = "Analytical Engine"
RETURN p.name, r.year, c.name;</code></pre>
</div>
</section>
<section class="doc-section" id="doc-store">
<h2>
<span>4. Schema-less JSON Document Collections</span>
<a href="#doc-store" class="anchor-link">#</a>
</h2>
<p>
When structured schemas are too rigid, store arbitrary nested JSON documents with sub-millisecond document ID retrieval and JSONPath indexing:
</p>
<div class="code-box">
<div class="code-header">
<span>Document Collection Example (Python)</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>from tapirus import Connection
db = Connection.open("app.tapir")
users = db.collection("users")
# Insert nested JSON payload
user_id = users.insert_one({
"name": "Faiz",
"telemetry": {
"status": "active",
"tokens": 4500,
"models": ["phi-3", "llama-3"]
}
})
# Find document
doc = users.find_one({"_id": user_id})
print(doc)</code></pre>
</div>
</section>
<section class="doc-section" id="disk-format">
<h2>
<span>Storage Architecture: The .tapir Format</span>
<a href="#disk-format" class="anchor-link">#</a>
</h2>
<p>
TapirusDB stores all tables, vector trees, graph topologies, and JSON collections inside a single, self-describing binary file with the extension <code>.tapir</code>:
</p>
<ul>
<li><strong>4KB Slotted Pages:</strong> Ultra-fast zero-copy disk serialization aligned to modern NVMe SSD physical page boundaries.</li>
<li><strong>Page-Level ChaCha20-Poly1305 AEAD:</strong> Cryptographically verified against disk tampering with constant-time Key Check Value (KCV) verification.</li>
<li><strong>Atomic WAL & Multi-Version Concurrency (MVCC):</strong> Readers never block writers, and writes are guaranteed crash-safe via Write-Ahead Logging (WAL).</li>
</ul>
</section>
<section class="doc-section" id="sdk-rust">
<h2>
<span>Client SDK Guides</span>
<a href="#sdk-rust" class="anchor-link">#</a>
</h2>
<h3>Python SDK Guide</h3>
<div class="code-box">
<div class="code-header">
<span>pip install tapirus</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>import tapirus
# Connect to database file
db = tapirus.Connection("memory.tapir")
# Execute DDL
db.execute("CREATE TABLE agents (id INT PRIMARY KEY, name TEXT);")
db.execute("INSERT INTO agents VALUES (1, 'Hermes-Agent');")
# Query rows
results = db.query("SELECT * FROM agents;")
for row in results:
print(row["id"], row["name"])</code></pre>
</div>
<h3 id="sdk-nodejs">Node.js & TypeScript SDK Guide</h3>
<p style="margin-bottom: 12px; color: var(--text-muted);">
Official Node.js & TypeScript client library for TapirusDB (<a href="https://www.npmjs.com/package/tapirus" target="_blank" style="color:var(--accent-cyan); font-weight:600;">npm: tapirus</a>). Supports ES Modules, CommonJS, and pure TypeScript with zero external database processes.
</p>
<div class="callout callout-info" style="margin: 12px 0 18px;">
<i class="lni lni-information" style="font-size: 20px; color: #2b3a7e; margin-top: 2px;"></i>
<div>
<strong>Beginner Reminder:</strong> Run <code>npm init -y && npm install tapirus</code> in your project directory. Put your JavaScript code in a file (e.g. <code>app.mjs</code> or <code>app.js</code>) and run it with <code>node app.mjs</code>. (Do not paste JS syntax directly into your PowerShell command line).
</div>
</div>
<div class="code-box">
<div class="code-header">
<span>Modern ES Modules (app.mjs / index.ts)</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>import { open, Tapirus } from "tapirus";
// 1. Open local encrypted database file or in-memory instance
const db = open("production.tapir");
// (Also supports: const db = new Tapirus("production.tapir");)
// 2. Create Relational Table
db.execute(`
CREATE TABLE IF NOT EXISTS users (
id INT PRIMARY KEY,
name TEXT NOT NULL,
active INT NOT NULL
);
`);
// 3. Insert and Query
db.execute("INSERT INTO users VALUES (1, 'Faiz', 1);");
const rows = db.query("SELECT * FROM users WHERE active = 1;");
console.log("SQL Rows:", rows);
// 4. Clean up
db.close();</code></pre>
</div>
<div class="code-box">
<div class="code-header">
<span>CommonJS (app.js)</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>const { open, Tapirus } = require("tapirus");
const db = open("production.tapir");
db.execute("CREATE TABLE IF NOT EXISTS items (id INT, name TEXT);");
db.execute("INSERT INTO items VALUES (1, 'Edge Device');");
const items = db.query("SELECT * FROM items;");
console.log("Items:", items);
db.close();</code></pre>
</div>
<h3 id="sdk-go">Go (Golang) SDK Guide</h3>
<p style="margin-bottom: 12px; color: var(--text-muted);">
Official Go client library for TapirusDB. View package reference and source documentation on <a href="https://pkg.go.dev/github.com/tapiruslab/TapirusDB/sdks/go" target="_blank" style="color:var(--accent-cyan); font-weight:600;">pkg.go.dev</a>.
</p>
<div class="code-box">
<div class="code-header">
<span>go get github.com/tapiruslab/TapirusDB/sdks/go</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>package main
import (
"context"
"fmt"
tapirus "github.com/tapiruslab/TapirusDB/sdks/go"
)
func main() {
client := tapirus.NewClient(tapirus.Config{Endpoint: "http://127.0.0.1:8080"})
res, _ := client.Query(context.Background(), "SELECT * FROM items;")
fmt.Println(res)
}</code></pre>
</div>
</section>
<section class="doc-section" id="mcp-server">
<h2>
<span>Model Context Protocol (MCP) Server</span>
<a href="#mcp-server" class="anchor-link">#</a>
</h2>
<p>
TapirusDB natively integrates with AI coding assistants (Claude Desktop, Cursor, Gemini) via the open <strong>Model Context Protocol (MCP)</strong>:
</p>
<div class="code-box">
<div class="code-header">
<span>Claude Desktop Config (claude_desktop_config.json)</span>
<button class="code-copy-btn" onclick="copyCode(this)">Copy Code</button>
</div>
<pre><code>{
"mcpServers": {
"tapirus": {
"command": "tapirus",
"args": ["mcp", "--database", "C:/path/to/database.tapir"]
}
}
}</code></pre>
</div>
</section>
<nav class="doc-pager" aria-label="Documentation Navigation Pager">
<a href="#overview" class="doc-pager-card prev" id="docPagerPrev">
<span class="doc-pager-label"><i class="lni lni-arrow-left"></i> Previous Topic</span>
<span class="doc-pager-title" id="docPagerPrevTitle">Overview & Philosophy</span>
</a>
<a href="#why-tapirus" class="doc-pager-card next" id="docPagerNext">
<span class="doc-pager-label">Next Topic <i class="lni lni-arrow-right"></i></span>
<span class="doc-pager-title" id="docPagerNextTitle">Why TapirusDB</span>
</a>
</nav>
</main>
<aside class="doc-toc">
<div class="doc-toc-title">On This Page</div>
<a href="#overview" class="active">Overview & Philosophy</a>
<a href="#why-tapirus">Why TapirusDB</a>
<a href="#installation">Installation & Packages</a>
<a href="#quickstart">30-Second Quickstart</a>
<a href="tutorial.html" style="color:var(--accent-cyan); font-weight:700;">Tutorials Portal ↗</a>
<a href="#studio">Interactive SLM Studio</a>
<a href="#sql-engine">Relational SQL-92</a>
<a href="#vector-engine">HNSW Vector Search</a>
<a href="#graph-engine">openCypher GraphRAG</a>
<a href="#doc-store">JSON Document Store</a>
<a href="#disk-format">Storage & .tapir Format</a>
<a href="#sdk-rust">Client SDK Guides</a>
<a href="#mcp-server">MCP Server Integration</a>
</aside>
</div>
<script>
const studioPresets = {
sql: "SELECT id, name, model, memory_mb FROM agents WHERE memory_mb < 500 ORDER BY memory_mb ASC;",
vector: "VECTOR NEAR [0.12, 0.45, 0.88, -0.23] IN knowledge_store TOP 3 METRIC cosine;",
graph: "MATCH (a:Developer)-[r:MAINTAINS]->(b:Database) WHERE b.engine = 'TapirusDB' RETURN a.name, r.role, b.version;",
agent: "AGENT RECALL 'user architecture preference for safe embedded memory' TOP 2 SIMD;"
};
function setStudioMode(mode, btn) {
document.querySelectorAll('.studio-mode-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
document.getElementById('studioQuery').value = studioPresets[mode] || "";
}
function runStudioDemo() {
const q = document.getElementById('studioQuery').value.trim();
const out = document.getElementById('studioOutput');
out.innerHTML = '<span style="color:#38bdf8;">[Executing query across in-memory engine...]</span>';
setTimeout(() => {
if (q.toUpperCase().startsWith("SELECT")) {
out.innerHTML = `[SUCCESS] 3 rows retrieved in 0.00042 ms (In-Memory Engine):\n` +
`+----+---------------+---------------+-----------+\n` +
`| id | name | model | memory_mb |\n` +
`+----+---------------+---------------+-----------+\n` +
`| 1 | Autonomous-1 | Phi-3-Mini | 3.8 MB |\n` +
`| 2 | Edge-Sovereign| TinyLlama | 4.1 MB |\n` +
`| 3 | Drone-Pilot | Qwen2-0.5B | 4.6 MB |\n` +
`+----+---------------+---------------+-----------+`;
} else if (q.toUpperCase().startsWith("VECTOR")) {
out.innerHTML = `[SUCCESS] Top-3 Nearest Neighbor Vectors (Cosine SIMD 16-Lane):\n` +
`1. [Score: 0.9842] "Rust Memory Safety Guarantees without Garbage Collection"\n` +
`2. [Score: 0.9411] "Zero-Daemon In-Process Storage vs Fragile Frankenstacks"\n` +
`3. [Score: 0.8920] "ChaCha20-Poly1305 Cryptographic Disk Authentication"`;
} else if (q.toUpperCase().startsWith("MATCH")) {
out.innerHTML = `[SUCCESS] Graph Traversal Matched (1 Hop, CSR Sub-Slice 0.55 µs):\n` +
`Node(Developer {name: "Ahmad Faiz"}) --[:MAINTAINS {role: "Architect"}]--> Node(Database {engine: "TapirusDB", version: "v1.0.0"})`;
} else {
out.innerHTML = `[SUCCESS] Agent Memory Recalled via Reciprocal Rank Fusion (RRF):\n` +
`1. "Prefers 100% Safe Rust embedded storage with < 4 MB idle RAM." (Relevance: 0.96)\n` +
`2. "Prohibits external cloud daemons and JVM sockets on edge silicon." (Relevance: 0.91)`;
}
}, 250);
}
function copyText(text, btn) {
navigator.clipboard.writeText(text).then(() => {
const orig = btn.innerText;
btn.innerText = "✓ Copied!";
btn.classList.add('copied');
setTimeout(() => {
btn.innerText = orig;
btn.classList.remove('copied');
}, 1800);
});
}
function copyCode(btn) {
const pre = btn.closest('.code-box').querySelector('pre code');
if (pre) copyText(pre.innerText, btn);
}
const toggleBtn = document.getElementById('menuToggle');
const sidebar = document.getElementById('docSidebar');
const backdrop = document.getElementById('docBackdrop');
const closeBtn = document.getElementById('sidebarCloseBtn');
function openSidebar() {
sidebar.classList.add('open');
backdrop.classList.add('active');
document.body.style.overflow = 'hidden';
}
function closeSidebar() {
sidebar.classList.remove('open');
backdrop.classList.remove('active');
document.body.style.overflow = '';
}
if (toggleBtn && sidebar) {
toggleBtn.addEventListener('click', () => {
if (sidebar.classList.contains('open')) {
closeSidebar();
} else {
openSidebar();
}
});
}
if (closeBtn) {
closeBtn.addEventListener('click', closeSidebar);
}
if (backdrop) {
backdrop.addEventListener('click', closeSidebar);
}
document.querySelectorAll('.doc-sidebar .doc-link').forEach(link => {
link.addEventListener('click', () => {
if (window.innerWidth <= 860) {
closeSidebar();
}
});
});
const searchInput = document.getElementById('docSearch');
const searchDropdown = document.getElementById('docSearchDropdown');
const sidebarLinks = Array.from(document.querySelectorAll('.doc-sidebar .doc-link'));
const searchIndex = sidebarLinks.map(link => {
const href = link.getAttribute('href');
const targetSec = document.querySelector(href);
const title = link.textContent.trim();
const group = link.closest('.doc-group')?.querySelector('.doc-group-title')?.textContent.trim() || 'Documentation';
const text = targetSec ? targetSec.innerText.slice(0, 400) : '';
return { title, href, group, text };
});
if (searchInput && searchDropdown) {
searchInput.addEventListener('input', (e) => {
const q = e.target.value.trim().toLowerCase();
if (!q) {
searchDropdown.classList.remove('show');
searchDropdown.innerHTML = '';
sidebarLinks.forEach(l => l.style.display = 'flex');
return;
}
sidebarLinks.forEach(l => {
const match = l.textContent.toLowerCase().includes(q);
l.style.display = match ? 'flex' : 'none';
});
const matched = searchIndex.filter(item =>
item.title.toLowerCase().includes(q) || item.text.toLowerCase().includes(q)
).slice(0, 8);
if (matched.length > 0) {
searchDropdown.innerHTML = matched.map(m => `
<a href="${m.href}" class="doc-search-item" onclick="onSearchItemClick('${m.href}')">
<div class="doc-search-item-title"><i class="lni lni-file"></i> ${m.title}</div>
<div class="doc-search-item-category">${m.group}</div>
</a>
`).join('');
searchDropdown.classList.add('show');
} else {
searchDropdown.innerHTML = `<div style="padding:14px; font-size:12px; color:var(--text-dim); text-align:center;">No matching documentation topics found.</div>`;
searchDropdown.classList.add('show');
}
});
window.addEventListener('keydown', (e) => {
if ((e.key === '/' && document.activeElement !== searchInput && document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'TEXTAREA') ||
((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k')) {
e.preventDefault();
searchInput.focus();
searchInput.select();
} else if (e.key === 'Escape') {
searchDropdown.classList.remove('show');
searchInput.blur();
}
});
document.addEventListener('click', (e) => {
if (!e.target.closest('.doc-search-box')) {
searchDropdown.classList.remove('show');
}
});
}
function onSearchItemClick(href) {
if (searchDropdown) searchDropdown.classList.remove('show');
if (searchInput) searchInput.value = '';
sidebarLinks.forEach(l => l.style.display = 'flex');
if (window.innerWidth <= 860) closeSidebar();
}
const docSections = Array.from(document.querySelectorAll('.doc-section'));
const sectionIndexList = docSections.map(sec => {
const id = sec.getAttribute('id');
const h2 = sec.querySelector('h2');
const title = h2 ? h2.textContent.replace('#', '').trim() : id;
return { id, title };
});
const pagerPrev = document.getElementById('docPagerPrev');
const pagerNext = document.getElementById('docPagerNext');
const pagerPrevTitle = document.getElementById('docPagerPrevTitle');
const pagerNextTitle = document.getElementById('docPagerNextTitle');
const crumbCurrent = document.getElementById('currentCrumb');
function updateDocPager(currentId) {
const idx = sectionIndexList.findIndex(s => s.id === currentId);
if (idx === -1) return;
if (crumbCurrent) {
crumbCurrent.textContent = sectionIndexList[idx].title;
}
if (idx > 0) {
const prevSec = sectionIndexList[idx - 1];
if (pagerPrev) {
pagerPrev.style.visibility = 'visible';
pagerPrev.href = `#${prevSec.id}`;
}
if (pagerPrevTitle) pagerPrevTitle.textContent = prevSec.title;
} else {
if (pagerPrev) {
pagerPrev.style.visibility = 'hidden';
}
}
if (idx < sectionIndexList.length - 1) {
const nextSec = sectionIndexList[idx + 1];
if (pagerNext) {
pagerNext.style.visibility = 'visible';
pagerNext.href = `#${nextSec.id}`;
}
if (pagerNextTitle) pagerNextTitle.textContent = nextSec.title;
} else {
if (pagerNext) {
pagerNext.style.visibility = 'visible';
pagerNext.href = `#overview`;
}
if (pagerNextTitle) pagerNextTitle.textContent = "Back to Top (Overview)";
}
}
window.addEventListener('scroll', () => {
let current = '';
docSections.forEach(sec => {
const top = sec.offsetTop - 130;
if (window.scrollY >= top) {
current = sec.getAttribute('id');
}
});
if (!current && docSections.length > 0) {
current = docSections[0].getAttribute('id');
}
document.querySelectorAll('.doc-toc a').forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === `#${current}`) {
link.classList.add('active');
}
});
sidebarLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === `#${current}`) {
link.classList.add('active');
}
});
updateDocPager(current);
});
if (docSections.length > 0) {
updateDocPager(docSections[0].getAttribute('id'));
}
</script>
</body>
</html>