MCPcopy Index your code
hub / github.com/docat-org/docat

github.com/docat-org/docat @1.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.6.0 ↗ · + Follow
238 symbols 573 edges 54 files 56 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

docat

Host your docs. Simple. Versioned. Fancy.

build Gitter

Why DOCAT?

When generating static documentation using mkdocs, sphinx, ... hosting just one version of the docs might not be enough. Many users might still use older versions and might need to read those versions of the documentation.

Docat solves this problem by providing a simple tool that hosts multiple documentation projects with multiple versions.

The main design decision with docat was to keep the tool as simple as possible.

Getting started

The simplest way to get started is to run the docker container, you can optionally use volumes to persist state:

# run container in background and persist data (docs, nginx configs and tokens database)
# use 'ghcr.io/docat-org/docat:unstable' to get the latest changes
mkdir -p docat-run/doc
docker run \
  --detach \
  --volume $PWD/docat-run:/var/docat/ \
  --publish 8000:80 \
  ghcr.io/docat-org/docat

Go to localhost:8000 to view your docat instance:

Using DOCAT

🛈 Please note that docat does not provide any way to write documentation. It's sole responsibility is to host documentation.

There are many awesome tools to write documenation: - mkdocs - sphinx - mdbook - ...

A CLI tool called docatl is available for easy interaction with the docat server. However, interacting with docat can also be done through curl.

To push documentation (and tag as latest) in the folder docs/ simply run:

docatl push --host http://localhost:8000 ./docs PROJECT VERSION --tag latest

More detailed instructions can be found in the getting started guide.

Authentication

By default, anyone can upload new documentation or add a new version to documentation. A project can be claimed. A claim returns a token that then must be used to add or delete versions.

When hosting docat publicly, it is recommended to use http basic auth for all POST/PUT and DELETE http calls.

docat http basic authentication example

This example shows how to configure the NGINX inside the docker image to be password protected using http basic auth.

1) Create your .htpasswd file. 2) And a custom default NGINX config:

``` upstream python_backend { server 127.0.0.1:5000; }

server { listen 80 default_server; listen [::]:80 default_server;

  root /var/www/html;

  add_header Content-Security-Policy "frame-ancestors 'self';";
  index index.html index.htm index.pdf /index.html;

  server_name _;

  location /doc {
      root /var/docat;
  }

  location /api {
      limit_except GET HEAD {
          auth_basic 'Restricted';
          auth_basic_user_file /etc/nginx/.htpasswd;
      }

      client_max_body_size $MAX_UPLOAD_SIZE;
      proxy_pass http://python_backend;
  }

  location / {
      try_files $uri $uri/ =404;
  }

} ```

1) Mounted to the correct location inside the container:

docker run \ --detach \ --volume $PWD/docat-run:/var/docat/ \ --volume $PWD/nginx/default:/app/docat/docat/nginx/default \ --volume $PWD/nginx/.htpasswd:/etc/nginx/.htpasswd \ --publish 8000:80 \ ghcr.io/docat-org/docat

Configuring DOCAT

Frontend Config

It is possible to configure some things after the fact.

  1. Create a config.json file
  2. Mount it inside your docker container --volume $PWD/config.json:/var/docat/doc/config.json

Supported config options:

{
  "headerHTML": "<h1 style='color: #115fbf;'>Custom Header HTML!</h1>",
  "footerHTML": "CONTACT: <a href='mailto:maintainer@mail.invalid'>Maintainers</a>"
}

System Config

Further proxy configurations can be done through the following environmental variables:

Variable Default Description
MAX_UPLOAD_SIZE 100M Limits the size of individual archives posted to the API

Local Development

For local development, first configure and start the backend (inside the docat/ folder):

# create a folder for local development (uploading docs)
DEV_DOCAT_PATH="$(mktemp -d)"

# install dependencies
uv venv .venv
uv sync

# run the local development version
DOCAT_SERVE_FILES=1 DOCAT_STORAGE_PATH="$DEV_DOCAT_PATH" uv run python -m docat

After this you need to start the frontend (inside the web/ folder):

# install dependencies
yarn install --frozen-lockfile

# run the web app
yarn start

For more advanced options, have a look at the backend and web docs.

Extension points exported contracts — how you extend this code

ImportMetaEnv (Interface)
(no doc)
web/vite-env.d.ts
Props (Interface)
(no doc)
web/src/components/DataSelect.tsx
ImportMeta (Interface)
(no doc)
web/vite-env.d.ts
Props (Interface)
(no doc)
web/src/components/StyledForm.tsx
Props (Interface)
(no doc)
web/src/components/Project.tsx
Props (Interface)
(no doc)
web/src/components/DocumentControlButtons.tsx
Props (Interface)
(no doc)
web/src/components/ProjectList.tsx

Core symbols most depended-on inside this repo

create_symlink
called by 6
docat/docat/utils.py
get_project_details
called by 6
docat/docat/utils.py
check_token_for_project
called by 6
docat/docat/app.py
Header
called by 6
web/src/components/Header.tsx
validate
called by 6
web/src/pages/Delete.tsx
useMessageBanner
called by 6
web/src/data-providers/MessageBannerProvider.tsx
useProjects
called by 5
web/src/data-providers/ProjectDataProvider.tsx
remove_docs
called by 4
docat/docat/utils.py

Shape

Function 180
Interface 24
Route 23
Class 10
Method 1

Languages

Python51%
TypeScript49%

Modules by API surface

docat/docat/app.py25 symbols
docat/tests/test_hide_show.py20 symbols
docat/tests/test_project.py14 symbols
docat/docat/utils.py13 symbols
web/src/repositories/ProjectRepository.ts12 symbols
web/src/pages/Docs.tsx10 symbols
docat/tests/test_upload.py10 symbols
docat/tests/test_upload_icon.py8 symbols
docat/docat/models.py8 symbols
web/src/components/FileInput.tsx7 symbols
docat/tests/test_utils.py7 symbols
web/src/pages/Delete.tsx6 symbols

For agents

$ claude mcp add docat \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact