Skip to content

lgwk42/notion-docs

Repository files navigation

Notion Docs

A Spring Boot auto-configuration library that scans your REST controllers at startup and automatically generates structured API documentation in Notion.

Each endpoint becomes a database row with filterable/sortable properties (method, URI, domain, auth roles, progress) and a detail page with request/response examples and parameter tables.

Tech Stack

Layer Technology
Language Java 21
Framework Spring Boot 3.x (Auto-Configuration)
Build Gradle / Maven
API Notion REST API (2022-06-28)
HTTP Client JDK HttpClient
JSON Jackson Databind
Validation Jakarta Validation API

How It Works

┌──────────────────────────────────────────────────────────┐
│                   Spring Boot Application                │
│                                                          │
│  @RestController ──┐                                     │
│  @RestController ──┼── ApplicationReadyEvent             │
│  @RestController ──┘          │                          │
│                               ▼                          │
│                     ┌─────────────────┐                  │
│                     │  NotionDocSync  │                  │
│                     │    Listener     │                  │
│                     └────────┬────────┘                  │
│                              │ (virtual thread)          │
└──────────────────────────────┼───────────────────────────┘
                               │
              ┌────────────────┼────────────────┐
              ▼                ▼                ▼
     ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐
     │   Scanner    │ │    Sync      │ │  Notion Client   │
     │              │ │              │ │                  │
     │ • Endpoint   │ │ • Change     │ │ • Create DB      │
     │   scanning   │ │   detection  │ │ • Create/Update  │
     │ • @NotionDoc │ │   (SHA-256)  │ │   rows           │
     │   metadata   │ │ • DB manager │ │ • Append blocks  │
     │ • DTO field  │ │              │ │                  │
     │   extraction │ │              │ │                  │
     └──────┬───────┘ └──────┬───────┘ └─────────┬────────┘
            │                │                   │
            ▼                ▼                   ▼
     ┌─────────────────────────────────────────────────────┐
     │                  Notion Render                      │
     │                                                     │
     │  • Database schema & row properties                 │
     │  • Page body blocks (headings, tables, code blocks) │
     │  • JSON example generation                          │
     │  • Parameter table with dot notation flattening     │
     └─────────────────────────────────────────────────────┘
                               │
                               ▼
                    ┌─────────────────────┐
                    │    Notion Database  │
                    │                     │
                    │ ┌─────────────────┐ │
                    │ │ API │ URI │ ... │ │
                    │ ├─────┼─────┼─────┤ │
                    │ │ Row → DetailPage│ │
                    │ │ Row → DetailPage│ │
                    │ └─────────────────┘ │
                    └─────────────────────┘

Generated Notion Database Columns

Column Type Description
API Title API display name
URI Rich Text Endpoint path
METHOD Select GET / POST / PUT / PATCH / DELETE
AUTH Multi-Select Access roles (ALL, USER, ADMIN, OWNER, MASTER)
DOMAIN Select Domain category
PROGRESS Select Not Started / In Progress / Done

Generated Page Body Structure

## Description
  API description text

## Request
  ### Request Body          ← POST / PUT / PATCH
    { JSON example }
    | Parameter | Type | Description |

  ### Request Param         ← GET / DELETE (or additional query params)
    | Parameter | Type | Description |

## Response
  { JSON example }                ← single response (inferred from return type)
  | Parameter | Type | Description |

  ### 200 Success               ← multi-response (via @Response annotation)
  ### 404 Not Found
  ### 403 Forbidden

Documentation

Contact

About

Spring Boot Notion API Documentation Automation Library

Topics

Resources

License

Contributing

Security policy

Stars

7 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages