GET /api/self

The Ouroboros Endpoint - Documentation about the documentation system itself.

Description

This is the most self-referential endpoint in the GROOV API. It describes:

  • How the API documents itself
  • The philosophy behind self-documenting systems
  • The technical implementation of the Ouroboros pattern
  • How this very page participates in the loop

The Ouroboros Philosophy

"The snake biting its own tail" - Ancient symbol of completeness and eternity

What Is Self-Documentation?

Traditional documentation:

Code → (Manual Process) → Documentation
                ↓
         (Gets outdated, incomplete, wrong)

GROOV self-documentation:

    ┌──────────────────────────┐
    │   Grav CMS Content       │
    │   (API Documentation)    │ ←──┐
    └──────────┬───────────────┘    │
               │                     │
               │ Served via          │
               ▼                     │
    ┌──────────────────────────┐    │
    │   Grav REST API          │    │
    │   (The API being         │    │
    │    documented)           │    │
    └──────────┬───────────────┘    │
               │                     │
               │ Consumed by         │
               ▼                     │
    ┌──────────────────────────┐    │
    │   GROOV Browser          │    │
    │   (Displays docs from    │    │
    │    the API it documents) │────┘
    └──────────────────────────┘
         The snake bites its tail

How GROOV Works

Layer 1: Content Storage

  • API documentation stored as Grav CMS pages
  • Written in Markdown with YAML frontmatter
  • Version controlled with Git
  • Changes automatically deployed

Layer 2: API Serving

  • Grav's native JSON rendering serves content
  • No external API framework needed
  • Add .json to any route → get JSON response
  • Process → Twig enables dynamic content

Layer 3: Self-Reference

  • Each endpoint's documentation is itself a page
  • Fetching /api/self.json returns this page
  • The documentation proves itself by working

Layer 4: Browser/Consumer

  • GROOV browser (org-viewer based) reads API
  • Displays documentation fetched from the API
  • Users can try endpoints described in the docs
  • Creates living, interactive documentation

Technical Implementation

Grav Page → JSON Response

Page file: /user/pages/03.api/default.md

---
title: 'GROOV API'
process:
    markdown: true
    twig: true
visible: true
routable: true
---

# Content here

Access patterns:

  • HTML: https://api.infinity.b0x.store/api
  • JSON: https://api.infinity.b0x.store/api.json

Same content, different formats - no code duplication.

Dynamic Content with Twig

*Generated: 2025-12-10 13:18:25*

Renders as current timestamp every time page is accessed. Documentation is always current.

Self-Validation

This endpoint can validate itself:

# Fetch this page's documentation
curl https://api.infinity.b0x.store/api/self.json

# Verify it describes itself
jq '.title' response.json
# Output: "Self Endpoint - The Meta-Documentation"

# Read how to read itself
jq '.content' response.json | grep "curl.*api/self"

The documentation proves it works by responding to the request.

Philosophical Implications

Gödel's Completeness Theorem Applied to Docs

  • Internal consistency: Docs always match API (they ARE the API)
  • Provability: Every endpoint can be proven to exist (query /api/pages)
  • Completeness: The system contains its own description

Strange Loops (Hofstadter)

This endpoint creates a "strange loop":

  1. You read documentation about self-documentation
  2. To understand it, you fetch this page via the API
  3. This page describes fetching itself
  4. Reading creates understanding, which validates the description
  5. The loop is complete

Practical Benefits

For Developers:

  • Documentation cannot be outdated (it's the API)
  • Cannot be incomplete (every page is documented)
  • Cannot be wrong (broken docs = broken API)

For Users:

  • Interactive: Try endpoints while reading docs
  • Current: Always reflects actual API state
  • Discoverable: Browse from API root to any endpoint

For Maintainers:

  • Update docs = update API (same file)
  • Git history shows doc + code changes together
  • Automated testing validates documentation

The Meta-Loop

Reading this page creates multiple levels of self-reference:

  1. Level 1: This page documents the /api/self endpoint
  2. Level 2: This page is the /api/self endpoint
  3. Level 3: This page explains that it is itself
  4. Level 4: You are reading this explanation
  5. Level 5: This sentence references your reading
  6. : The loop continues infinitely

Each level contains the level below it, like Russian dolls or fractal patterns.

Implementation at Infinity Collective

Current State (2025-12-04)

  • Service: api.infinity.b0x.store
  • Technology: Grav CMS (PHP)
  • Deployment: Kubernetes (K3s)
  • Namespace: infinity-web
  • Pod: groov-backend-*

Endpoints Documented

Vision (GROOV Evolution)

  1. Interactive API Browser: Web UI powered by org-viewer
  2. Try It Now: Execute API calls from documentation
  3. Schema Generation: Auto-generate OpenAPI specs from pages
  4. Cross-Service Documentation: Link iApp, EventPress, etc.

How to Contribute

Since the documentation is the API:

  1. Edit markdown files in /user/pages/
  2. Commit to Git
  3. Deploy to Kubernetes
  4. Documentation automatically updated

No separate doc builds, no external tools - pure simplicity.

The Eternal Loop

This page will always exist as long as the API exists. It documents the system that serves it. It proves itself by being readable. It creates knowledge by describing knowledge.

The snake bites its tail. The circle is complete. 🐍


Generated: 2025-12-10 13:18:25

This page is part of the infinite loop it describes.