Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

Moekura is a self-hostable booru: an image board where posts are found by their tags. The same program and database layout serve a private, single-user collection on a small VPS or Raspberry Pi and a public site with millions of posts, many web servers and a CDN. Growing a site means changing configuration and running more processes, never switching software.

What it does:

  • Posts: upload images (JPEG, PNG, GIF, WebP, AVIF, optionally JPEG XL) and videos (MP4, WebM) from a file or a link. Exact duplicates are refused; similar images are found by their perceptual hash.
  • Tags: categories (general, artist, copyright, character, meta), aliases and implications, autocomplete, and a search syntax with tags, wildcards and filters. An optional tagger suggests tags for new uploads with a machine learning model, on the CPU.
  • People: accounts with roles, favorites, votes, blacklists and per-user settings; registration can be open, invite-only, approved by staff, or closed.
  • Moderation: an approval queue, flags, deletion with reasons, bans of users and networks, and a log of every staff action.
  • Private sites: keep everything behind a login, with file links that expire.
  • An API covering what the site does, with API keys and a reference generated from the code.

It is free software under the AGPL-3.0: if you run a modified version as a public service, you must publish your changes.

Start with installing it with Docker Compose.

Hardware

A small site runs on a VPS with 1 GB of memory and two cores: Docker Compose’s tiny setup is tuned for that, and CI runs the end-to-end tests on every change with the stack limited to it. More memory mostly buys a bigger database cache, which matters once the database outgrows it. The tagger needs about 1 GB more; its page has its numbers.

Numbers marked measured come from moekura admin bench-http and admin bench (see Scaling) against the tiny stack, with the app and PostgreSQL containers limited to 384 MB and 512 MB of memory and two cores each, on an AMD Ryzen 7 7800X3D with an NVMe SSD, with release 0.5.0 unless a row says otherwise. The posts were generated by admin seed, with comments, notes, pools and favorites, but no files.

What CI checks

These are promises, not just measurements: CI runs the tiny stack with the limits above (on GitHub’s runners, which are slower than the machine above) and fails a change that breaks one of them.

  • moekura serve uses under 64 MB right after it starts,
  • and never more than 150 MB: through the end-to-end tests, a burst of 32 requests at a time to every page, and, on the main branch, all that again with 200,000 posts;
  • with 200,000 posts, every page and API response in admin bench-http answers in under 100 ms at the 95th percentile, one request at a time (on the main branch);
  • nothing runs out of memory or restarts.

Memory

Measured:

Right after startAfter the e2e tests200,000 posts, after a burst of requests
moekura serve (web and jobs), at its peak40 MB88 MB88 MB
PostgreSQL (the compose settings)54 MB133 MB294 MB

moekura serve stays under 150 MB; CI fails if it doesn’t. PostgreSQL grows to its shared_buffers (128 MB in the compose file) plus what its connections use. Making thumbnails runs vips and ffmpeg for a moment per upload, which for large images and videos takes some more; see Limits on media tools to bound it.

That leaves about 150 MB of a 1 GB machine for the system and for the operating system’s file cache. Adding swap is a cheap safety net.

Speed

Measured, p95 in milliseconds for one request at a time:

Posts (database size)Pages and APIsSearches
100,000 (240 MB), before 0.5under 4not measured
200,000 (520 MB)under 5mostly under 25; a file type with a common tag 53
1,000,000 (2.1 GB), before 0.5, one core eachunder 6mostly under 60

With the database four times the memory, most searches stay fast, but the few that read many posts do not: a common word in notes (note:) takes about 0.9 s, a user’s saved searches (search:all) 0.4 s, a file type with a common tag 0.25 s, and pool:any and tagger suggestions (ai:) about 0.1 s. For a site that size, 2–4 GB of memory should keep the database cached and bring those back under 100 ms, as they are for 5,000,000 posts on a large machine on the Scaling page (estimated).

5,000,000 posts

Measured with 0.5.0 on the whole machine (16 threads, 32 GB of memory), PostgreSQL given shared_buffers = 4GB, an 11 GB database: every page and API response’s p95 was under 5 ms one request at a time and under 11 ms sixteen at a time, and moekura serve peaked at 51 MB. Searches were mostly under 40 ms, the slowest a user’s saved searches (0.1 s) and a common word in notes (77 ms). Scaling has each search and page.

Seeding shows what writing costs: about 1,250 posts a second on two cores (1,350 on the whole machine), database work only.

Disk

  • Database: about 2 KB per post measured, with a site’s worth of tags, comments, notes and tagger suggestions (2.1 GB for 1,000,000 posts).
  • Files: the originals, plus thumbnails and, for large images, a sample; estimated at 20–30% on top of the originals, depending on media.thumbnail_sizes and media.sample_size.
  • Images: about 180 MB for Moekura’s and 300 MB for PostgreSQL’s.

An SSD matters more than cores: searches that miss the cache read pages from disk at random.

Raspberry Pi 4

Estimated, not measured: a Raspberry Pi 4 with 2 GB or more should run the tiny setup (the images are built for arm64), its cores being a few times slower than a desktop’s. Expect pages several times slower than above, still well under a second for a small site. Keep the database on an SSD over USB 3 rather than the SD card, which is slow at random reads and wears out. If you run one, moekura admin bench-http measures it.

With Docker Compose

The smallest setup is the app and PostgreSQL on one machine. The repository’s deploy/compose.tiny.yml runs both with Docker or Podman Compose:

git clone https://github.com/moe-studios/moekura
cd moekura
echo "POSTGRES_PASSWORD=$(openssl rand -hex 16)" > deploy/.env
MOEKURA_BUILD_VERSION="git-$(git rev-parse --short=7 HEAD)" \
  docker compose -f deploy/compose.tiny.yml up -d
curl localhost:8080/readyz   # → ok

Open http://localhost:8080. The database is migrated automatically on start.

The app’s port is published on 127.0.0.1 only, so only this machine reaches it: other people come in through a reverse proxy, which adds HTTPS and limits on what each client may do. Docker’s published ports get past host firewalls such as ufw, so changing it to "8080:8080" (to try the site from another machine on your network, say) puts the app on every network the machine is on, without the proxy’s protection; the app’s own connection limits still apply.

Two volumes hold everything worth keeping: db (PostgreSQL) and files (uploads and thumbnails). Back them up together; see Backups.

The PostgreSQL settings in the file suit a machine with 1 GB of memory; Hardware has what the stack needs and how to grow it.

The image (about 180 MB) includes its own builds of libvips and ffmpeg with only the formats Moekura accepts.

To suggest tags for uploads with the tagger, add its compose file:

MOEKURA_BUILD_VERSION="git-$(git rev-parse --short=7 HEAD)" \
  docker compose -f deploy/compose.tiny.yml -f deploy/compose.tagger.yml up -d

Published images

Images are published to ghcr.io/moe-studios/moekura for AMD64 and ARM64:

  • 0.8.0 (for example): a release; 0.8 tracks its patch releases, and from 1.0 on 1 tracks every 1.x release; latest tracks stable releases.
  • edge: the latest published main branch commit.
  • git-<hash>: a specific commit, using either its seven-character or full hash.

Append -tagger to any tag for the tagger image, such as edge-tagger. The page footer shows the release version or git-<short hash> embedded in that build. Main builds do not move latest.

The compose files build from source. Since the Docker context excludes .git, the commands above pass the version as a build argument. When building a release checkout, set MOEKURA_BUILD_VERSION to its semver (without v).

Settings

Configure the app with MOEKURA_* environment variables in the compose file, for example:

    environment:
      MOEKURA_DATABASE__URL: postgres://moekura:${POSTGRES_PASSWORD}@db/moekura
      MOEKURA_SERVER__PUBLIC_URL: https://booru.example.com
      MOEKURA_MEDIA__MAX_UPLOAD_MB: "200"

Every setting is listed under Configuration. Put the site behind a reverse proxy for HTTPS, which also means pinning the network and publishing the port on the loopback only, then continue with First steps.

Updating

git pull
MOEKURA_BUILD_VERSION="git-$(git rev-parse --short=7 HEAD)" \
  docker compose -f deploy/compose.tiny.yml up -d --build

Migrations run when the new version starts.

Without containers

You need:

  • PostgreSQL 16 or newer, and a database the app owns (see Requirements for every version).
  • The media tools, which serve and worker check for at startup:
ToolUsed forFedoraDebian / Ubuntu
libvips 8.15+ (vips, vipsheader, vipsthumbnail)reading images, thumbnails, perceptual hashesvips-tools (AVIF: vips-heif, JPEG XL: vips-jxl)libvips-tools libheif-plugin-dav1d libheif-plugin-aomenc
ffmpeg 7.0+ (ffmpeg, ffprobe)reading videos, poster frames, and videos of ugoira (with libvpx for VP9; HEVC posters need its HEVC decoder, which ffmpeg-free may lack)ffmpeg (RPM Fusion) or ffmpeg-freeffmpeg
  • OpenSSL 3 (libssl.so.3), which checks passkeys’ signatures: usually installed already (openssl-libs on Fedora, libssl3t64 on Debian and Ubuntu). Building from source also needs its headers and pkg-config (openssl-devel on Fedora, libssl-dev pkg-config on Debian and Ubuntu).

Download a release binary (see Upgrading), or build one with Rust 1.94 or newer:

cargo build --release
sudo install target/release/moekura /usr/local/bin/

Create the database:

sudo -u postgres createuser --pwprompt moekura
sudo -u postgres createdb --owner moekura moekura

Then write /etc/moekura/moekura.toml (start from moekura.example.toml in the repository) with at least:

[server]
public_url = "https://booru.example.com"
# Only the reverse proxy on this machine connects.
bind = "127.0.0.1:8080"
trusted_proxies = ["127.0.0.1/32"]

[database]
url = "postgres://moekura:PASSWORD@localhost/moekura"

[storage]
path = "/var/lib/moekura/data"

and start it:

moekura --config /etc/moekura/moekura.toml serve

As a systemd service

# /etc/systemd/system/moekura.service
[Unit]
Description=Moekura
After=network-online.target postgresql.service
Wants=network-online.target

[Service]
User=moekura
Environment=MOEKURA_CONFIG=/etc/moekura/moekura.toml
# Keeps memory use down after bursts of requests (as in the image).
Environment=MALLOC_ARENA_MAX=2
ExecStart=/usr/local/bin/moekura serve
Restart=on-failure
# Keep the database password out of the config file:
# EnvironmentFile=/etc/moekura/secrets.env

[Install]
WantedBy=multi-user.target
sudo useradd --system --home-dir /var/lib/moekura --create-home moekura
sudo systemctl enable --now moekura

moekura check-config prints the settings it would use, with secrets redacted.

Behind a reverse proxy

Put a reverse proxy in front of the app for HTTPS. Then tell the app two things:

  • server.public_url: the https:// address people use. Cookies are then marked Secure, and forms are only accepted from that origin.
  • server.trusted_proxies: the proxy’s address. The app believes the X-Forwarded-For header only from these, and uses it for bans and rate limits. Without it, every visitor appears to come from the proxy.
[server]
public_url = "https://booru.example.com"
trusted_proxies = ["127.0.0.1/32"]

The address to list is the one the app sees the proxy connect from, which isn’t always 127.0.0.1: with Docker Compose, a proxy on the host reaches the app from the compose network’s gateway (see below). If the header comes from an address that isn’t listed, the app ignores it and logs a warning naming that address, once after each start. IPv4 addresses are compared as IPv4, also when the app listens on IPv6 as well ([::]), so 127.0.0.1/32 and ::ffff:127.0.0.1/128 mean the same.

Trust only your proxies’ addresses, and keep the app’s port unreachable from elsewhere, or anyone who can reach it directly can claim any address.

The app reads X-Forwarded-For from the right: it skips the entries your trusted proxies added and takes the first address before them. Entries further left were written by the client and are ignored, and so is everything left of an entry that isn’t an address. Both appending the client’s address (nginx’s $proxy_add_x_forwarded_for) and replacing the header (Caddy) work.

The proxy must pass the Host and Origin headers through unchanged: they protect forms against cross-site requests.

Let only the proxy reach the app: bind it to 127.0.0.1:8080 when the proxy runs on the same machine (the compose file publishes its port there), or keep the port behind a firewall. The app has its own connection limits, but it can’t tell clients apart behind them; the proxy’s client timeouts and per-client limits (nginx’s limit_conn) can.

With Docker Compose

Docker picks the compose network’s addresses when it creates the network, so its gateway, the address a proxy on the host connects from, can change when the network is recreated, and the proxy would quietly stop being trusted. Pin the network in deploy/compose.tiny.yml, trust its gateway, and publish the app’s port on the host’s loopback only (published on every interface, outside connections would also arrive from the gateway, and be trusted):

services:
  app:
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      MOEKURA_SERVER__TRUSTED_PROXIES: '["172.30.0.1/32"]'
      # …

networks:
  default:
    ipam:
      config:
        - subnet: 172.30.0.0/24
          gateway: 172.30.0.1

Pick a subnet no other network on the host uses. If the warning about an untrusted address appears in the log anyway, list the address it names.

Caddy

booru.example.com {
    reverse_proxy 127.0.0.1:8080
}

Caddy gets a certificate, sets X-Forwarded-For, and has no upload size limit by default.

nginx

server {
    listen 443 ssl;
    server_name booru.example.com;
    # ssl_certificate …

    # At least media.max_upload_mb.
    client_max_body_size 110m;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        # Stream uploads to the app instead of buffering them.
        proxy_request_buffering off;
    }
}

Health checks

GET /healthz answers when the process is up; GET /readyz also checks the database. Point load balancers at /readyz.

First steps

The first admin

Create the first account from the shell. It asks for a password (or reads one line from standard input when piped):

moekura admin create-user yourname --role admin
# with compose:
docker compose -f deploy/compose.tiny.yml exec app moekura admin create-user yourname --role admin

The first admin is also the site’s owner, the one account that outranks the other admins. Log in, then open Admin in the menu.

Name, logo, rules and policies

Under Admin → Settings:

  • Site name and Description show in the header, the footer and to search engines (<meta name="description">).

  • Icon: an image shown beside the name in the header, in place of the house.

  • Full logo: an image shown in the header in place of both the icon and the name, up to 56 pixels high.

  • Favicon: the icon in browser tabs and bookmarks, in place of the house. A square PNG of at least 64 by 64 pixels works best.

  • Hide the icon and Hide the site’s name leave either out of the header; the name stays in page titles.

    The images can be PNG, JPEG, GIF, WebP or AVIF, up to 1 MB each.

  • Rules: what may be posted and how to behave, in the same markup as the wiki. They’re shown at /rules, which anyone can read (on private sites too), and linked from the footer, the sign-up form and the upload page. Leave them empty for no rules page.

  • Terms of service and Privacy policy: shown at /terms and /privacy, which anyone can read, and linked from the footer and the sign-up form. A new site starts with general templates for both; they aren’t legal advice, so check them against how you run your site and the laws that apply to you, and edit them to fit. Leave either empty to drop its page.

  • Footer links: one per line, the link’s text then its address, like Discord https://discord.gg/abc or Help /wiki/help.

From the shell, the footer links are a JSON list:

moekura admin settings set footer_links '[{"label": "Discord", "url": "https://discord.gg/abc"}]'

Who can register

Registration is open by default. Change it under Admin → Settings, or from the shell:

moekura admin settings set registration_mode closed
ModeWho can create an account
openanyone
invitepeople with an invite code (see Invites)
approvalanyone, but staff approve new accounts before they can log in (Admin → Users, filter pending)
closednobody; admins create accounts from the shell

Invites

Invite codes are made at Settings → Invites (/invites), or with moekura admin create-invite. Each code comes with a sign-up link that fills it in, and is shown only once. The list shows each invite’s uses, expiry and the accounts made with it, which also show Invited by on their profiles.

Roles with Invite people (moderators, by default) make single-use invites lasting up to 30 days, up to Invites each person may make every 30 days in Admin → Settings (5 to start with), and revoke their own. Those who can manage users have no limit, choose how many times an invite can be used and how long it lasts (or that it never expires), and see and revoke everyone’s. An invite stops working while whoever made it is banned or their account isn’t active.

Search engines

The site serves a robots.txt and a sitemap at /sitemap.xml (using server.public_url for its links). The sitemap is an index of files of up to 10,000 posts, tags in use, wiki pages, pools, artists or forum topics each, so it stays quick on large sites; it lists only what visitors can see.

The default robots.txt points crawlers at the sitemap and asks them to leave out accounts, staff pages, history, the APIs, and searches with more than one tag or past the first page. Replace it under Admin → Settings → robots.txt (which shows the default); leave it empty to go back. On a private site the default asks crawlers to stay out entirely, and there’s no sitemap.

Email

With [mail] set up, people can reset a forgotten password from the login page, and confirm their address under Settings → Your email address and password. Without it, those pages don’t appear, and people who forget their password need an admin.

With mail, an address given when signing up or changing it becomes the account’s once the link sent to it is followed. An address another account already has gets the same answer as a free one, and that account is emailed instead, so these forms can’t be used to find out who has an account. Without mail, there’s nobody to tell and the address is the account’s at once, so a taken one is refused.

To make new accounts confirm their address before they can log in, tick New accounts must confirm their email address under Admin → Settings, or:

moekura admin settings set email_verification true

Registering then needs an address. Accounts waiting for the link are unverified under Admin → Users, where you can also activate one by hand. With approval registration, confirming the address puts the account in the approval queue.

What visitors see

Visitors see every active post by default. To hide some unless people opt in, set a default blacklist, which applies to visitors and to users who haven’t set their own:

moekura admin settings set default_blacklist "rating:e"

A blacklist only hides posts until someone turns it off. To keep visitors from seeing some ratings at all, in searches, on post pages, in feeds and through the APIs, limit the ratings they see (logged-in users still see everything):

moekura admin settings set visitor_ratings '["g", "s"]'

To show nothing at all without logging in, make the site private.

Links to posts, pools and wiki pages unfurl in chat apps and social networks (OpenGraph and Twitter card tags), and posts have oEmbed at /oembed?url=…. Video posts include OpenGraph video URLs, formats and dimensions for inline playback in Discord, with their poster as the thumbnail. The site and media URLs must be publicly reachable; playback depends on the client’s support for the original MP4 or WebM file. Previews show a post’s image or video only for general and sensitive posts, unless you tick Link previews … show questionable and explicit posts’ images too in the site settings (or moekura admin settings set preview_all_ratings true). Previews only show what visitors may see: pending and deleted posts, posts outside the ratings visitors see and banned artists’ posts have none, and oEmbed answers 404 for them. Private sites show no previews at all.

Reviewing uploads

When New uploads wait for approval is ticked under Admin → Settings, uploads by users without the Upload without approval permission wait in the approval queue (Moderation). See Moderation.

Upgrading

Releases are tagged vX.Y.Z and listed, with what changed, in CHANGELOG.md. Each comes as a container image for amd64 and arm64 (ghcr.io/moe-studios/moekura:X.Y.Z, also tagged X.Y, X from 1.0 on, and latest) and as Linux binaries on the release page.

From 1.0 on, versions follow semantic versioning: a patch release (1.0.0 → 1.0.1) only fixes things, a minor release (1.0 → 1.1) adds things without breaking existing sites, and only a major release (2.0) may remove or change what Stability lists. Before 1.0, a minor release (0.4 → 0.5) could change configuration or behaviour, and its changelog says what to do.

Steps

  1. Read the changelog for every release between yours and the new one.
  2. Back up the database.
  3. Replace the program: pull the new image, or put the new binary in place.
  4. Start it. Database migrations run on start unless database.auto_migrate = false; with several servers, run moekura migrate once first, then restart them all.

Migrations only move forward. To go back to an older version, restore the backup you took.

Within 1.x

Upgrading from any 1.x release to any later 1.x release never needs more than the steps above, whichever releases are skipped: configuration, scripts and apps that worked keep working, as Stability describes. A minor release may deprecate something; the old name keeps working, and the log says what to change, so that the next major release needs no work. Anything that needs more is saved for 2.0, whose changelog will list what to do.

Overridden templates and translations (paths.templates_override, paths.locales_override) aren’t covered: compare them with the new release’s before upgrading.

Supported releases

After 1.0, the latest minor release gets bug and security fixes as patch releases. Bug fixes aren’t backported to older minor releases; security fixes are, for a while, as SECURITY.md says. Every upgrade test in CI starts from the previous release, so upgrading one release at a time is the best-tested path, but skipping releases works too.

Requirements

Moekura is tested with the versions in the container image and the compose files. The oldest versions supported:

Oldest supportedTested in CI
PostgreSQL1618
Valkey (optional)Valkey 7.2, or Redis 6.2Valkey 8
libvips8.158.16 (Debian 13) and 8.18 (the image)
ffmpeg7.07.1 (Debian 13) and 9.0 (the image)
glibc, for the release binaries2.39Ubuntu 24.04
Rust, to build from source1.941.94 and the latest stable

Raising one of these happens only in a minor release, never in a patch release, and is announced in the changelog of the minor release before. A PostgreSQL version stays supported at least until its maintainers stop supporting it. The container image always ships what it needs, so this matters only for sites run without containers or with their own database.

With Docker Compose

Point the app service at a release instead of building it:

services:
  app:
    image: ghcr.io/moe-studios/moekura:0.8
docker compose -f deploy/compose.tiny.yml pull
docker compose -f deploy/compose.tiny.yml up -d

Binaries

The Linux binaries are built on Ubuntu 24.04 and need glibc 2.39 or newer (Debian 13, Ubuntu 24.04, Fedora 40 and later), plus the media tools.

Changed defaults

Defaults that changed after 0.5. Sites that set these themselves keep what they set; sites that relied on the old default behave differently after upgrading.

Metadata is removed from originals

media.strip_metadata is now "strip" (it was "off"). EXIF (with GPS positions and camera serial numbers), XMP, IPTC and comments are taken out of new JPEG, PNG and WebP originals before they’re stored, so Download original no longer hands them to everyone, and the post’s SHA-256 and MD5 are those of the cleaned file. Files of other types (GIF, AVIF, JPEG XL, videos, ugoira) still keep their metadata, and posts uploaded before the upgrade keep their originals as they are. To keep originals exactly as uploaded, set strip_metadata = "off". See File metadata.

Connections are limited

The server serves at most 512 connections at once (server.connections.max); more wait their turn. A connection that goes 10 seconds without sending a request’s headers (idle_timeout_secs) is closed, which includes keep-alive connections left idle; clients open a new one. Once closing, it’s cut off if the client takes none of its response for 60 seconds (send_timeout_secs), so a download paused for longer than that stops. A busy site served without a reverse proxy may need a higher max, and an open file limit (ulimit -n) to match.

The compose file publishes the app on this machine only

deploy/compose.tiny.yml publishes port 8080 on 127.0.0.1 instead of on every network the machine is on. A reverse proxy on the same machine keeps working. If people reached the app at http://<server>:8080 directly, put a reverse proxy in front, or publish it on every network again with "8080:8080" in your copy, knowing that Docker’s published ports get past host firewalls such as ufw.

Stability

From 1.0 on, Moekura follows semantic versioning strictly: anything that would break a working site, its scripts or the apps people use with it waits for the next major release (2.0). This page says what that covers.

What 1.0 promises

These keep working, with the same meaning, across every 1.x release. Things may be added to them in a minor release (1.1, 1.2): new endpoints, fields, keys, flags, metatags or events. Nothing is removed or renamed except through a deprecation.

SurfaceCovers
/api/v1its endpoints, fields, parameters, error shape, status codes and rate limit headers, as its OpenAPI description at /api/v1/openapi.json lists them
The Danbooru-compatible APIwhat gallery-dl, Grabber and Boorusama use, which the tests check on every change; the rest of it follows Danbooru as closely as it can, which may change when Danbooru does
Configurationevery key in moekura.toml, its MOEKURA_* variable, its unit and its default’s meaning; MOEKURA_CONFIG; site settings keys (moekura admin settings)
Commandsevery moekura command, its flags and arguments, and its exit status (0 for success); the built-in role keys (member, admin, …)
Search syntaxtags, -, ~, or, groups, wildcards, and every metatag and order: value
Webhooksevent names, the generic payload’s fields, the X-Moekura-* headers and the signature; the Discord format’s meaning (Discord decides how it looks)
Atom feeds/posts.atom and /comments.atom, their parameters and feed tokens
Page addresses/posts/123, /posts?tags=…, /wiki/… and the other addresses people link to, bookmark or put in a browser’s search bar; one that moves redirects
Metricsthe names, labels and meaning of the metrics
Container imagesthe X.Y.Z, X.Y, X and latest tags, the -tagger variants, the data volume (/var/lib/moekura/data, and /var/lib/moekura/models in the tagger image) and the user the image runs as
Upgradesany 1.x release upgrades to any later 1.x release by replacing the program and starting it (Upgrading)

What isn’t a contract

These may change in any release. The changelog says when they do.

  • The database schema. Only Moekura reads and writes it; migrations move it forward on start, and that upgrade path is the contract, not the tables. Query the API instead of the database.
  • Overridden templates and static files (paths.templates_override, paths.static_override). They keep being used, but the built-in ones they replace change between releases: check yours against the new release’s before upgrading. Themes that only set the colour tokens keep working.
  • Translation message ids (paths.locales_override). Ids may be added, changed or removed; a missing translation falls back to English, so nothing breaks, but check your files after upgrading.
  • Pages’ HTML and CSS, and the scripts on them: scrape the API, not the pages.
  • Log messages and their fields, and the names of trace spans. They’re for people reading them; alert on metrics.
  • Performance and resource use, beyond what’s measured in Hardware and checked in CI.
  • The minimum Rust version for building from source, which may rise in a minor release.
  • Unreleased builds (edge, git-…): anything on the main branch may still change before it’s released.
  • Fixing bugs and security problems may change behaviour that depended on them. When that matters to many sites, the changelog says so.

What counts as breaking

A change is breaking if a site, script or app that worked before stops working, or does something different, without anyone changing it. For example:

  • removing or renaming an endpoint, field, parameter, config key, variable, flag, command, metatag, event or payload field;
  • changing a field’s type, or what a value means (a unit, a default that changes behaviour, a status code);
  • making something optional required, or refusing input that used to be accepted;
  • needing a step beyond replacing the program to upgrade.

These are not breaking:

  • adding endpoints, fields (clients should ignore unknown ones), optional parameters, keys with defaults that keep today’s behaviour, flags, metatags or events;
  • adding values to an enumeration, such as a new post status or webhook event; clients should handle values they don’t know;
  • changing the order of JSON fields, the wording of error messages, or pages’ layout;
  • a default that only changes something not covered above, such as the thumbnails’ look.

Deprecations

Something that has to be renamed or replaced within 1.x is deprecated first:

  • Config keys keep working under their old name, and the program logs a warning naming the new one when it starts. Setting both the old and the new name is an error.
  • Commands and flags keep working under their old names, hidden from --help, with a warning.
  • API endpoints and fields keep working, are marked deprecated in the OpenAPI description (with what to use instead), and deprecated endpoints answer with a Deprecation header (RFC 9745).

The changelog lists every deprecation. Deprecated names are removed only in the next major release, whose upgrading notes list them all; a site with no deprecation warnings in its log upgrades without changes to its configuration. Development says how to add one.

Configuration

There are two kinds of settings:

  • Server configuration, read at startup: where the database is, where files go, limits. Changing it needs a restart. It’s described on this page.
  • Site settings, stored in the database and changed while the site runs: the site’s name, registration, the approval queue, the default blacklist. Change them under Admin → Settings or with moekura admin settings.

Where server configuration comes from

Each layer overrides the one before:

  1. built-in defaults,
  2. moekura.toml in the working directory, or the file given with --config <path> or MOEKURA_CONFIG,
  3. environment variables.

Every key has an environment variable MOEKURA_<SECTION>__<KEY> (two underscores), for example MOEKURA_DATABASE__URL or MOEKURA_STORAGE__S3__BUCKET. Lists are written as TOML, e.g. MOEKURA_SERVER__TRUSTED_PROXIES='["10.0.0.0/8"]'. Unknown keys are refused, so a typo fails loudly instead of being ignored.

moekura check-config validates the configuration and prints the result with credentials replaced by REDACTED: passwords and secret keys, the cookies, query values and headers of [sources.logins], and the user, password and query values of every address (the OTLP collector, the tagger’s model, …). Names stay, so it still shows what is sent where.

[server]

KeyDefaultMeaning
bind"0.0.0.0:8080"address the HTTP server listens on
public_url"http://localhost:8080"the address people use; set it to your https:// URL (cookies become Secure, forms are only accepted from this origin, and passkeys belong to its host)
trusted_proxies[]reverse proxies allowed to report the client’s address in X-Forwarded-For (addresses or CIDR ranges); see Behind a reverse proxy
request_timeout_secs30requests running longer are stopped with a 408
api_requests_per_minute300API requests a client may make a minute on average (per account, or per address for visitors); 0 for no limit
api_burst60how many API requests may come at once before the per-minute rate applies

Passkeys and public_url

Passkeys need no settings of their own: they are made for the host name in public_url (their relying party ID), and only work on pages from its origin. If the site moves to another domain, every passkey stops working, and people log in with their password (or single sign-on) and add new ones; a reverse proxy redirecting the old domain doesn’t change that. Passkeys are off when public_url names an IP address rather than a domain, since browsers don’t allow them there; http://localhost works for development.

[server.cors]

Which other websites’ scripts may call the API (/api/v1 and the Danbooru-compatible API) from a browser. Pages and forms are never available to other websites.

KeyDefaultMeaning
allowed_origins[]origins such as "https://app.example.com" (scheme, host and port, no path), or ["*"] for any website
allow_credentialsfalselet the listed origins send the visitor’s login cookie; without it, cross-origin requests count as a visitor’s unless they carry an API key. Needs explicit origins, not "*"
max_age_secs600how long browsers may remember a preflight answer
[server.cors]
allowed_origins = ["https://viewer.example.com", "http://localhost:5173"]

[server.connections]

Limits on the connections the app serves, so clients that open them and send nothing, send their requests a byte at a time, or stop reading the responses they asked for, can’t hold them for long or run the process out of file descriptors.

KeyDefaultMeaning
max512connections served at once; more wait to be accepted until one closes. Each takes a file descriptor, so keep it well under the process’s open file limit (ulimit -n, often 1024), which also covers database connections, files and media tools
idle_timeout_secs10a connection is closed when it goes this long without sending a whole request’s headers: one that sends nothing, sends its headers too slowly, or sits idle between requests. A request in progress is answered first
send_timeout_secs60a connection being closed (as idle, or because the app is stopping) is cut off when the client takes none of its response for this long, while no request is still being worked on: a client that stops reading, or never lets an HTTP/2 response through, can’t keep it. A slow download goes on as long as the client keeps taking some of it

These hold whether or not a reverse proxy is in front. Stopping the app waits for the responses in progress, but no longer than send_timeout_secs for a client that takes nothing. The limits don’t tell one client from another: a client opening connections fast enough can still fill them all, and others then wait, and one that keeps sending something, or takes a little of a response now and then, keeps its connection. A reverse proxy in front can limit connections per client (nginx’s limit_conn) and has its own client timeouts, which is one more reason to keep the app’s port reachable only by the proxy. A proxy that keeps connections to the app open between requests should let idle ones go sooner than idle_timeout_secs (Caddy’s keepalive transport option, nginx’s keepalive_timeout in an upstream block), or a request may now and then be sent on a connection the app is closing.

[database]

KeyDefaultMeaning
url(required)the primary’s connection URL
replicas[]read replicas’ URLs, used for searches and listings
max_connections16per pool (the primary and each replica)
min_connections0
acquire_timeout_secs5how long to wait for a free connection
statement_timeout_ms30000server-side limit per statement; 0 for none
auto_migratetruemigrate on start; with several servers, set false and run moekura migrate when deploying
replica_max_lag_secs10replicas further behind are skipped until they catch up; also how long someone’s reads stay on the primary after they change something

[auth]

KeyDefaultMeaning
session_idle_days30a login ends after this many days unused…
session_max_days365…or this long after logging in, however active

[auth.oidc]

Lets people log in through an OpenID Connect provider (single sign-on): Authentik, Keycloak, Kanidm, Zitadel, Google and others. Leave the section out to turn it off.

KeyDefaultMeaning
issuer(required)the provider’s issuer URL, which describes itself at /.well-known/openid-configuration under it; https://, or http:// on the same machine
client_id(required)from registering Moekura with the provider
client_secret(empty)likewise; empty for a public client
button_label"Log in with single sign-on"the button on the login page
scopes["openid", "email", "profile"]must include openid

Register the redirect URI https://your.site/login/oidc/callback (from server.public_url) with the provider. Logins use the authorization code flow with PKCE, and each one has to finish in the browser that started it (a short-lived cookie ties them together). The ID token’s signature isn’t checked, since it comes straight from the provider, so the provider is only ever reached over https: its description must list https:// login and token endpoints, and redirects to plain http are refused. Plain http is allowed only for a provider on the same machine, for development.

Someone logging in through the provider for the first time gets a new account (with no password) when registration is open, or one waiting for approval when it’s approval; with invite or closed, only people who linked an existing account can. A new account takes its name from the provider (the next free one if it’s taken), and the provider’s email address if it says it’s verified, nobody here uses it yet, and the site accepts its domain. Signing up this way counts towards the limit of new accounts per address, like the sign-up form, and a network ban keeps the network from signing up or logging in this way, as from the forms. Where new accounts confirm their address (Admin → Settings → Registration), they need an address the site accepts: one the provider says is verified is good enough; otherwise a confirmation link is sent to it first, and without one, signing up through the provider is refused. The captcha isn’t asked for, as the provider has already checked who is logging in.

[auth.captcha]

A captcha service for the sign-up form and new accounts’ comments: where it’s asked for is chosen under Admin → Settings (nowhere, until then). Logging in to an account also asks for it while someone guesses the account’s password from many networks at once. Leave the section out to turn it off.

KeyDefaultMeaning
provider(required)"turnstile" (Cloudflare Turnstile) or "hcaptcha"
site_key(required)the public key the provider gives you
secret_key(required)the private key tokens are checked with
verify_url(the provider’s)where tokens are checked, for a proxy or a compatible service

The page asking for it loads the provider’s script and frame, which the content security policy then allows from the provider’s origin.

[cache]

KeyDefaultMeaning
backend"memory"where rate limit counters and cached search counts live: "memory" (search counts and the API’s per-request limit in each process, the other rate limits in the database, shared by every web server) or "valkey" (all shared by every web server)
url(unset)for valkey: redis://host:6379, or rediss:// for TLS; Redis and other compatible servers work too
count_ttl_secs30how long a search count that reached search.count_limit (“10,000+”) is reused; 0 turns this off
prefix"moekura"starts every key stored in Valkey; give sites that share a server different prefixes

If Valkey (or, without it, the database) stops answering, each server counts rate limits on its own and stops caching until it’s back, and logs a warning; nothing fails.

[jobs]

KeyDefaultMeaning
workers2background jobs processed at once, per process
run_in_servetruealso run workers inside serve; set false when you run moekura worker separately
lock_timeout_secs300a job whose worker stopped responding is retried after this

[mail]

Outgoing mail over SMTP, for email verification and password resets, and to warn users about wrong two-factor codes and about someone trying to use their address. Messages are sent by the job workers, so a slow mail server doesn’t hold up the site, and failed sends are retried.

KeyDefaultMeaning
host(empty)the SMTP server; empty turns mail off, along with the features that need it
tls"starttls""starttls" (upgrade a plain connection; required), "tls" (TLS from the start) or "none" (only for a relay on the same machine or network)
port(by tls)587 for starttls, 465 for tls, 25 for none
username, password(empty)the login, if the server needs one
from(empty)the sender, as address@example.com or Site name <address@example.com>; required with host
timeout_secs30connecting or sending one message gives up after this

Check the settings with moekura admin send-test-mail you@example.com, which sends straight away and prints any error.

The first three are defaults: the site settings’ Search pages (pagination) override each of them while the site runs, on every server, without a restart. See Search pages.

KeyDefaultMeaning
per_page40posts per page
max_per_page200the most limit: may ask for
max_page1000deepest numbered page; “next” links keep working beyond it
max_terms40most tags and filters in one search; every search is also at most 1000 words and 10,000 characters long, whatever this is
wildcard_limit100most tags a wildcard expands to (the most used)
count_limit10000result counts are exact up to this, estimated above
count_cost_limit25000counts PostgreSQL expects to cost more than this (roughly pages read) are estimated instead, so filters no index covers don’t read every post

[storage]

KeyDefaultMeaning
backend"local""local" (a directory) or "s3"
path"data"the directory, for local
public_base_url(unset)where browsers load files from, e.g. a CDN; unset, the app serves them under /data/

[storage.s3]

KeyDefaultMeaning
bucket""
region"us-east-1"
endpoint(unset)for MinIO, Garage, R2, B2 and others; unset for AWS
access_key_id, secret_access_key""empty to use AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY or instance credentials
path_stylefalseput the bucket in the path; most self-hosted stores need this

See File storage.

[media]

KeyDefaultMeaning
max_upload_mb100largest upload
max_link_upload_mbmax_upload_mblargest file downloaded from a pasted link or a remote booru import
max_pixels200000000larger images are refused before decoding
max_duration_secs600longest video
allowed_types["jpeg", "png", "gif", "webp", "avif", "mp4", "webm", "ugoira"]ugoira is Pixiv’s zip of animation frames; add "jxl" for JPEG XL (off by default: libvips doesn’t consider its decoder hardened against malicious files). MP4 may hold H.264, HEVC, VP9 or AV1 video with AAC, MP3 or Opus audio; WebM, VP8, VP9 or AV1 with Opus or Vorbis. QuickTime and other Matroska files are refused
thumbnail_sizes[250, 500]thumbnail boxes, 1x and 2x for high-density screens
sample_size1600larger images also get a resized copy for the post page
variant_format"webp""webp" or "avif" (smaller, slower) for thumbnails and samples
tool_timeout_secs120longest a media tool may run
strip_metadata"strip"remove identifying metadata (EXIF and GPS, XMP, IPTC, comments) from uploaded originals too: "strip" (JPEG, PNG and WebP; other types, such as GIF, AVIF, JPEG XL and videos, keep theirs), "require" (and refuse other types) or "off" (originals kept exactly as uploaded); see File metadata. Up to 0.5 the default was "off"
max_tool_processes0media tools (vips, ffmpeg, …) running at once in one serve or worker process, uploads and jobs together; more wait their turn. 0: one per CPU core
ffmpeg_threads2threads each ffmpeg run may use for decoding, filters and encoding; 0 lets ffmpeg pick (about one per core)
ffmpeg_memory_mb2048memory each ffmpeg or ffprobe run may use; 0 for no limit, otherwise at least 512 (Linux only)
ffmpeg_cpu_secs0CPU time each ffmpeg or ffprobe run may use, all threads together; 0 for no limit (Linux only)
vips_memory_mb4096memory each vips, vipsheader or vipsthumbnail run may use; 0 for no limit, otherwise at least 512 (Linux only)
vips_cpu_secs0CPU time each vips, vipsheader or vipsthumbnail run may use; 0 for no limit (Linux only)
work_dirsystem temp dirscratch space for uploads and processing; an upload’s scratch files left behind for more than a day (by a restart, say) are removed at startup and every hour, so several processes can share it

Limits on media tools

Files are decoded by vips, ffmpeg and ffprobe in their own processes, so a hostile or broken file costs at most one of those, never the server. Each run is stopped after tool_timeout_secs, and at most max_tool_processes run at once. ffmpeg also uses at most ffmpeg_threads threads, so one video can’t take every core.

On Linux, ffmpeg and ffprobe are also held to ffmpeg_memory_mb and ffmpeg_cpu_secs, and the libvips tools (vips, vipsheader, vipsthumbnail) to vips_memory_mb and vips_cpu_secs, set with ulimit by /bin/sh before they start. The memory limits are on address space, which counts the program’s libraries and thread stacks too, so they’re well above what the process really uses; ffmpeg and libvips each need a few hundred MB of it to start. Decoding the largest pictures max_pixels allows (a progressive JPEG or an AVIF of 200 megapixels) takes about 4 GB; with a lower max_pixels, vips_memory_mb can be lower too. A file that would need more is refused with an explanation (“too demanding to process”) rather than as an error on the site’s side: on upload, or in the failed job’s message when thumbnails are made. The tools don’t always say an allocation failed, so some such files are reported as damaged instead. Without a CPU limit, an ffmpeg run still can’t use more than ffmpeg_threads × tool_timeout_secs of CPU time, and a libvips run, which works on one thread, about tool_timeout_secs. Other systems ignore these limits.

These limits are per process. A container’s memory limit (Docker mem_limit, or the cgroup a service runs in) counts the real memory of the server and every tool running at once; when it’s reached, the kernel stops whichever process it picks, possibly the server. On a small machine, keep max_tool_processes low (1 or 2 on 1 GB) so tools fit beside the server, and let ffmpeg_memory_mb and vips_memory_mb stop single runs that grow too large.

[media.tools]

Paths to vips, vipsheader, vipsthumbnail, ffmpeg and ffprobe, if they aren’t on PATH.

[paths]

KeyMeaning
templates_overridea directory whose files replace built-in templates with the same path, e.g. base.html
static_overridethe same for static files, e.g. css/main.css; also where themes are added
locales_overridetranslations: a directory per language (de/*.ftl), adding languages or replacing built-in messages

[tagger]

The optional tagger, which suggests tags for new uploads.

KeyDefaultMeaning
enabledfalsequeue new uploads for moekura tagger; set it for every process
model"wd-vit-tagger-v3"wd-vit-tagger-v3, wd-convnext-tagger-v3, wd-swinv2-tagger-v3, wd-eva02-large-tagger-v3, or "custom"
model_url, tags_urlunsetfor custom: the ONNX model and its selected_tags.csv
model_sha256, tags_sha256unsetfor custom: their SHA-256 checksums
model_dir"data/models"where models are downloaded to, one directory each
runtimeORT_DYLIB_PATH, or the system’sthe ONNX Runtime library, libonnxruntime.so
threads0threads one image uses; 0 means one per core
workers1posts tagged at once
account"tagger"who automatically applied tags are credited to; created without a password when moekura tagger starts, and nobody can sign up with the name

[telemetry]

KeyDefaultMeaning
log_format"text""text" or "json"
log_filter"info,sqlx::postgres::notice=warn,ort=warn"a tracing filter; RUST_LOG overrides it ("info,tower_http=debug" logs every request)
metrics_bindunsetwhere serve and worker serve Prometheus metrics at /metrics, e.g. "127.0.0.1:9100"; unset, nothing is collected
otlp_endpointunsetan OpenTelemetry collector’s OTLP/HTTP address, e.g. "http://otel-collector:4318"; traces go to its /v1/traces
otlp_sample_ratio1.0the share of requests and jobs traced, from 0.0 to 1.0
service_name"moekura"service.name on exported traces

Metrics

With metrics_bind set, moekura serve and moekura worker each open a second listener serving /metrics in the Prometheus text format. It is separate from the site so it is never reachable through the reverse proxy: bind it to loopback or a private address, and keep it off the internet with a firewall. It has no authentication of its own. The address must differ from server.bind, and processes on the same machine need different ports.

MetricLabelsMeaning
moekura_http_requests_totalmethod, route, statusrequests answered
moekura_http_request_duration_secondsmethod, routehistogram of how long they took
moekura_http_requests_in_flightrequests being answered now
moekura_jobs_finished_totalkind, resultjobs run: done, retry (failed; retried while attempts remain), failed (could never succeed) or panicked
moekura_job_duration_secondskindhistogram of how long they ran
moekura_jobskind, statejobs ready (due now), scheduled (for later), running and dead
moekura_jobs_oldest_ready_secondskindhow long the longest-waiting due job has waited
moekura_db_connectionspool, stateconnections idle and in_use, for primary and each replica_N
moekura_db_connections_maxpooleach pool’s limit

route is the route’s template, such as /posts/{id}, or unmatched for requests that matched none, so the number of series stays small whatever is requested. No label carries a user, address, tag or query. The queue and pool gauges are read when Prometheus scrapes; the queue counts all processes’ jobs, so scrape it from one of them.

A growing moekura_jobs_oldest_ready_seconds means the workers are behind; a climbing dead count, that jobs are failing for good (see Background jobs).

Grafana dashboard

deploy/grafana/moekura.json is a Grafana dashboard for these metrics: requests by route and status, latency, the job queue and how jobs end, and the database pools. Import it in Grafana (Dashboards → New → Import) and pick your Prometheus data source; it needs Grafana 10.4 or later. Its Job and Instance selectors choose which scraped processes it shows, and Route and Job kind narrow the HTTP and job panels.

Traces

With otlp_endpoint set, each request and job is a trace, with the spans logged inside it, sent in batches over OTLP/HTTP (protobuf) to an OpenTelemetry collector, which can pass them to Jaeger, Tempo or another tracing backend. Spans carry the moekura.role of the process (serve, worker, tagger, migrate) and its version. log_filter decides which spans exist, as for logs. Traces still buffered are sent when the process shuts down cleanly.

The endpoint must be http or https; no credentials are sent, so put a collector next to moekura rather than sending to a hosted service directly. A busy site can lower otlp_sample_ratio: a sampled request traces everything beneath it.

[sources]

KeyDefaultMeaning
loginsnonelogins for sites that show some works only to members, by domain
x.fxembed_api_url"https://api.fxtwitter.com"the API of an FxEmbed instance that posts on X are read through; empty to not use one

Each [sources.logins."<domain>"] covers the domain and its subdomains and can set any of:

KeyMeaning
cookiethe Cookie header, "name=value; other=value"
queryparameters added to the address, such as an API key
headersother headers, such as Authorization

They’re sent only to that site, over https, when reading where an upload comes from, and not along redirects to other sites; the files themselves are downloaded without them.

[webhooks]

KeyDefaultMeaning
allow_private_addressesfalselet webhooks go to private, loopback and link-local addresses (a service on the same machine or network)
timeout_secs10how long a delivery may take
max_concurrent1deliveries sent at once, across all job workers; the rest wait their turn, so receivers that don’t answer can’t hold every worker (keep it below jobs.workers)

Discord webhooks are public addresses, so they work without allow_private_addresses.

Search pages

How many posts a search shows and how deep its numbered pages go is decided, for each limit, by the first of these that is set:

  1. the site setting, under Admin → Settings → Search pages or moekura admin settings set pagination '{"per_page": 60, "max_per_page": 100, "max_page": 500}' (leave a key out, or blank on the form, to fall back),
  2. [search] in the server configuration,
  3. the built-in default.

A user’s own page size (in their settings) replaces the posts per page for their searches, but never goes over the largest page; neither does a search’s limit:, nor limit= in the APIs. Searches through the site, /api/v1 and the Danbooru-compatible API all follow the same limits (Danbooru apps get 20 posts unless they ask for more, as on Danbooru). Past the deepest numbered page, “next” links (page=b<id>) keep going. moekura check-config shows only the server configuration’s values; moekura admin settings shows the site settings.

Roles and permissions

Everyone has a role, and a role is a set of permissions. Logged-out visitors have the Anonymous role. Edit roles under Admin → Roles: rename them, and choose their permissions. You can only hand on permissions you have yourself; ones you lack stay as they are.

Adding roles

Add a role at the bottom of Admin → Roles with a name, a rank below your own, and optionally the permissions of an existing role to start from. The ranks of added roles can be changed later, and they can be deleted, which moves their users to a role you choose. The built-in roles can’t be deleted and keep their ranks.

PermissionAllows
View postsseeing posts, tags and profiles; take it from Anonymous for a private site
Uploaduploading posts
Upload without approvalskipping the approval queue, when it’s on
Edit posts and tagschanging a post’s tags, rating, source, description and parent; requesting aliases and implications
Favorite, Votefavoriting posts; voting on posts and comments
Commentposting comments, and editing and deleting your own
Edit the wiki and artists
Mass edit tagsadding and removing tags on every post a search finds (Moderation → Mass edit)
Lock posts and change locked oneslocking a post’s rating, tags, notes or status, and changing them anyway
Undo a user’s post editstaking back every post edit a user made in a range of days (Moderation → Post changes)
Send private messageswriting to other users (Messages)
Leave feedback on users of lower rankpositive, neutral or negative notes on someone’s account (Feedback)
Invite peoplemaking invite codes, up to the site’s quota (Invites)
Replace posts’ filesswapping a post’s file for a better one, keeping everything else (Posts and files)
Edit notesadding, moving, changing and deleting notes on posts
Create and edit poolsmaking pools, and changing their posts, names and descriptions (deleting a pool takes Delete and restore posts)
Flag postsasking moderators to delete a post
Approve posts and handle flagsthe approval and flag queues
Delete and restore posts
Purge postsremoving deleted posts and their files for good
Manage tags, aliases and implicationsmoving tags between categories, deprecating tags, deciding alias and implication requests; banning artists, and renaming, deleting or restoring a banned artist’s entry
See deleted postsdeleted posts and comments
Hide comments and forum posts, and handle reports about themhiding and restoring anyone’s comments and forum posts, the reported comments queue, writing held as spam, and reports about forum posts, wiki pages, pools, notes and artists
Read reported and held private messagesprivate messages their recipients reported or the spam filter held, and settling them
Ban users and networksalso reports about users and feedback
Manage userschanging other users’ roles and account status; any number and kind of invites
Manage site settings and rolesalso the admin pages for tag categories, news and webhooks
Read the moderation log

The built-in roles and what they start with:

RoleRankPermissions
Anonymous0View posts
Member10Anonymous, plus Upload, Edit posts and tags, Comment, Favorite, Vote, Flag posts, Edit the wiki and artists, Create and edit pools, Edit notes, Send private messages
Contributor20Member, plus Upload without approval, Leave feedback
Janitor30Contributor, plus Approve posts, Delete and restore posts, Manage tags, See deleted posts, Hide comments
Moderator40Janitor, plus Ban users and networks, Read the moderation log, Mass edit tags, Lock posts, Undo a user’s post edits, Replace posts’ files, Invite people, Read reported and held private messages
Admin50everything

Upload limits

Each role can limit uploads, under Admin → Roles (empty means no limit):

  • Waiting for approval at once: when the approval queue is on, how many of a user’s uploads may wait in it. Members start at 10. Roles with Upload without approval skip the queue, so this doesn’t apply to them.
  • Per day: uploads in the last 24 hours, queued or not.

With Limits on uploads waiting for approval grow… ticked in the site settings, the queue limit follows each user’s record, as on Danbooru: one more for every 10 of their uploads that were approved, one fewer for every 5 that were deleted, from 1 up to four times the role’s limit.

The upload page tells users how many uploads they have left, and why an upload was refused; the API’s /users/me says the same under uploads. Uploads sent at the same moment are counted one after another, so they can’t get past a limit together.

Whatever the role’s limits, each account may upload 20 times in a short while, then once every 30 seconds, so that one account can’t flood the media tools that process every file. Sending files to be posted counts once, posting each of them counts again, and so does replacing a post’s file. Staff who can approve posts aren’t held to this.

Automatic promotion

With Automatic promotion ticked in the site settings, members become contributors (who upload without approval) once their record is good enough. Every hour, members are promoted who have at least the set number of approved uploads and post edits, have been registered for the set number of days, and have had at most the set number of uploads deleted in the last 30 days and at most the set number of negative feedback records from staff (ranked above contributors: one contributor’s word alone doesn’t hold someone back). Defaults: 50 uploads, no edits needed, 30 days, no recent deletions, no negative feedback.

Banned members and bots aren’t promoted, including those banned or kept from promotion while the hourly check runs. Staff who manage users can keep someone from automatic promotion with Never promote automatically on their profile. Promotions are in the moderation log, and profiles say when someone was promoted.

Rank

Staff act only on people below them: a moderator can ban members and janitors, but not other moderators or admins, nor ban a network one of them used, or see their addresses. The same goes for changing roles: you can give or take away only roles ranked below your own that grant nothing you lack, and never change your own role or status. That keeps a mistake, or a compromised account, from locking out the people above it.

The same goes for what people wrote or uploaded: deleting, restoring, rejecting or purging a post, dismissing flags on it or deciding its appeal; hiding or restoring a comment or dismissing reports about it; hiding, editing, renaming, locking or deleting forum posts and topics; and approving or rejecting writing held as spam all need you to outrank its writer or uploader (or the account to be gone). Your own you may act against, such as deleting your own upload, but not settle in your own favour: you can’t restore your own deleted upload, grant its appeal, dismiss flags or reports about your own work, or show your own hidden comment again. Approving your own pending upload is still allowed, as the queue explains. A refusal says which applies.

The owner

Admins share the top rank, so on their own they can’t act on each other. One account is the site’s owner, who outranks every role: the owner can ban, rename or change the role of an admin, give the admin role, and moderate what admins wrote or uploaded. The first admin created with moekura admin create-user becomes the owner (on sites that had admins before, the oldest one did). Only the shell changes it: moekura admin set-owner NAME hands ownership to someone else, and the log records it.

From the shell, moekura admin set-role NAME ROLE changes anyone’s role, which is how you recover if the last admin loses access, and moekura admin lift-network-ban ADDRESS lifts network bans that lock staff out.

Moderation

Everything here is under Moderation in the menu, for people whose role allows it, and every action is recorded in the moderation log with who did it and why. Moderation opens on an overview counting what waits in each queue you work through: pending, flagged and appealed posts, reported comments, writing held for review, reports, and ban appeals.

The approval queue

When New uploads wait for approval is ticked (Admin → Settings), uploads by people without Upload without approval are pending: only their uploader and staff see them. Approve them, or reject them with a reason, from Moderation → Approval queue, or under Moderate on the post’s own page. The queue leaves out your own uploads; find those with status:pending user:yourname and approve them from their page.

A rejection needs a reason, as a deletion does. Restoring a post that was deleted before anyone approved it (a rejected one, say) sends it back to the queue as pending, so deleting and restoring can’t stand in for approval.

An approver can also disapprove a post: pass on it without rejecting it, saying whether it breaks the rules, is of poor quality, or just isn’t for them, with an optional note. The post stays pending and leaves that approver’s queue, while other approvers see the disapprovals (and the post page lists them, with Take it back on your own, which returns the post to your queue). The queue holds the posts found by status:unmoderated: pending posts the approver didn’t upload and hasn’t disapproved. A user’s moderation record counts the posts they disapproved.

The queue has a search box, which takes the usual search syntax (tags, user:name, rating:e and so on, but not status:), and a choice of order: oldest first (the default), newest first, score, favorites, fewest tags or size. Tick posts to approve or reject them together (up to 100 at once, with one reason for the rejections); any that someone else dealt with meanwhile are skipped.

Flags

Members flag posts that should go, with a reason. Flagged posts stay visible, marked flagged, and appear under Moderation → Flags. Dismiss the flags to keep the post, or delete it, which upholds them. Each person can flag posts and report comments about ten times at once, then once a minute; a flag they already made, or one on a post whose flag of theirs was dismissed in the past week, is refused before it counts. Nobody dismisses flags on their own uploads.

Posts left waiting

By default posts wait in the approval and flag queues until someone deals with them. Under Admin → Settings → Moderation reasons, Posts left waiting can delete them after a number of days, as Danbooru does: pending posts nobody approved are rejected (“Unapproved in 3 days”), and flagged posts whose flags nobody reviewed are deleted, upholding the flags (“Flagged and not reviewed in 3 days”). The posts.expire_stale job checks hourly and logs each as done by nobody in particular; posts whose status is locked stay. 0 (the default) leaves them waiting.

Comments

Members report comments, with a reason; reported comments appear under Moderation → Reported comments. Staff with Hide comments can hide any comment (which upholds its reports) and restore it later, or dismiss the reports. Hidden comments, those their authors deleted and those held as likely spam stay visible to staff, marked hidden, deleted or held for review. Restoring brings back only what staff hid: not what its writer deleted, nor what the spam filter holds. Comments voted down to −5 or lower are collapsed for everyone.

A report keeps the comment as it was then, so the queue shows what was reported even if its writer changed it afterwards. Nobody can report their own comment, and a repeat report is refused before it counts against the limit.

Reports

Besides flagging posts and reporting comments, members report messages they received, forum posts, users, wiki pages, pools, notes, artists and feedback, with Report to the staff on each, giving a reason. Each report keeps the reported text as it was then, and its reason; several people’s reports about the same thing are listed together, and a report never overwrites another. Nobody reports their own work, each person reports a thing once while their report is open and then waits a week after it’s settled, and reports count against the same limit as flags.

Moderation → Reports lists what was reported, the longest waiting first, a page at a time, filtered by kind. Each kind goes to the staff who handle it: messages to those who Read reported and held private messages (moderators, by default; janitors don’t read private messages), users and feedback to those who Ban users, and the rest to those who Hide comments and forum posts. Uphold or Dismiss settles every open report about the thing, with an optional note on how it ended, which the reporters’ records and the log keep; nobody settles reports about their own work, or that of someone ranked at or above them. A user’s moderation record lists the reports about them and what they wrote.

Reasons

Deleting, rejecting and flagging a post offer the site’s preset reasons (Duplicate, Poor quality, Off-topic, Breaks the rules to begin with), so reasons stay consistent, with a box for details or a reason of one’s own (Other). A preset with details is recorded as “Poor quality: blurry”. Change the lists under Admin → Settings → Moderation reasons, one per line; empty lists leave just the box. The API and Danbooru clients send free text as before.

Deleting, restoring, purging

Deleting a post (with a reason, which is required and shown on the post) hides it from everyone without See deleted posts, except its uploader, who still sees the post and why it went, but can’t change it. It can be restored. Purging a deleted post removes it, its files and its history for good, in the background, and is logged once the post is gone. A post with an open appeal can’t be purged until the appeal is decided, and one whose status is locked only by staff who can lock posts. Once the job starts removing the files, the post can no longer be restored or appealed.

Purging in bulk

Staff with Purge posts (admins, by default) purge many deleted posts at once under Moderation → Purge. Search the deleted posts with the usual search syntax, such as user:name for a spam account’s leftovers (status:deleted is implied, and other statuses are refused), or leave the search empty for every deleted post. The preview says how many posts match and shows the first of them; tick some and Purge ticked (up to 500 at once), or Purge all to purge every match. Either way, tick the box confirming the posts, their files and their history go for good.

A background job then purges the posts one by one, just as purging each would, logging each purge as yours; starting the purge is logged too, with its search or the posts ticked. Posts are checked again as the job gets to them, so one restored or appealed meanwhile is skipped, as is one whose status is locked unless you have Lock posts. A post whose files can’t be removed is counted as failed and left deleted (purge it again later); if several in a row fail, the job stops and is retried later, carrying on where it stopped rather than starting over. The page lists recent purges with how many posts were purged, skipped and failed. The API has the same operation (POST /api/v1/moderation/purge with a query or post_ids, followed with GET /api/v1/moderation/post-batches/{id}).

Locks

Staff with Lock posts (moderators, by default) lock a post’s rating, tags, notes or status under Moderate on the post page, for instance to end an edit war. The post says what’s locked, and locking and unlocking show in its history and the log. For everyone without Lock posts:

  • a locked rating or tags can’t be changed: not by editing the post (on the site, through the API, Danbooru apps or tag scripts), nor by reverting to an earlier version;
  • locked notes can’t be added, changed or deleted;
  • a locked status means the post can’t be flagged, approved, rejected, deleted, restored or appealed, nor its flags dismissed.

Mass tag edits leave posts with locked tags alone, and the tagger doesn’t touch locked tags or ratings. Tag aliases and implications still apply to every post, so a renamed tag stays renamed.

Appeals

The uploader of a deleted post (and anyone who can see deleted posts), if their role can flag posts, can appeal it from the post page with a reason. A post has one open appeal at a time, and each person can appeal three posts at once, then one more every four hours. Once an appeal is turned down, the post can’t be appealed again for a week. Open appeals are listed under Moderation → Appeals (and found with status:appealed) for those who can delete and restore posts: Restore brings the post back and grants the appeal (so does restoring it any other way); Keep deleted turns the appeal down, with an optional reason, in the log. The post page keeps its appeals and how they ended, for staff and the uploader.

Bans

Ban a user from their profile, for a set time or until lifted, with a reason, from everything or only from some things.

A partial ban takes away only what’s ticked: uploading, editing posts and tags, commenting (and posting in the forum), voting, flagging, editing the wiki, pools or notes, sending messages, or leaving feedback. Everything else stays as their role has it, and they’re told on every page what they can’t do, and why.

A full ban leaves only looking around. Banned users can still log in and look around as visitors do, see why they’re banned, and can’t change anything, even what the site lets visitors do (if visitors may comment or vote, banned users still can’t); their API keys are limited the same way. Banning someone who’s already banned replaces their ban with the new reason and length. Timed bans last up to 3650 days. Only whoever set a ban, or someone ranked above them, can lift it or replace it, so a moderator can’t undo or shorten a ban an admin set.

Ban appeals

Banned users can Appeal their ban, from the notice every page shows them (/bans/appeal), saying why it should be lifted: one appeal at a time, and a week’s wait after one is turned down. Open appeals are listed at the top of Moderation → Bans, with the ban’s reason and who set it. Those who could lift the ban (who outrank the user, and set the ban or outrank whoever did) Lift the ban, which grants the appeal, or Keep it, with an optional note on why. The user is notified either way, and both go in the log.

Networks (an address or a CIDR range such as 203.0.113.0/24, or 2001:db8::/64 for IPv6, where one household usually has a whole /64) are banned under Moderation → Bans, partly or fully:

  • a partial ban lets requests from the network read, but not register, log in or change anything;
  • a full ban keeps the network from seeing the site at all: every page and API call answers that the network is banned, with the reason.

A bare IPv6 address bans its /64, since one household or phone moves around within it; an IPv4 address is banned alone. The range may not include your own address, or be wider than a /8 (IPv4) or /16 (IPv6); only staff who manage users can ban a range wider than a /16 (IPv4) or /32 (IPv6) at all, or fully ban one wider than a /24 (IPv4) or /48 (IPv6). As with banning users, rank counts: you can’t ban a range, or lift a ban on one, that includes an address of anyone ranked at or above you (yourself included), as kept under Addresses or by a session still open. If a network ban locks staff out anyway, lift it from the shell with moekura admin lift-network-ban ADDRESS, which lifts every ban covering that address (or overlapping a range) and logs it.

IPv4 clients are always matched (and shown) as IPv4, also when the server listens on IPv6 as well ([::]). An address or range copied from a log that writes them IPv4-mapped (::ffff:203.0.113.7, ::ffff:203.0.113.0/120) is banned as the IPv4 it stands for. Network bans are kept in memory on every node, so checking them costs nothing per request; changes reach other nodes within moments.

A user’s record

Staff who can ban users or read the log see a Moderation record link on the profiles of people ranked below them (and the log’s user names lead there too); nobody sees their own record, or that of a peer or anyone above them. The page puts a user’s history in one place: their role, status, when they joined and were last seen, whether two-factor login is on and whether they’re kept from automatic promotion; their bans, with controls to ban or lift the ban; their uploads by status and the recent deletions with reasons; the flags on their uploads, and the flags they filed with how many were upheld or dismissed; reports about their comments and their hidden comments; and, for those who read the log, what was logged about them and what they did themselves.

Deleting all of a user’s uploads

To clean up after a spam account, staff with Delete posts can delete every upload of a user ranked below them at once: Delete all uploads under Uploads on the record says how many posts that is, and asks for a reason (the same presets as deleting one post) and a tick to confirm. A background job then deletes the user’s active, flagged and pending posts in batches, just as deleting each one would: the posts show the reason, open flags on them are upheld, tag counts drop, each deletion is logged as yours, and every post can still be restored (webhooks aren’t sent a post.deleted event for each, though). Posts already deleted are left out; those whose status is locked are skipped unless you have Lock posts. The record shows the progress: how many posts were deleted, skipped (dealt with meanwhile, or locked) and failed. Only one such deletion runs per user at a time, and the account itself stays; ban it separately. The API has the same operation (POST /api/v1/users/{name}/delete-uploads, followed with GET /api/v1/moderation/post-batches/{id}).

Warnings

Short of a ban, staff who can ban someone can Warn them, with a reason: from their record, or about a comment or forum post of theirs (Warn among its staff controls). The user is notified (“You were warned about your comment on post #12: …”), the comment or forum post says for everyone that its writer was warned about it, the record lists the user’s warnings, and the log has each.

Staff notes

The same staff keep private notes about users ranked below them, on the profile and the record: who wrote each and when, in the same markup as comments. Only those staff see them, not the user, nor the user’s peers when they’re staff themselves. Authors delete their own notes; those who can ban users delete the notes of people ranked below them. A deleted note is kept, marked with who deleted it and when, for staff who read the log, and the deletion is logged (without the note’s text).

Addresses

For staff who can ban users, on the record of someone ranked below them, the record also lists the addresses the account used, when each was first and last seen, and the other accounts (also ranked below them) seen on the same addresses, which is how ban evaders usually show. Each address has shortcuts to ban it, or its /24 (IPv4) or /64 (IPv6) network, under Moderation → Bans.

What’s stored, for your privacy policy: for each account, each address it logged in or changed something from (posting, editing, voting, changing settings and so on; merely reading pages isn’t recorded), with the first and last time it was seen, at most hourly. Addresses are kept for 365 days after they were last seen, then forgotten by a daily job; change that under Admin → Settings (Keep the addresses accounts use), where 0 keeps none and stops recording them. Deleting an account deletes its addresses. Sessions separately keep the address they were started from until they end. The addresses also help at login: while someone guesses an account’s password from many networks at once, its owner can still log in from a network (an IPv4 address or an IPv6 /64) it used, or from elsewhere with a captcha, if one is set up.

Renaming users

Staff who can ban users can rename anyone ranked below them with Rename on their profile, say for an offensive or impersonating name, with a reason for the log. Unlike users’ own changes, it has no waiting time. Their profile lists their former names, and the old name still finds them (see Your name).

Spam accounts

Besides rate limits, email confirmation and approval of new accounts (Admin → Settings → Registration), two settings under Admin → Settings → Spam keep spam accounts out:

  • Email domains: a list of domains whose addresses are refused (such as disposable-mail services), or the only ones accepted (such as a school’s). Each domain covers its subdomains. It applies when signing up and changing an address; accounts made through single sign-on don’t take a refused address, and where new accounts confirm their address, can’t be made without one the site accepts.
  • Captcha: with a service set up (see [auth.captcha]), ask for it when signing up, and on comments by accounts younger than a number of days. The APIs ask too: such accounts’ comments through them are refused unless the client passes a solved captcha’s token on. It isn’t asked for when signing up through single sign-on, where the provider has checked who is logging in; the limit of new accounts per address still applies. Logging in to an account asks for it, whatever these say, while someone guesses its password from many networks at once.

Spam filter

Comments, forum posts and messages that look like spam are held for review instead of appearing: nobody but their writer knows they exist (and they’re told only that the staff will check it). By default the filter runs unless the site is private; Admin → Settings → Spam can turn it on or off for good, and choose what it holds:

  • links (http://, https://, www.) from accounts younger than 3 days, or, however old, from accounts with no comment, forum post or upload out yet (so an account left to age before spamming is held just the same);
  • text its writer already posted (or changed something to) 3 times in the past day, anywhere, counting texts the same when their letters and digits are, whatever their case, spacing or punctuation;
  • anything containing one of the spam words, one word or phrase per line, as whole words (ass doesn’t hold “class”), whatever the case, and seen through disguises: look-alike letters (full-width or styled ones), accents, invisible characters, and letters spaced or dotted apart (c a s i n o). Words in scripts written without spaces, such as Chinese or Japanese, match anywhere in the text.

Set a number to 0 to stop holding for it. Changing a comment or forum post is checked the same way: a change that would be held as a new text hides it again until the staff approve it. People who can Hide comments and handle reports about them are never held, and review what is under Moderation → Held for review, oldest first, with why each was held. Approve lets it through as if just posted (mentions, replies and messages notify then, and webhooks fire; an approved change just reappears, as changes notify nobody); Reject keeps it hidden for good, and a rejected message never reaches its recipient (it’s kept, for the record). Both go in the moderation log. Held writing is settled only here: restoring a held comment or forum post the usual way is refused, as is undeleting a topic held for its opening post, and the recipient of a held message can’t bring it back from their deleted messages. Held messages are only for staff who Read reported and held private messages: others reviewing held writing don’t see them.

Tag aliases and implications

Members request them under Tags → Aliases or Implications; people who can manage tags approve or reject them (their own requests apply at once). See Tags.

Mass tag edits

Moderation → Mass edit (for those with Mass edit tags) adds and removes tags on every post a search finds: cat_ears → add animal_ears, remove cat_ears. Preview shows how many posts match and the first of them; Change starts a background job. The page lists recent mass edits with their progress. Changes show in each post’s history, credited to whoever started the edit, and added tags bring the tags they imply. The tags to add can also take -tag and rating:e to set every post’s rating; locked tags and ratings are left alone. Deleted posts are only changed if the search asks for them (status:deleted or status:any).

Bulk update requests (Tags → Requests) bundle several alias, implication, category and mass edit changes; approving one applies them in order, and approving or rejecting it is logged. One with mass edit (update) lines needs Mass edit tags to approve, from someone other than its requester, and each of its mass edits is logged as the approver’s. See Tags.

Post changes and undoing vandalism

Moderation → Post changes (/post_versions, also linked from each post’s history and each profile) lists every change to posts across the site, newest first, for anyone: tags added and removed, rating, source, parent, description and locks. Filter it by who made the change, the post, a tag added or removed, and a range of days. Changes to tags, wiki pages, pools and notes have lists of their own (/tag_versions, /wiki_page_versions, /pool_versions, /note_versions), filtered by user the same way and linked from each user’s moderation page.

Filtered to one user, it offers those with Undo a user’s post edits (moderators, by default) Undo their edits, for users ranked below them: in the background, every post edit the user made in the range is taken back. Tags they added come off and tags they removed go back; a rating, source, description or parent they set is put back where nobody changed it since, and locked tags and ratings are left alone. Uploads aren’t edits and stay. Each post’s history credits whoever started the undo, and the log records it.

Stats and reports

/stats (linked from every page’s footer) shows anyone the site’s totals: posts, tags in use, users, favorites, comments, forum posts, wiki pages, pools, artists and notes.

Staff who can read the moderation log also get Reports there, charting uploads, post changes, approvals, comments, forum posts, wiki edits, note changes, favorites, post votes and new accounts over the last 30, 90 or 365 days, with the most active users for each. Picking a user charts theirs alone.

The stats.refresh job counts all of this hourly (the first time, the past year), so the pages cost nothing to view. Days are UTC.

The moderation log

Moderation → Log lists every staff action: approvals, deletions, purges, flag and appeal decisions, bans, hidden comments and forum posts, staff edits to forum posts and topics, held writing let through or turned away, deleted staff notes, tag and relation changes, role and setting changes (including those made from the shell). It also records what members ask staff to act on: flags, appeals, disapprovals and feedback on users (with each change to feedback, as its history). Each entry is written in the same transaction as the change it records, so nothing changes without its entry, and only when something did change. Forum hides, topic changes, held decisions and lock changes take an optional reason, as deletions and bans do.

Staff who approve, delete or moderate what people post (janitors, by default) without Read the moderation log see the part of it about that: posts, comments, the forum, tags, pools, artists, held writing and reports about them; not what was done to accounts, roles, settings or private messages.

Filter it by action, moderator, post, the user acted on, a range of days, or what else an entry is about: a comment, forum post or topic, message, staff note, feedback, pool, artist or news item, by number (each entry about one links to its own log). Role, status and setting changes show what they changed from.

Private sites

To keep everything behind a login, take View posts away from the Anonymous role (Admin → Roles). Then:

  • visitors are sent to the login page;
  • the API answers 401 to requests without a key;
  • file links on pages carry a signature that expires after an hour or two, so files can’t be fetched by guessing or sharing their URLs.

Pick a registration mode to match: usually invite, approval or closed.

Files need to go through the app

Signed links only protect files the app serves itself. Leave storage.public_base_url unset: with local storage the app serves files under /data/, and with S3 it streams them from the bucket, so the bucket can stay private.

A CDN or public bucket address would hand files to anyone who has the link, so the server warns about this combination at startup.

Feeds need a user’s feed token on a private site; see Feeds.

File storage

Originals, thumbnails, samples and video posters are stored under keys derived from the file’s SHA-256, such as original/ab/cd/abcd….png. The same file is only ever stored once.

On disk

The default. Files go under storage.path (./data, or /var/lib/moekura/data in the container image), and the app serves them under /data/ with long cache lifetimes: a key never changes content.

S3-compatible storage

Any S3-compatible store works: AWS S3, MinIO, Garage, SeaweedFS, Cloudflare R2, Backblaze B2.

[storage]
backend = "s3"

[storage.s3]
bucket = "moekura"
region = "auto"
endpoint = "https://ACCOUNT.r2.cloudflarestorage.com"
# Or MOEKURA_STORAGE__S3__ACCESS_KEY_ID / MOEKURA_STORAGE__S3__SECRET_ACCESS_KEY.
access_key_id = "…"
secret_access_key = "…"
# Most self-hosted stores need this.
path_style = true

Objects are stored with their content type and Cache-Control: public, max-age=31536000, immutable: a key never changes content, so a CDN or browser may keep it forever.

Without public_base_url, the app streams files from the bucket, which can stay private.

A CDN or public bucket

Set storage.public_base_url to where browsers can load the files, and the app links there instead of serving them:

[storage]
public_base_url = "https://cdn.example.com"

The site’s content security policy allows images and videos from that origin. Don’t do this on a private site.

For a CDN in front of a bucket:

  • make the bucket (or the path the CDN reads) publicly readable, or give the CDN its own credentials;
  • let the CDN honour the objects’ Cache-Control, or cache everything for a long time: nothing under a key ever changes;
  • serve the files from a different domain than the site (for example cdn.example.com), so uploaded files can never run as the site.

Files stored by versions before 0.1 have no content type or caching headers of their own. moekura admin regenerate-media --all stores the thumbnails and samples again; the originals keep what they had, so give the CDN a default Cache-Control.

Media settings

After changing thumbnail sizes, the sample size or the format under [media], regenerate what’s stored:

moekura admin regenerate-media --all

Background jobs

Work that shouldn’t hold up a page runs as background jobs, queued in PostgreSQL:

JobDoes
media.processmakes thumbnails, samples and video posters, and the perceptual hash for similar-image search, after an upload
media.hash_pixelsonce, after the upgrade that added pixel hashes: hashes the pixels of earlier posts, for pixel-perfect duplicate warnings
tags.apply_relationre-tags existing posts when an alias or implication is approved
posts.purgeremoves a purged post and its files
posts.expire_stalehourly, deletes posts left waiting too long, when Posts left waiting is set
ml.tag_postsuggests tags for a post; only moekura tagger takes these
ml.tag_stagedsuggests tags for an uploaded file’s post form, before it’s posted; also only for the tagger
stats.refreshhourly, counts the figures for stats and reports

serve runs job workers itself, jobs.workers at a time. On a busier site, run workers as separate processes and turn them off in the web servers:

moekura worker          # as many as you like, on any machine
[jobs]
run_in_serve = false     # on the web servers

Workers claim jobs without stepping on each other, and only the kinds they can do: ml.tag_post jobs wait for a tagger. Webhook deliveries, which wait on other servers, run at most webhooks.max_concurrent at a time across all workers, so with more workers than that they never hold every worker. (A delivery whose worker died keeps its place until its lock runs out, jobs.lock_timeout_secs.) A failed job is retried with increasing delays; after its last attempt it’s kept as failed. Admin → Overview shows the queue, and failed jobs with their errors, to retry or discard. Errors and the buttons are only for those who manage site settings (an error can quote what the job was sending to), and a failed mail shows only who it was for, never its text, which may hold a password reset link.

Tag categories

Tags belong to a category, which decides how post pages and tag lists group and colour them. Every site starts with Danbooru’s five: general, artist, copyright, character and meta. Admins (anyone who can manage site settings) change them under Admin → Tag categories:

  • Relabel any category: the label is what people see, such as “Creator” for artist.
  • Reorder them with Move up and Move down; tag lists show the groups in this order.
  • Add a category with a name and a label, e.g. species / “Species”. The name is how people put a tag in it (species:cat in a tag box) and search by it (speciestags:2). It must be lowercase letters, digits and underscores, can’t be a word searches already use (rating, gen, …), and can’t be how existing tag names start (rename species:… tags first).
  • Rename a category you added. Its tags stay in it.
  • Delete a category you added once no tag is in it; move its tags elsewhere first (from the tag’s page, or with a mass edit category tag -> general).

Every change is recorded in the moderation log.

What can’t change

  • Ids. Each category keeps its number for good, and a deleted category’s number isn’t given to a new one if tag history still mentions it. Posts’ per-category tag counts, tag history and the Danbooru-compatible API (tag_category, category in /tags.json) refer to categories by id.
  • Danbooru’s names and ids (general 0, artist 1, copyright 3, character 4, meta 5). Danbooru apps, imports from other boorus and the tagger rely on them, so these can only be relabelled and reordered, not renamed or deleted. Categories you add get ids from 6 up.

Changes apply on every server at once: categories are read from the database, not cached.

Colours

Tags in a category get the .tag-<name> class. Danbooru’s categories are coloured by the theme’s --tag-<name> variables; a theme can colour a new one:

.tag-species { color: light-dark(#00707a, #4fd1d9); }

Without that, its tags take general’s colour.

Site news

Admins (with Manage site settings and roles) post short announcements under Admin → News: a sentence or two in the same markup as the wiki, optionally with a last day to show it.

The newest news that hasn’t expired is shown at the top of every page, with Dismiss. Dismissing hides it, and older news, for good: in a cookie, and for logged-in users in their account too, so it stays hidden on their other devices. Newer news shows again.

Editing news doesn’t bring it back for those who dismissed it; post new news for that. Delete takes news down at once, and Restore puts it back. Posting, editing, deleting and restoring news go in the moderation log, and Danbooru apps read the news at /news_updates.json.

Webhooks

Webhooks tell other services about events on the site as they happen: a chat bot announcing uploads, a mirror, or your own scripts. Add them under Admin → Webhooks (for those who manage site settings), with the URL to send to and the events it wants:

EventWhen
post.createda post is uploaded (by any means)
post.approveda pending post is approved
post.deleteda post is deleted or rejected
post.restoreda deleted post is restored (granting its appeal, if it had one)
post.flaggeda post is flagged
comment.createda comment is posted
user.registeredsomeone registers (with a form or single sign-on)

Each webhook has a format: Moekura JSON, signed (below), or Discord, for a Discord webhook. The form picks Discord by itself for Discord webhook URLs.

Deliveries

Each event is a POST of JSON:

{
  "id": 42,
  "event": "post.created",
  "created_at": "2026-09-26T12:00:00Z",
  "data": { "post_id": 123, "url": "https://booru.example.com/posts/123", "tags": ["cat"], … }
}

Post events carry post_id, url, status, rating, source, tags, uploader and uploader_url, created_at, and image_url: a sample of the image (or a video’s poster), only for posts visitors who aren’t logged in may see on a site that isn’t private, and never for deleted posts. So a post waiting for approval has no image until post.approved, and neither do banned artists’ posts while they’re hidden or ratings kept from visitors. Deletions and flags add a reason. Comments carry comment_id, post_id, url, creator, creator_url, body and created_at; registrations user_id, name, url and status.

with these headers:

Header
X-Moekura-Eventthe event
X-Moekura-Deliverythe delivery’s number (the same across retries)
X-Moekura-Timestampseconds since 1970 when it was sent
X-Moekura-Signaturesha256= and the HMAC-SHA256, in hex, of {timestamp}.{body} with the webhook’s secret

Check the signature and reject old timestamps (older than five minutes, say), so nobody else can send you events or replay old ones. In Python:

import hashlib, hmac, time

def valid(secret: str, timestamp: str, body: bytes, signature: str) -> bool:
    expected = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
    fresh = abs(time.time() - int(timestamp)) < 300
    return fresh and hmac.compare_digest("sha256=" + expected, signature)

Answer with any 2xx status. Network errors, 5xx, 408 and 429 are retried in the background, waiting longer each time, for about five hours (or, for a 429 with Retry-After, as long as that says, up to an hour); other statuses are given up at once. Only the first 64 KiB of an answer are read, so keep it short. A webhook’s page lists its latest deliveries with what came back (the first 1000 bytes), and Send a test sends a ping event. Deliveries are kept for 30 days.

Deliveries are sent one at a time (webhooks.max_concurrent in the configuration), so the other background jobs, like thumbnails and mail, don’t wait on a receiver that’s slow to answer. After 5 deliveries in a row that couldn’t reach a receiver, or that it didn’t answer within webhooks.timeout_secs, the webhook is paused for 10 minutes: its page says so, and its deliveries go on being retried on their usual schedule without being sent. Then the next one tries again; an answer of any status ends the pause, and Send a test goes even while paused. Pointing the webhook at another URL ends it too.

Webhooks don’t follow redirects, and don’t go to private or local addresses unless webhooks.allow_private_addresses is on in the configuration.

Discord

To post events in a Discord channel, make a webhook in the channel’s settings (Integrations → Webhooks → New Webhook), copy its URL (https://discord.com/api/webhooks/…/…) and add it here. Each event becomes a message with one embed: a link to the post, comment or user, who made it, the rating, tags (as many as fit), source and reason, and for posts the image. Send a test posts a short “Moekura connected” message.

  • Images show only for posts whose rating is ticked under Images in Discord messages (general and sensitive at first) and that visitors who aren’t logged in may see (the visitor_ratings site setting; not pending posts or hidden banned artists’ posts). Others get a message without the image. Private sites never send images, since Discord couldn’t load them.
  • Nobody is pinged: messages turn off @everyone, role and user mentions, whatever a comment says.
  • Comments, sources, tags and reasons show as written: Discord markdown in them is escaped, so a link can’t pose as another. A source that is a web address shows as that address, linked.
  • Name and Avatar URL replace the webhook’s own name and avatar in the messages. Discord doesn’t allow names containing “discord” or “clyde”.
  • There are no signature headers and no secret: the token in the URL is the secret, so keep the URL private.
  • Rate limits are honoured: on 429 the delivery waits as long as Discord asks before trying again.
  • Deliveries are sent with ?wait=true, so the log shows the id of the message Discord made.

Discord is on the public internet, so allow_private_addresses isn’t needed. Messages to a thread can use the URL’s thread_id parameter as usual.

Bots

A bot is an account run by a program, such as an uploader mirroring another site, a tagging script or a chat bot, rather than a person. It uses the site only through API keys:

  • it can’t log in on the site, whether with a password, single sign-on or a passkey, and a password reset isn’t sent to it;
  • a feed token doesn’t work for it;
  • it isn’t promoted automatically;
  • nobody can send it messages, since nobody would read them;
  • its profile and the admin user list mark it Bot, and the API’s user answers have "is_bot": true.

Otherwise it’s an ordinary account: its role decides what it may do, its uploads and edits are credited to it, and it can be banned.

Setting one up

Make the account, then a key for it, from the shell:

moekura admin create-user mirrorbot --bot --role contributor
moekura admin create-api-key mirrorbot --name "mirror" \
  --permission view_posts --permission upload --permission edit_posts

The key is printed once; give it to the program. Limiting it to the permissions the program needs means a leaked key gives away less. List and revoke the bot’s keys with moekura admin api-keys mirrorbot and moekura admin revoke-api-key mirrorbot ID: with no way to log in, a bot has no settings page of its own.

moekura admin set-bot NAME makes an existing account a bot, ending its sessions and revoking its feed token but keeping its API keys; --off makes it a person’s again, who then logs in by resetting the password or through single sign-on.

Themes

A theme sets the site’s colours, in both light and dark mode. Moekura comes with six:

ThemeColours
Defaultcool greys and blue links under a navy header
Forestmoss green
Neutralgreys, near-black ink and a charcoal header
Oceansea-foam links under a night-sea navy header
Sakurapink under a plum header, Moekura’s colours before 0.5
Wisteriaviolet links under an indigo header

Choose the theme visitors see under Admin → Settings → Default theme. Logged-in users can pick any theme the site has, and light, dark or their device’s mode, under Settings or in the account menu of any page. A user whose theme is removed gets the site’s default again.

Adding a theme

A theme is a stylesheet named themes/<name>.css in the static_override directory. The name may use lowercase letters, digits and dashes (high-contrast shows as “High contrast”), but not system, light or dark. The file sets the colour tokens of css/main.css, each as light-dark(<light>, <dark>); tokens it leaves out keep the default theme’s colours:

/* themes/dusk.css */
:root {
  --bg: light-dark(#faf7f2, #17140f);
  --surface: light-dark(#ffffff, #201c16);
  --text: light-dark(#231f19, #efe9df);
  --muted: light-dark(#6b6358, #a9a093);
  --border: light-dark(#e7e0d4, #37302a);
  --accent: light-dark(#a1471a, #f0925c);
  --accent-text: light-dark(#ffffff, #17140f);
  --danger: light-dark(#c92a2a, #ff8787);
  /* Tag categories. */
  --tag-general: light-dark(#0068e0, #4fa3ff);
  --tag-artist: light-dark(#c00004, #ff8a8b);
  --tag-copyright: light-dark(#a800aa, #d98cff);
  --tag-character: light-dark(#007e25, #35c64a);
  --tag-meta: light-dark(#ad5c00, #ffb54a);
}

A few more tokens are made from those, so a theme that sets only the colours above still gets a header and ruling to match. Set them too to choose them yourself:

TokenWhat it colours
--shell, --shell-textthe header band and its text (keep 4.5:1 between them)
--rulehairlines between table rows and facts
--tinthovered and highlighted rows
--staff, --staff-textthe board under staff tools on post pages

Keep text, links (--accent) and tag colours at a contrast of at least 4.5:1 against --bg and --surface, and --accent-text against --accent, so everyone can read them. Restart moekura serve to pick up new or changed themes. A file with a built-in theme’s name replaces it.

Translations

Pages are shown in each reader’s language: the one they chose under Settings → Language, or else the best match for their browser’s languages, or else English. The language menu only appears once the site has more than one language.

Moekura ships in English (en-US). Its messages are Fluent files in crates/web/locales/en-US, one per area of the site (posts.ftl, moderation.ftl and so on).

Adding a language

Point paths.locales_override at a directory, and give it a subdirectory per language, named by its tag (de, pt-BR), holding .ftl files:

[paths]
locales_override = "/srv/moekura/locales"
/srv/moekura/locales/
  de/
    common.ftl
    posts.ftl

Copy the English files and translate their messages; keep each key (left of the =) as it is. Messages you leave out show in English, so a language can be translated a part at a time. Each language needs a language-name message, its name in itself, for the menu:

language-name = Deutsch
nav-posts = Beiträge

Messages are HTML: keep the tags the English ones have, and write &lt; for a literal <. Variables like { $count } are filled in by the page; use Fluent selectors for plurals and other forms. A message with a {$name} (no spaces) in scripts.ftl is filled in by the page’s scripts, so these can’t use selectors.

Files for en-US in the directory replace the built-in messages they define, which is how to reword the English ones. Restart after changing the files; a file that doesn’t parse stops startup with the reason.

What isn’t translated

Text people wrote (posts, tags, the wiki, comments, the rules), tag category names, role names and forum categories show as written. Emails, feeds, the APIs (including the API reference’s descriptions) and the error messages specific forms give are in English. Notifications and spam-filter reasons are worded when they happen, so their details keep the language they were written in.

Backups

A site is its PostgreSQL database plus its stored files. Back up both, the database first: a file with no database row is harmless, a row whose file is missing is not.

To copy posts to another site, or keep their files with their tags outside the database, use moekura admin export instead; it isn’t a backup.

CI backs up a site as this page says, restores it into an empty database and empty storage, and checks that its posts, files and users are intact, with local storage and with S3.

The database

pg_dump --format=custom --file=moekura-$(date +%F).dump moekura
# with compose:
docker compose -f deploy/compose.tiny.yml exec -T db pg_dump -U moekura --format=custom moekura > moekura-$(date +%F).dump

The site can keep running while it’s dumped.

Files

Files never change once written, so incremental copies are cheap:

rsync -a /var/lib/moekura/data/ backup:/srv/moekura-data/

With compose, the files are in the files volume. Copy them out through the app’s container, as an archive:

docker compose -f deploy/compose.tiny.yml exec -T app tar -C /var/lib/moekura/data -cf - . > moekura-files-$(date +%F).tar

For S3 storage, use the provider’s replication or versioning, or copy the bucket with a tool like rclone:

rclone sync s3:moekura /srv/moekura-files

Secrets

The key that signs file links on private sites is stored in the database, so a database backup includes it. The configuration (moekura.toml or the environment) is in neither backup: keep a copy of it too.

Restoring

Restore with the release that made the backup, or a newer one: migrations only move forward, so a newer release upgrades the restored database when it starts, but an older one can’t use it.

  1. Stop the app (moekura serve and any moekura worker).

  2. Restore the database into an empty one:

    createdb --owner moekura moekura
    pg_restore --dbname=moekura moekura-2026-10-01.dump
    # with compose, into a new database volume:
    docker compose -f deploy/compose.tiny.yml up -d --wait db
    docker compose -f deploy/compose.tiny.yml exec -T db pg_restore -U moekura --dbname=moekura < moekura-2026-10-01.dump
    
  3. Put the files back where storage points:

    rsync -a backup:/srv/moekura-data/ /var/lib/moekura/data/
    # with compose, into the files volume, as the app's user:
    docker compose -f deploy/compose.tiny.yml run --rm --no-deps -T --entrypoint tar app \
      -C /var/lib/moekura/data -xf - < moekura-files-2026-10-01.tar
    # S3:
    rclone sync /srv/moekura-files s3:moekura
    
  4. Start the app, then open a few posts to check their files load.

Restoring into a database that isn’t empty fails, or mixes the two sites. Drop it first (dropdb moekura), or with compose start from new volumes: docker compose -f deploy/compose.tiny.yml down -v removes both the database and the files.

Bulk import

moekura admin import adds a folder of images and videos as posts, taking their tags from the files downloaders and tag managers write next to them:

moekura admin import ~/downloads/art --uploader yourname --rating s
# with compose, mount the folder into the container first:
docker compose -f deploy/compose.tiny.yml run --rm -v ~/downloads/art:/import:ro \
  app admin import /import --uploader yourname --rating s
OptionMeaning
--uploader NAMEthe account the posts are uploaded by (required)
--rating Rrating for files whose sidecar has none: g, s, q or e
--tags "a b"tags to add to every file
-r, --recursivealso import files in subfolders
--dry-runshow what would happen, without importing anything

Every file goes through the same checks as an upload: supported types only, within the size and pixel limits. Files already on the site are skipped rather than refused, so if an import stops halfway, run it again. Each file is reported as it goes, then a summary; the command fails if any file couldn’t be imported. Thumbnails are made afterwards by the job workers, as for uploads.

Sidecar files

For pic.png, the importer reads pic.png.json or pic.json, and pic.png.txt or pic.txt; when there are both a JSON and a text file, their tags are combined.

Text files list tags one per line, as gallery-dl and Hydrus write them (spaces within a line become underscores), or on a single line separated by commas or spaces:

long hair
creator:some artist
series:some show
rating:safe

Namespaces are mapped to categories: creator: and artist: to artist, series: and copyright: to copyright, character: and meta: as they are. rating: sets the rating; safe counts as general. Other namespaces stay part of the tag’s name.

JSON files are objects with any of:

FieldMeaning
tagsa list of tags, a string of them separated by spaces, or an object of lists by category ({"artist": ["someone"], "general": ["cat"]})
tag_string, tag_string_general, tag_string_artist, tag_string_copyright, tag_string_character, tag_string_metaDanbooru’s fields, as its API and gallery-dl’s Danbooru metadata have them
ratingg, s, q, e, their names, or safe
sourcewhere the file came from
description
parent_sha256the SHA-256 of the parent post’s file, as exports write it

Lists by category keep the categories this site has, its own as well as Danbooru’s; tags in categories it lacks become general. Tags that aren’t valid here (with *, or starting with a search prefix like user:) are left out with a note; the rest of the file is still imported.

Once every file is in, posts whose sidecar names a parent’s file get that post as their parent, if it’s here. A parent imported in the same run is found by the file it was imported from, even when its metadata was removed as it was stored, which gives its post another SHA-256. One imported before is found by the file it’s stored as; if that lost its metadata, import the parent again with its children (it’s skipped as a duplicate, and found). Pixiv ugoira are imported from their .zip.

From other boorus

moekura admin import-remote copies posts from another booru through its public API, with their tags, rating and source, to move a collection here or keep a copy of a tag:

moekura admin import-remote https://danbooru.donmai.us "some_artist" --uploader boss
moekura admin import-remote https://yande.re "rating:s cat" --uploader boss --limit 500
Site--kind
Danbooru, and other Moekura sitesdanbooru
e621, e926e621
Gelbooru, Safebooru, Rule34 and other Gelbooru 0.2 sitesgelbooru
Moebooru: Konachan, yande.remoebooru

The kind is guessed for the sites named; give --kind for others. The search is in the other site’s syntax. Posts are imported newest first:

  • Tags keep their categories where the site has them (Danbooru and e621); from other sites, new tags are general. Tags that aren’t valid here are left out.
  • The source is the post’s own source, or its page on the other site.
  • Files already here (by MD5, or the same file) aren’t downloaded again; parents and children are linked as both arrive. A file whose metadata was removed here has another MD5, so it’s downloaded again, then recognised as the same post.
  • --notes and --pools also bring notes and pools from Danbooru-style sites. Pools are matched by name.

It waits a second between requests (--delay-ms); please don’t set it much lower on other people’s sites. Some sites want an account for their API or to show some files: give --login and --api-key (Gelbooru: your user id and API key). Posts whose file the site hides are skipped.

Progress is saved as it goes. Running the same site and search again carries on where it stopped (after --limit, a failure or Ctrl-C), and once it’s finished there’s nothing to do; --restart starts from the newest posts again, which also picks up posts added since. The site’s API pages, the files and every redirect must be on the public internet; to import from a site on your own network, add --allow-private-addresses. An API page (posts, a post’s notes or pools) may be up to 16 MB.

Exporting

moekura admin export writes posts’ original files to a folder, each with a sidecar that moekura admin import reads back, here or on another site:

moekura admin export ~/export
moekura admin export ~/export-cats --tags "cat rating:g"
# with compose, mount a folder to write to:
docker compose -f deploy/compose.tiny.yml run --rm -v ~/export:/export \
  app admin export /export
OptionMeaning
--tags SEARCHonly posts matching a search, as on the site (any filter, but no order:)
--include-deleteddeleted posts too, unless the search has a status:
--dry-runshow what would be written, without writing anything

Each post becomes 0000000123.png (its number, padded so the folder sorts oldest first) and 0000000123.png.json:

{
  "id": 123,
  "status": "active",
  "rating": "s",
  "tags": {"artist": ["someone"], "general": ["cat", "sky"]},
  "source": "https://example.com/art",
  "description": "",
  "parent_id": 120,
  "parent_sha256": "9f2c…",
  "sha256": "41ab…",
  "md5": "5d1e…",
  "media_type": "png"
}

The files are byte for byte the originals, read from the site’s storage, local or S3. Tags keep their categories by name. Post numbers can’t carry over to another site, so the parent is found again by its file (parent_sha256), which works as long as the parent is exported too; id and parent_id only record the numbers here.

Exports can be repeated and resumed: files already in the folder with the right size are kept rather than downloaded again, sidecars are rewritten when the post changed, and a file is only given its name once it’s complete. Each post is reported as it goes, then a summary.

An export is a way to move or share posts, not a backup. It has the files, tags, ratings, sources, descriptions and parents, but not accounts, favorites, votes, comments, notes, pools, the wiki, history or settings, and an import makes new posts with new numbers, uploaded by one account. To keep a whole site, see Backups.

The tagger

The tagger suggests tags and a rating for new uploads with a machine learning model: one of SmilingWolf’s WD taggers, trained on Danbooru and run on the CPU with ONNX Runtime. Suggestions appear on the post form while uploading and under Edit on each post (see Tags), and ai:tag searches for posts where a tag is suggested but not applied. The tagger can also apply what it’s surest of by itself.

It is optional, and a process of its own, moekura tagger: it takes work from the job queue, so it can run on the same machine as the site or on a bigger one elsewhere, as long as it reaches the database and the file storage.

Setting it up

With Docker Compose, add the tagger to the tiny setup:

docker compose -f deploy/compose.tiny.yml -f deploy/compose.tagger.yml up -d

That runs the -tagger image (ghcr.io/moe-studios/moekura:<version>-tagger, the app plus ONNX Runtime, for amd64 and arm64) as a second service, and turns tagger.enabled on for both. On first start the tagger downloads its model into the models volume, checks it against its SHA-256 checksum, and starts on the queue.

Elsewhere, it takes three things:

  1. A build with the tagger: the release binaries and images have it; from source, cargo build --release -p moekura --features tagger.
  2. ONNX Runtime 1.17 or newer: Microsoft’s onnxruntime-linux-x64 or -aarch64 archives have libonnxruntime.so. Point tagger.runtime (or ORT_DYLIB_PATH) at it, or put it on the library path.
  3. enabled = true in [tagger], for every process: serve and worker queue each processed upload for the tagger, and moekura tagger does the work.
[tagger]
enabled = true
runtime = "/opt/onnxruntime/lib/libonnxruntime.so"

moekura tagger --check loads ONNX Runtime and says where from, without touching the database. Posts uploaded before the tagger was set up are queued with

moekura admin tag-backlog              # posts it hasn't seen, oldest first
moekura admin tag-backlog --all        # every post, e.g. after changing models
moekura admin tag-backlog --limit 1000

What it suggests

Admin → Settings has the tagger’s settings:

  • Thresholds, per tag category: how sure the model must be, in percent, to suggest a tag. The defaults, 35% for general tags and 85% for characters, follow what the models’ authors recommend; categories left blank use General’s. Suggestions below the thresholds at the time a post is tagged aren’t kept, so lowering them affects posts tagged afterwards (or requeued with tag-backlog --all); raising them hides suggestions at once.
  • Applying suggestions itself, when the tagger is at least a given percent sure (95% by default), and optionally the rating too. These edits are made by the account tagger.account (tagger by default), so they show in each post’s history like anyone’s and can be reverted. The account is created without a password when moekura tagger starts, so nobody can log in as it, and nobody can sign up or rename themselves to the name meanwhile. If an account someone made already has the name (it has a password, an email address, a login through single sign-on, a session or an API key), the tagger refuses to use it: set tagger.account to another name.
  • Refusing uploads by new uploaders when the tagger finds a tag (or rating:e and the like) with at least a given confidence: one per line, ai-generated 50, as Danbooru’s new_uploader_blocked_ai_tags. It applies to users without an active post yet, who are told only that the post failed and to try again later; a file the tagger hasn’t looked at yet can’t be posted by them until it has. A file they send in one step (POST /upload, the API) waits as an upload for the tagger too, and sending it again once the tagger has looked posts it.

The model’s tag names are Danbooru’s. They’re matched to the site’s tags through aliases; tags the site doesn’t have yet are created, in the model’s category (general or character), when first suggested. Deprecated tags aren’t suggested.

Choosing a model

tagger.model picks one of the v3 WD taggers, which share a list of about 10,800 tags:

ModelDownloadNotes
wd-vit-tagger-v3 (default)380 MBthe fastest; fine on small machines
wd-convnext-tagger-v3400 MBsimilar size and accuracy, somewhat slower
wd-swinv2-tagger-v3470 MBa little more accurate, slower
wd-eva02-large-tagger-v31.3 GBthe most accurate, several times slower and larger in memory; for a desktop-class machine

Each is pinned to one revision with its checksum. Any other model shaped like these (one input of square BGR images, [batch, size, size, 3], and one score per line of a selected_tags.csv) works with model = "custom" and model_url, model_sha256, tags_url and tags_sha256. After changing models, moekura admin tag-backlog --all retags existing posts.

Hardware

The tagger needs no GPU. What it takes, with the default model:

  • Memory: about 600 MB once the model is loaded, and about 750 MB while tagging. Plan for 1 GB on top of the site. EVA02-Large, going by its size, takes over three times as much.

  • Disk: the model, 380 MB, in tagger.model_dir.

  • Time: measured on a desktop (AMD Ryzen 7 7800X3D), from taking the job to saving the suggestions:

    Threads (tagger.threads)Per post
    16 (0, all of them)0.35 s
    40.46 s
    11.35 s

    About 0.15 s of that is preparing the image, the rest running the model.

On a Raspberry Pi 4 (4 GB or more; 2 GB is too tight next to PostgreSQL and the site), expect several seconds per post with the default model, very roughly 3 to 6: its four Cortex-A72 cores have a fraction of a desktop’s speed at this work. That’s an estimate, not a measurement; the tagger logs how long each post took, so check yours. It keeps up with a small site’s uploads easily, and a large backlog takes hours rather than minutes. Don’t run EVA02-Large on one.

tagger.threads is threads per post; the default uses every core, which is right for a machine of its own. Next to the site on a small machine, leave a core or two free for it. tagger.workers tags several posts at once, each with the whole model; one is usually best.

Keeping an eye on it

Queued ml.tag_post jobs show on Admin → Overview. Only a tagger takes them, so if they pile up, it isn’t running. A post the tagger hasn’t seen says so under Edit. The tagger logs each post it tags, with how many suggestions it saved and whether it applied any.

Commands

CommandDoes
moekura serveruns the web server, plus job workers unless jobs.run_in_serve = false; migrates first unless database.auto_migrate = false
moekura workerruns job workers only
moekura tagger [--check]runs the tagger (a build with the tagger feature); --check only loads ONNX Runtime
moekura migrateapplies pending migrations and exits
moekura check-configvalidates the configuration and prints it, secrets redacted
moekura openapiprints the API’s OpenAPI description
moekura admin create-user NAME [--role ROLE] [--email E]creates an account; asks for the password, or reads one line from standard input
moekura admin create-user NAME --bot [--role ROLE]creates a bot, which has no password and uses API keys only
moekura admin set-role NAME ROLEchanges someone’s role
moekura admin set-owner NAMEmakes someone the site’s owner, who outranks every role, in place of the current one
moekura admin set-bot NAME [--off]makes an account a bot, ending its sessions and revoking its feed token, or with --off a person’s again
moekura admin lift-network-ban ADDRESS_OR_RANGElifts the network bans covering an address, or overlapping a range, such as one that locks staff out
moekura admin create-invite [--uses N] [--expires-days D]makes an invite code, shown once
moekura admin create-api-key USER --name N [--permission P]… [--expires-days D]makes an API key for someone, such as a bot, and prints it once; each --permission (view_posts, upload, …) limits the key to the ones given, and without any it can do everything the user can
moekura admin api-keys USERlists someone’s API keys: id, name, first characters, what each may do, and when it was made, last used and expires
moekura admin revoke-api-key USER IDrevokes one of them, by its id from api-keys
moekura admin settingsshows the site settings
moekura admin settings set KEY VALUEchanges one; VALUE is JSON, or else a plain string
moekura admin regenerate-media (--all | IDS…)remakes thumbnails and samples, and rereads the files’ metadata
moekura admin recount-tagsrecomputes every tag’s post count
moekura admin tag-backlog [--all] [--limit N]queues posts the tagger hasn’t seen (or, with --all, every post)
moekura admin send-test-mail ADDRESSsends a test message through the [mail] settings
moekura admin import DIR --uploader NAME …imports a folder of files; see Bulk import
moekura admin export DIR [--tags SEARCH] [--include-deleted]writes posts’ files and sidecars to a folder; see Exporting
moekura admin seed --posts N [--tags T] [--seed S]fills a test database with synthetic posts for load testing; see Scaling
moekura admin bench [--check] [--explain NAME]times a suite of searches against the database
moekura admin bench-http [--url URL] [--concurrency N] [--check-ms MS]times pages and API responses from a running server; see Scaling

Every command takes --config PATH. Role and setting changes, and lifted network bans, made here appear in the moderation log.

Scaling

A single moekura serve with PostgreSQL on the same machine is enough for a private collection or a small community. As a site grows, the same program scales out:

  • run web servers behind a load balancer; they keep no state of their own;
  • move background jobs to separate moekura worker processes;
  • add PostgreSQL read replicas (database.replicas), which take searches and listings;
  • store files in S3-compatible storage with a CDN in front;
  • with several web servers, point them at a shared Valkey (cache.backend = "valkey"). Without it, login, registration, posting and reporting limits are still counted across all of them, in the database, but the API’s per-request limit and cached search counts are each server’s own;
  • with several web servers, set database.auto_migrate = false and run moekura migrate when deploying.

Read replicas

List PostgreSQL streaming replicas in database.replicas:

[database]
url = "postgres://moekura:…@primary/moekura"
replicas = ["postgres://moekura:…@replica-1/moekura", "postgres://moekura:…@replica-2/moekura"]

Searches, listings, tag pages, profiles and history then read from the replicas in turn; everything else, and every change, uses the primary. Every few seconds each server checks its replicas: one that doesn’t answer, or is more than database.replica_max_lag_secs behind, is skipped until it’s back (the log says when). With no usable replica, reads go to the primary.

After someone changes something (an upload, an edit, a favorite), their own reads go to the primary for replica_max_lag_secs, so they always see what they just did. Other people may see it a moment later.

Measured with 5,000,000 synthetic posts (250,000 tags, with 1.8 million comments, 530,000 notes, 12,500 pools and 14 million tagger suggestions; an 11 GB database) on a 16-core machine with 32 GB of memory, PostgreSQL 18 given shared_buffers = 4GB, with release 0.5.0. Each search is what a results page runs: looking up the tags, fetching the page, and counting. Times are the 95th percentile of 20 runs, in milliseconds:

SearchExamplems
front page0.2
a tag on 70% of postsred_red0.5
two / three common tagsred_red blue_red7.5 / 16
a common tag without anotherblue_red -red_red20
a rare tag (200 posts)detailed_back_31.1
a common and a rare tagred_red detailed_back_38.9
either of two tags~cold_red ~old_red38
wildcardscold_*, *_red42, 6.3
file type and a tagfiletype:mp4 blue_red1.4
rating and scorerating:e score:>201.1
a year, with a tagdate:2022, blue_red date:20221.7, 5.2
page 500 of a common tag6.3
a cursor deep into a common tagpage=b25000000.5
a pool, in its own orderpool:23, ordpool:231.4, 1.3
posts in any poolpool:any46
a favorite group (300 posts)favgroup:12351.8
a word in notes, common / rarenote:red, note:new77 / 26
recently commented / notedorder:comment, order:note2.5, 3
comment countcommentcount:>324
suggested by the tagger, alone / with a common tagai:long_red27 / 38
a user’s 16 saved searchessearch:all103

What keeps it fast:

  • Tag searches pick their strategy from exact tag counts. Common tags walk the newest posts until a page is full; rare ones are collected through the tag index. PostgreSQL alone often guesses wrong for tag combinations.
  • Counts stop early. Counts are exact up to search.count_limit (10,000). Counts that would still read too much, per PostgreSQL’s estimate (search.count_cost_limit), are shown as estimates instead.
  • “Next” links use cursors, which cost the same however deep they go; numbered pages stop at the deepest page allowed (Search pages).
  • Saved searches run four at a time for search:, each contributing its newest 500 posts.

Measuring your own

Seed a separate database, then benchmark it:

MOEKURA_DATABASE__URL=postgres://…/moekura_bench moekura admin seed --posts 5000000
MOEKURA_DATABASE__URL=postgres://…/moekura_bench moekura admin bench

Seeding generates everything in PostgreSQL, about 1,350 posts a second (an hour for 5,000,000): posts with their comments and votes, notes, pools, favorite groups, saved searches and tagger suggestions. admin bench --explain NAME prints the query plans of the matching searches, and --check fails if a search that should be selective reads more than half as many pages as the posts table has (CI runs that check on 200,000 posts).

How fast are pages?

Searches are only part of a page: it also loads the posts, their tags, comments and notes, and renders. moekura admin bench-http times whole responses from a running server, picking what to load from its database: the busiest posts (with comments, notes and a pool), common and rare tags, the biggest pools. Point it at a server using the seeded database:

export MOEKURA_SERVER__API_REQUESTS_PER_MINUTE=0   # no API rate limit
MOEKURA_DATABASE__URL=postgres://…/moekura_bench moekura serve &
MOEKURA_DATABASE__URL=postgres://…/moekura_bench moekura admin bench-http --url http://localhost:8080

Requests are anonymous, one at a time (--concurrency for more); a target with several posts or tags loads them in turn. --check-ms 100 fails if a p95 is above 100 ms, and any response other than 200 OK fails the run.

On the same 5,000,000 posts and machine, with the server (0.5.0’s image) and the benchmark on it too, p95 in milliseconds, for one request at a time and for 16:

PagePath116
front page/3.27.9
a common tag/posts?tags=red_red4.28.6
two common tags/posts?tags=red_red+blue_red3.98.7
rare tags/posts?tags=detailed_back_34.611
posts with 20–33 comments, notes and a pool/posts/675613.77
pools/pools/232.95.9
newest comments/comments59
tag list/tags0.72.8
API search, with a tag/api/v1/posts?tags=red_red3.310
API post/api/v1/posts/675610.82.5
Danbooru search, with a tag/posts.json?tags=red_red39.9
Danbooru post/posts/67561.json2.24.8
autocomplete (site, API, Danbooru)/tags/autocomplete?q=re1.83.1
feed, with a tag/posts.atom?tags=red_red3.68.5

Common tags come out faster than in the search table because counts that reach the count limit are reused for cache.count_ttl_secs (30 seconds); one visitor in that time pays for the count.

Tuning PostgreSQL

The defaults of a stock PostgreSQL are sized for a small machine. For a large site, start from:

shared_buffers = 25% of memory
effective_cache_size = 50–75% of memory
work_mem = 32MB
maintenance_work_mem = 1GB
random_page_cost = 1.1        # on SSDs

Your account

Settings

Settings, at the top of every page, holds how the site looks to you:

  • Posts per page, the theme and light or dark mode.
  • Blacklist: posts matching a line are left out of grids, with a count and a link to show them. Searches, popular posts, an artist’s posts and your feeds leave them out as part of the search, so every page is full and the counts don’t include them. Other grids (pools, favorite groups, comments, uploads) leave them out of what they show. Tick Blur blacklisted posts to keep them in grids, blurred, instead. The API leaves blacklists to clients.
  • Safe mode shows only general-rated posts, everywhere: searches, post pages, pools and the API.
  • Post pages show large images resized, saying so above them with a link to the original. Show original images always shows the original.
  • Include deleted posts in searches, for those allowed to see them.
  • Large thumbnails use the site’s second thumbnail size in grids.
  • Hide comments leaves comments off post pages, with a link to read them.
  • Suggest tags while typing and Keyboard shortcuts can be turned off.
  • Time zone is used for the dates pages show. Otherwise they’re in UTC.
  • Language, on sites with more than one, sets the language pages are shown in; otherwise your browser’s choice is followed.
  • Custom CSS is applied after the site’s styles, for you alone.
  • Email me my notifications (on sites that send mail, and once your address is confirmed) sends each notification to your email as well.

The rest of this page is under Settings → Your email address and password.

Profiles

Everyone’s profile, at /users/name, opens with their banner, profile picture, name, role and bio, and a few headline counts; below are their latest uploads and favorites (leaving out what your blacklist hides), each with a link to all of them.

To change yours, choose Edit profile on it, or Settings → Your profile picture, banner and bio:

  • The profile picture is cut to a square, and the banner to 3:1, keeping the part of the picture that looks most interesting. They’re stored at most 400 × 400 and 1500 × 500 pixels, without the file’s metadata. JPEG, PNG, GIF, WebP and AVIF pictures of up to 10 MB work; an animation keeps its first frame.
  • The bio, of up to 4000 characters, is formatted as comments are.

While banned you can’t change them. Staff who can rename someone can also clear their picture, banner or bio from their profile, under Clear profile; the moderation log keeps the bio removed.

The details beside the latest posts count what they’ve done, each count linking to the list or search behind it: uploads (and those since deleted), the score their uploads add up to, favorites and favorite groups, post, note, wiki and pool changes, comments, forum posts and feedback. Approvers’ profiles count the posts they approved; you and staff who approve posts also see your up- and downvotes, which are private otherwise.

Below them, a chart shows uploads in each of the last 12 months, and a list the tags used most on their latest 1000 uploads (leaving out meta tags), each linking to their uploads with that tag.

Notifications

Notifications, at the top of every page, lists what happened that concerns you, with a count of those you haven’t read. You’re notified when someone:

  • mentions you as @name in a comment, a forum post or a request’s discussion, or quotes you (a [quote] starting name said:, as Reply writes);
  • sends you a message;
  • posts in a forum topic you’ve posted in;
  • approves or rejects a request you made or voted on;
  • leaves feedback on your account.

You’re also told when staff act on what you posted, without saying who: your upload is rejected, deleted or restored; your appeal is granted or turned down; your comment or forum post is hidden or restored; or writing of yours held for review is let through or turned away.

Opening one marks it read and goes to what it’s about; Mark all read clears the count. Nobody you’ve blocked from messaging you can notify you either (staff’s notices still reach you). Read notifications are forgotten after 90 days.

Feedback

Staff and senior users (with Leave feedback on users of lower rank; contributors and up, by default) can leave positive, neutral or negative feedback on someone ranked below them, with Leave feedback on their profile. Profiles count it, linking to the whole list at /user_feedbacks?user=name; anyone can read it, and the person it’s about is notified. Its writer can edit it; writing and each change go in the moderation log, which keeps what it said before. Staff who can ban users can delete and restore it, which goes in the moderation log, if they outrank the person it’s about and, unless they wrote it, its writer; deleted feedback comes back only from whoever deleted it or someone ranked above them. Negative feedback from staff can keep a member from automatic promotion. Feedback can be reported to the staff who ban users, like anything else people write.

Your name

Settings → Your name changes the name you’re known and log in by, once every 7 days. Your profile lists your former names, and links to your old profile and searches such as user:oldname and ordfav:oldname keep finding you, unless someone else takes the name later. An inactive account’s old profile address leads nowhere, except for staff who manage users. You can’t change your name while banned. Staff who can ban users can rename anyone ranked below them, with Rename on their profile, at any time; that goes in the moderation log.

A name may not end in .json: addresses ending in .json, like /users/{id}.json, belong to the Danbooru API.

Email address and password

Changing either needs your current password. Changing the password logs you out everywhere else, and reset links already emailed stop working. Also revoke my API keys and feed token, ticked unless you untick it, revokes those too: do that if you think someone else got in.

An address is written plainly, as name@example.com, without a name in front or angle brackets. Mail isn’t sent to one saved in another form before that was required: it shows as not confirmed until you replace it with a plain one.

On sites that send mail, a new address only replaces the old one once you follow the link sent to it; so does the address given when signing up, unless the site has new accounts confirm theirs before they can log in. Asking for an address another account already has gets the same answer as any other, and that account is emailed about it instead, so nobody can use these forms to find out who has an account here. On sites without mail, the address changes straight away, so a taken one is refused.

Forgot your password? on the login page emails you a link to choose a new one. The link works for an hour, and only while that’s still your address. Using it logs you out everywhere, revokes your API keys and feed token, and unlinks any single sign-on account linked since you signed up, in case someone else had got in (link yours again afterwards). An account made through single sign-on keeps the one it was made with.

Logging in is limited, against password guessing: five tries at an account from one network (an IPv4 address, or an IPv6 /64), then one every 30 seconds; and ten at an account from all networks together, then one every 30 seconds. Someone guessing your password from their network doesn’t keep you from logging in from yours. While people guess it from many networks at once, you can still log in from a network you used the account from before (if the site keeps the addresses accounts use, as it does by default), and from anywhere by also solving a captcha (on sites with a captcha service).

Single sign-on

On sites set up for it, Log in with … on the login page logs you in through another service’s account. The first time, that makes you an account here (if the site is taking new ones).

To use it with an account you already have, log in with your password and choose Link under Single sign-on, confirming your password; finish at the provider in the same browser. (It can’t be done with an API key.) If your address is confirmed, you’re emailed when an account is linked. You can unlink it later, as long as you have a password to log in with instead. Accounts made through single sign-on have no password; to set one, use Forgot your password? if the site sends mail. They need one to link another account at the provider, too.

Two-factor login

With two-factor login on, logging in needs a code from an authenticator app (such as Aegis, 2FAS, Google Authenticator or 1Password) as well as your password, so a leaked password isn’t enough to get in.

  1. Open Two-factor login settings and choose Set it up.
  2. Scan the QR code with your app, or type in the key shown under it.
  3. Enter the code the app shows, to check it has the key.
  4. Save the ten recovery codes somewhere safe: each logs you in once if you lose your device. You can make new ones at any time, which replaces the old ones.

When logging in, enter a code from the app, or a recovery code, after your password (or after single sign-on). If your device’s clock is off by more than about half a minute, codes won’t work; most phones set the time automatically.

Wrong codes are counted until a right one, even across logins, since whoever types them already got past your password:

  • After 5 wrong codes in a row, you’re emailed about it (on sites that send mail, if your address is confirmed). If it wasn’t you, change your password.
  • After 10, codes from the app stop working for 15 minutes, and each further wrong code doubles that, up to a day. Recovery codes still work meanwhile, and logging in with one lifts the wait.

If you’ve lost both your device and your recovery codes, ask the staff: people who can manage users can turn two-factor login off for you (Admin → Users → Turn off 2FA), which is recorded in the moderation log.

API keys don’t need a code: keep them secret, and revoke any you no longer use. Making one asks for your password (or, on an account made through single sign-on, which has none, works only within 10 minutes of logging in), and a key can’t make more keys or change your login settings. A key may do everything you can, or only what you tick when making it: see the API.

Passkeys

A passkey logs you in with your device’s screen lock (your fingerprint, face or PIN) or a security key, instead of your password. The device keeps a private key that never leaves it; the site keeps only the public half, so there’s nothing to leak or guess.

To add one, open Settings → Your email address and password, and under Passkeys give it a name (such as “Phone”), confirm your password and choose Add a passkey; your browser then asks your device or security key to make it. That needs a browser that supports passkeys, with scripts on. You can have up to 20, say one for each device, and the list shows when each was added and last used. Rename changes a passkey’s name, and Remove, which asks for your password again, stops it working. Accounts made through single sign-on, which have no password, can add or remove passkeys within 10 minutes of logging in.

To log in with one, choose Log in with a passkey on the login page, or pick it from the suggestions under Name, in browsers that offer them. Since a passkey checks that it’s you at the device, it needs no two-factor code. With two-factor login on, you can also use one instead of the code after your password, with Use a passkey instead; your recovery codes still work if you lose the device. Logging in with a passkey counts towards the same limits as a password or code, and, like other logins, adds the address you logged in from to those the site keeps for your account.

Passkeys belong to the site’s domain: if the site moves to another one, they stop working, and you log in with your password and add them again. API keys, feed tokens and Danbooru clients work as before, without passkeys.

Saved searches

Save a search from its results (Save this search, beside the results), or under Settings → Saved searches, optionally with labels. Then search:all shows the newest posts of all your saved searches together, and search:artists those of the searches labelled artists; both combine with other tags and filters, like search:all rating:g. Each saved search adds up to its newest 500 posts, and a search: term runs at most 20 saved searches. Only you see your saved searches.

Favorite groups

Favorite groups are your own named lists of posts, in the order you choose: make one under Your favorite groups (linked from your profile) or from a post page, add posts from their pages, and reorder them by dragging on the group’s edit page. As with pools, only posts you can see go in, and not deleted ones. A group is public (listed on your profile, and anyone can open it) unless you untick Public. favgroup:name searches one of your groups, favgroup:7 any public group by number, and ordfavgroup:name shows a group in its own order.

Posts and files

Uploading

Uploading takes two steps, as on Danbooru:

  1. Upload (/uploads/new) takes up to 20 files at once, chosen, dropped anywhere on the page or pasted from the clipboard; choosing them sends them. Or give it a link: pasting one anywhere on the page sends it.
  2. Each file then has its own page, showing it with its size and type, the posts it looks like, posts from the same source, and the form that makes it a post: source (with what it says), rating, tags (with the related tags and the artist from the source), parent post, description and the artist’s commentary, original and translated. An upload of one file shows its form straight away; one of several lists them, each linking to its page, with ‹ prev and next › between them.

On the form, Ctrl+Enter posts, the tags box counts its tags, and the form can sit to the right of the file, to its left or below it (Form: left · right · below, or Shift+L, Shift+R and Shift+B), as wide as you drag the divider; both are remembered. Users whose posts needn’t be approved can still tick Upload for approval; those whose posts wait see how many more they may upload. Until you’ve posted ten, the form points to the rules, and the wiki page help:upload_notice, if there is one, is shown as the form’s help, open and marked Updated when it changed since your last post.

Under the file are a Download link, Copy ID (the file’s number, which Danbooru clients post it by), links searching SauceNAO, Ascii2D, Yandex, Google Lens, Bing and this site for the picture, and warnings, each linking to its wiki page and explained above the form:

  • No Source: the file was sent from disk; if you can, upload the link to where you found it instead (the badge searches SauceNAO for it).
  • Bad Source: the source is an image on a site whose image links don’t lead back to their page (X’s, say): use the page. The wiki page is bad_<site>_link when there is one (bad_twitter_link), else bad_link.
  • Image Sample: the file is a resized copy (a Pixiv img-master file, an X image without name=orig): upload the original. The wiki page is <site>_sample when there is one, else image_sample.
  • AI-Generated: the file’s metadata holds an image generator’s parameters (Stable Diffusion’s or NovelAI’s).
  • Pixel-Perfect Duplicate: posts have exactly the same pixels, though the file differs (re-encoded, or with its metadata removed); the badge links to the post, or a search of them. pixelhash:<md5> finds them too.

My uploads (/uploads) lists the files you uploaded, newest first, linking to their posts once posted, and can be narrowed to those still downloading, ready or failed, posted or not, of one file type, or from a source (its start; * matches anything). Users who can ban (moderators) can list anyone’s (Uploader, blank for everyone’s) and look at their files, but only the uploader can post them. Files not posted within a day are removed, and you can have at most 250 waiting to be posted (files that failed in the last hour count too). Without scripts, choose the files and press Upload.

A zip of pictures is unpacked into its files, in the order people sort their names (2.jpg before 10.jpg): at most 100, each within the upload size limit, none outside the archive (/… or ..); folders, hidden files and macOS’s __MACOSX are left out. A zip with Pixiv’s frame data, or only frames numbered as Pixiv numbers them (000000.jpg), is an ugoira instead.

Uploading a file that’s already a post takes you to that post.

Scripts can still send a whole post in one form to POST /upload (file or url, rating, tags, source, parent, description, commentary_title and commentary_description), which is also what the API does.

Duplicates and look-alikes

A file that’s already a post isn’t kept: its page says so, with a link to that post. When it’s a post you can’t see (someone else’s that was deleted or waits for approval), it’s only refused, without saying which.

A file that only looks like posts already on the site (the same picture resized, recompressed or slightly edited, by perceptual hash) shows those posts above its form. If yours is something else (another version, an edit, the next page), press Post anyway, perhaps making it a child or parent of the one it resembles. Each says how alike it is; less alike posts (75–94%) are behind Show N low similarity matches. Only posts you can see and haven’t blacklisted are shown, and posts whose files are still being processed aren’t found yet.

Related posts lists posts already here from the same source (the work’s page, or its files’ links), with a link searching for all of them.

…or a link on the upload form downloads files from the web. Give it the file itself, or a work’s page on one of the sites Moekura knows: Pixiv, X, Bluesky, DeviantArt, other boorus, Misskey and some ninety more.

Moekura asks the site for the work’s best (original) files and downloads them, every page of a work of several, each file once. A work of more than 20 files asks first: tick Download all N files and upload it again to take them all (up to 100). Together they may come to 20 times the upload size limit, counting what downloads that failed received; files past that fail. The upload’s page shows as soon as the first is ready (with scripts, the post form follows the moment it is). Each post’s source is the file’s own link when that names its work (Pixiv’s i.pximg.net/…_p3.png, so the post says which of the work’s images it is), else the work’s page. They download in the background, a few at a time for the whole site and two at a time of each user’s (the rest wait their turn): the upload’s page follows them, and a file that can’t be downloaded says why. Any other page whose preview tags (OpenGraph) name an image works the same way. What the site says is used as well, and shown under the source field: the site, the artist and their profiles, the site’s tags, and when the work was published and last changed. Fetch source data reads the source again, after you change it or when the site has changed (the same source is read again only for users whose uploads skip the approval queue; see Lookups).

  • The artist: the tag of the artist whose artist entry lists their profile there is put in the tags box; an artist without one gets a link to start it (Create new artist), filled in with their name and profiles.
  • Tags: the Related tags panel’s From Pixiv (or the site’s name) group lists the site’s tags as this site’s: tags whose wiki pages list one as an other name, and tags named like one or its English translation.
  • Commentary: the work’s title and description fill in the artist’s commentary fields, and become the post’s commentary if the fields are left empty.

The same happens with files sent with such a link, which becomes their source (if it’s a web link, http or https), and for uploads through the APIs (which download only the work’s first file). When a site can’t be reached or has changed, the link is downloaded as it is, without extras.

Links must lead to the public internet: nothing is fetched from loopback, private, link-local or other special-purpose addresses (for IPv6, anything outside global unicast 2000::/3 or in its reserved blocks), whether the link names one, its name resolves to one or a redirect leads there.

The bookmarklet

Bookmarklet (/uploads/bookmarklet) has a Post to … link to drag to the bookmarks toolbar, and lists the sites whose works are read. Clicking it on a work’s page opens the upload page with the page’s link (/uploads/new?token=…&url=…&ref=…), which sends it straight away; going back skips the upload page. token is a key of your own, so take the bookmarklet while logged in, and don’t share it: without it, as in a link to the upload page from another site, the link only fills in the form, and waits for you to press Upload. The sites you use the bookmarklet on can see the key as well. Make a new key on the bookmarklet page replaces it (yours only), if you doubt one of them; bookmarklets taken before then only fill in the form, so take it again. ref is the page you came from: when the link is a bare image, the work is read from that page if it’s on the same site or shows the image. It’s kept as the upload’s referer_url (also in the Danbooru API’s upload[referer_url]).

Ugoira

Pixiv’s animations (ugoira) are a zip of JPEG or PNG frames. Upload the zip like any file, or link to the work on Pixiv, which downloads the zip and keeps each frame’s time in it. A zip you upload yourself can say how long each frame shows in an animation.json beside the frames, in Pixiv’s form:

{"frames": [{"file": "000000.jpg", "delay": 100}, {"file": "000001.jpg", "delay": 80}]}

Without one, every frame shows for a tenth of a second. Once it’s processed, the post plays the animation as a video made from its frames (a WebM), and Download the frames gets the zip. filetype:ugoira (or filetype:zip) finds them, and the Danbooru API gives the video as the post’s large file.

Replacing a post’s file

Staff with Replace posts’ files (moderators and admins, by default) can swap a post’s file for a better one: a higher resolution, an uncropped version, a fixed scan. Replace the file, below the picture, takes a file or a link, a reason, and whether to move and resize the notes to the new size (on by default). The post keeps its id, tags, comments, notes, pools and favourites; its thumbnails and metadata are made again from the new file, and the file can’t be one another post already has.

Replacements, under the picture, lists a post’s replacements: when, by whom and why, and the file before (still downloadable, until the post is purged) and after. Replacements are recorded in the moderation log, and Danbooru clients can read them at /post_replacements.json.

When the point of replacing was to take something out of the file (a location in its metadata, say), the earlier file shouldn’t stay up: tick Remove the old file for good when replacing, or use Remove this file on the replacements list later. The file is deleted from storage (unless another post has the very same file), the list says who removed it and when, and the removal is logged.

Thumbnails

Grids show each post’s whole picture, scaled to fit, as on Danbooru. A coloured border says what to know about the post:

BorderMeans
bluepending approval
redflagged
black (white in dark mode)deleted
greenhas children
yellowhas a parent

When several apply, the family’s colour takes the top and left edges and the status’s the right and bottom; a post with both children and a parent has green on the top and left and yellow on the right and bottom. Videos and animations show their length in the corner, with a speaker when they have sound.

File metadata

When a file is processed, its metadata is read and kept: the image’s make-up (colour components, bit depth, colour space, frames), EXIF (the camera, the software, comments), XMP (title, creator tool, keywords), PNG text chunks, and for videos the container and each stream (codec, frame rate, bit rate, audio channels). Metadata, under the picture on a post’s page, lists it by group, with names like exiftool’s: EXIF:Make, PNG:Software, File:ColorComponents.

Where a photo was taken and whose camera took it stay private: GPS and other location fields, serial numbers and owners’ names are never read into it. Thumbnails and samples never carry metadata. By default it’s also taken out of JPEG, PNG and WebP originals, below; files of other types are kept as they were uploaded, so Download original still has whatever they contained.

Removing metadata from originals

With strip_metadata in [media] set to "strip" (the default) or "require", metadata is taken out of uploaded originals before they’re stored:

TypeWhat’s removedWhat stays
JPEGEXIF (GPS, camera, dates…), XMP, IPTC and other Photoshop data, comments, other application segments, and anything after the picture (extra images some phones append)JFIF, colour profiles (ICC), Adobe’s colour transform
PNGtext (tEXt, zTXt, iTXt, which hold XMP), eXIf, tIME, private chunks, anything after the endtransparency, colour profiles and colour space, gamma, pixel density, animation (APNG)
WebPEXIF, XMP and unknown chunkscolour profiles, transparency, animation

The picture itself isn’t re-encoded: its compressed data is copied byte for byte, so it looks exactly the same and loses no quality. A picture that’s turned by its EXIF orientation keeps the orientation, in an EXIF block holding nothing else. Other types (GIF, AVIF, JPEG XL, videos, ugoira) aren’t changed by "strip", and are refused by "require" with a message saying so. "off" keeps every original exactly as uploaded, metadata and all.

Removing metadata changes the file’s bytes, so its SHA-256 and MD5 are those of the stored, cleaned file, as is its storage name. Duplicates are still found: an upload is a duplicate if either the file as sent or the file as cleaned is already a post, so uploading the same photo again, or downloading the original and uploading it, finds the post. This holds for uploads, links, imports, the APIs and replacements alike. Lookups by the MD5 of the file as it was elsewhere (Danbooru apps checking whether a file is here, import-remote’s check) don’t match a cleaned file; the file is then downloaded and recognised as a duplicate when it’s cleaned. Posts uploaded before the setting was turned on keep their originals as they are. The metadata shown on post pages is read from the stored original, so it only lists what’s left.

Posts uploaded before metadata was read get it when their files are processed again: moekura admin regenerate-media --all.

Sites

Moekura knows the sites Danbooru supports (listed below): wherever a link to one appears (a post’s source, an artist’s URLs), it shows the site’s icon and name, and it can tell a work’s page from an artist’s profile and a file.

Uploading from a link to a work on one of these sites reads the work for its files (the originals, not the samples a page shows), the artist and their profiles, the site’s tags and the artist’s commentary. A link to one of the work’s files, even a thumbnail, downloads the file at its best and makes the work’s page the post’s source. Short links (t.co, b23.tv, pin.it and the like) are followed to the page they lead to.

When a site has changed, refuses the server or wants a login it doesn’t have, Moekura falls back to the page’s preview (OpenGraph) image, read without a login, when that image is a file on a site it knows, and otherwise downloads the link as it is.

Google’s and Kakao’s image servers (behind YouTube, Blogger, Tistory and others), Skland and TikTok are only recognised: their files are downloaded at full size, and their pages’ preview images are read.

Lookups

What a link gives is kept for ten minutes, so the upload form, the artist finder and the related tags panel asking about the same link again don’t ask the site again. Fetch source data on the post form reads the site again only for users whose uploads skip the approval queue; others see what was found.

Every lookup that asks another server counts against an allowance, per account (or, for visitors, per address): about ten at once, then one more every six seconds. Past it, the artist finder answers Too many requests, and the related tags and the post form’s source panel go without what the site says for a moment. The server reads at most 16 links at a time, and gives up on one after 20 seconds. Of what a page says, only so much is kept: up to 200 files and tags, and a title and description as long as an artist’s commentary can be.

Artist URLs

An artist entry’s URLs on these sites are kept in their canonical form (artstation.com/artist/someone becomes https://www.artstation.com/someone), and finding an artist by URL also tries the profile a work’s page belongs to, so https://someone.deviantart.com/art/a-cat-123 finds the artist with https://www.deviantart.com/someone.

Logins

Some sites only show some works (or anything at all) to members. Give Moekura an account’s cookies, API key or token in the configuration, by domain; requests to that domain and its subdomains carry them, over https only. Only the requests Moekura makes to read a work carry them: the work’s own page (the one a link to it gives back, not one a crafted id or query value leads to) and the site’s API, once it has checked the ids it puts in it. A page read for its preview image goes without. A request carrying a login follows redirects only to the sites the same login is for, and a link whose path hides separators or .. (such as %2F or %5C) isn’t read at all, so a crafted link can’t send the login elsewhere or to another page of the site:

[sources.logins."pixiv.net"]
cookie = "PHPSESSID=…"

[sources.logins."gelbooru.com"]
query = { user_id = "…", api_key = "…" }

[sources.logins."baraag.net"]
headers = { Authorization = "Bearer …" }

Use an account made for this: anyone with access to the configuration can act as it.

X

X shows age-restricted posts only to logged-in accounts, and little at all to servers. Moekura reads posts on X:

  1. through the API of an FxEmbed instance, which needs no account here and sees age-restricted posts too. It’s https://api.fxtwitter.com unless [sources.x] names another (such as https://api.fxtwitter.com, or your own):

    [sources.x]
    fxembed_api_url = "https://api.fxtwitter.com"
    

    Set it to "" to not use one;

  2. then, if that fails and there’s a login for x.com, from X itself as that account. It needs the auth_token and ct0 cookies, and the account must be allowed to see sensitive media (in X’s settings):

    [sources.logins."x.com"]
    cookie = "auth_token=…; ct0=…"
    

    X changes how its API is asked from time to time, which can break this, and suspends accounts it finds reading it automatically. So the login is only used for members who can upload (not for visitors using the artist finder or the related tags), not when FxEmbed said there’s no such post, and for at most 30 links every 15 minutes on each web server;

  3. last, through the API X’s own embedded posts use, which only sees public posts that aren’t age-restricted.

When none of them gives the post, the upload is refused, saying it may not exist, may be hidden or may be age-restricted; the server’s log says what each answered.

Every site

Boorus

SiteNotes
Danbooruthe post’s own source fills in the artist and commentary, as on every booru
e621
Gelbooruits API wants a login: query = { user_id = "…", api_key = "…" } (without one, the page’s preview image)
Konachan
Rule34.us
Rule34.xxxits API wants a login: query = { user_id = "…", api_key = "…" }
Safebooru
TBIB
Yande.re
Zerochanthe z_id and z_hash cookies help

Pixiv’s sites

SiteNotes
Pixivsome works only show to members: the PHPSESSID cookie
Pixiv Comic
Pixiv Factory
Pixiv Sketch
pixivFANBOXposts for supporters have no files for visitors
Booth

Misskey, Mastodon and Bluesky

SiteNotes
Misskeyany Misskey instance, for its /notes/<id> links
Misskey.io
Misskey.art
Misskey.design
Pawoosome statuses need an access token: headers = { Authorization = "Bearer …" }
Baraagsome statuses need an access token: headers = { Authorization = "Bearer …" }
Bluesky

Other sites

SiteNotes
4chan
Adobe Portfolio
Apple Music
Arca.live
Artistree
ArtStation
ArtStreetmature works need the MSID cookie
Behanceoften refuses servers; the iat0 cookie helps
Bilibili
Blogger
Carrd
Ci-Enarticles for supporters need the ci_en_session cookie
DC Inside
DeviantArt
Dotpict
Fandom
Fantianeeds the _session_id cookie
FC2
Foriio
Furaffinitymature works need the a and b cookies
Galleria
Grafolio
Gumroad
Hentai Foundry
Huajia
Huashijieneeds your userId and token: query = { userId = "…", token = "…" } for app.huashijie.art
Imgur
Inkbunnymembers-only works need a session id: query = { sid = "…" }
Itaku
Ko-fi
Lofter
Mihuashi
Minitokyo
Miyoushe
Naver Blog
Naver Cafe
Newgroundsmature works need the ng_remember cookie
Nico Seiganeeds the user_session cookie
Nijieneeds the NIJIEIJIEID and nijie_tok cookies
Note
Odaibako
OpenSea
Patreonposts for patrons need the session_id cookie
Piapro.jpthe illustration as shown; downloads need the piapro_s cookie
Pinterest
Plurk
Poipikumost posts need the POIPIKU_LK cookie
Postypepaid and adult posts need the PSE3 cookie
Privatter
Redditoften refuses servers; the reddit_session cookie helps
Redgifs
Skeb
Tinamioriginals need the Tinami2SESSID cookie
Tistory
Toyhouse
Tumblran API key reads more: query = { api_key = "…" } for api.tumblr.com
Vk
Weiboread as a visitor
Xread through an FxEmbed instance; see X
Xfolioneeds the xfolio_session cookie
Xiaohongshuneeds the webId, web_session and gid cookies
Yachiyo’s Room
Youtube

Search syntax

Type tags and filters into the search box, separated by spaces. Tags are case-insensitive, and spaces inside a tag are written as underscores (long_hair).

Tags

You typeFinds posts that…
cathave the tag cat
cat cutehave both tags
cat -doghave cat but not dog
~cat ~doghave cat, dog or both
long_*have any tag starting with long_
*_hairhave any tag ending in _hair
-*_hairhave no tag ending in _hair

The ~ terms form one group: a ~b ~c means a, plus at least one of b and c. A wildcard stands for the (up to 100) most used tags it matches.

Searches follow tag aliases: if kitty is aliased to cat, searching for kitty finds posts tagged cat. Category prefixes are ignored, so artist:someone searches for someone.

Groups and or

Parentheses group terms, and or between two terms or groups means either of them. Filters work inside groups too.

You typeFinds posts that…
(cat or dog) -rating:ehave cat or dog, and aren’t explicit
(cat cute) or (dog rating:g)have cat and cute, or are general and have dog
-(cat dog)don’t have both cat and dog
cat (user:alice or score:>10)have cat, and were uploaded by alice or score above 10

Terms side by side bind tighter than or, so a b or c means (a b) or c. ~ is shorthand for or: ~a ~b is (a or b), and inside a group the ~ terms form an or of that group. Groups can be nested up to 10 deep, and every tag and filter in them counts towards the site’s limit on terms. Whatever that limit, a search can be at most 1000 words and 10,000 characters long.

A ( at the start of a word opens a group, and a ) at the end of a word closes one, unless it belongs to the tag: (ganyu_(genshin_impact) or klee_(genshin_impact)) works as expected. To search for a tag that starts with (, put a category in front of it (general:(tag)). order:, limit:, ordfav: and the other orders apply to the whole search, so they can’t go inside a group or next to or.

Filters

Filters look like name:value. Put - in front of one to exclude what it matches (-rating:e); order: and limit: can’t be excluded.

FilterExampleMeaning
rating:rating:e,qrating general, sensitive, questionable or explicit (letters or names, comma-separated)
score:score:>=10score
favcount:favcount:>5number of favourites
commentcount:, comment_count:commentcount:>0number of comments
notecount:, note_count:notecount:>0number of notes
note:note:good_morningnotes contain these words (underscores for spaces)
id:id:1000..2000post number
user:user:aliceuploaded by this user
fav:fav:alicefavorited by this user
approver:approver:alice, approver:any, approver:noneapproved by this user, by anyone, or by no one (posts that never waited for approval)
commenter:commenter:alicehas a comment by this user
comment:comment:nice_artcomments contain these words (underscores for spaces)
commentary:commentary:true, commentary:untranslated, commentary:new_workhas artist’s commentary (true), none (false), a translation (translated), an original without one (untranslated), or commentary containing these words
exif:exif:file:colorcomponents=1, exif:exif:model=canon_eos, exif:png:parametersthe file’s metadata has this field (group:tag), with this value if =value is given; regardless of case, underscores for spaces. Every field on a post’s Metadata page links to its search
pixiv:, pixiv_id:pixiv:123456, pixiv:any, pixiv:none, pixiv_id:>1000the source is this Pixiv work (a number or a range like other numbers), any Pixiv work, or none; works’ pages and their files on i.pximg.net both count
embedded:embedded:truethe post’s notes are drawn on the picture (see Notes), or not
noter:noter:alicehas a note this user wrote or edited
upvote:, downvote:upvote:alicevoted up / down by this user; votes are private, so only staff who review posts may search for others’ votes, everyone else only for their own
flagger:flagger:aliceflagged by this user; only staff who review posts may search for others’ flags, everyone else only for their own
search:search:all, search:artiststhe newest posts (500 each) of your saved searches, all or those with a label
favgroup:favgroup:best, favgroup:7, favgroup:any, favgroup:nonein one of your favorite groups (by name), or any public group (by number); in any or none of your groups
pool:pool:my_comic, pool:12, pool:any, pool:nonein this pool (by name or number), in any pool, or in none
width:, height:width:>=1920size in pixels
mpixels:mpixels:>2megapixels (width × height ÷ 1,000,000)
ratio:ratio:16:9, ratio:<1width ÷ height (16:9 or a number; exact values match within 0.01)
filesize:filesize:>2mbfile size, in bytes or with kb, mb, gb (an exact size with a unit matches within 5%)
duration:duration:>30length of a video, in seconds
filetype:filetype:png,webmfile type: jpg, png, gif, webp, avif, jxl, mp4, webm, ugoira (or zip)
date:date:2026-01upload date (UTC): a day, month or year
source:source:https://twitter.com/foo, source:*pixiv.net*, source:none, source:anythe source starts with this, or matches a pattern with *, regardless of case; or posts without / with a source
age:age:<1w, age:2d..1mouploaded this long ago: <1w is less than a week ago; units s, mi, h, d, w, mo (30 days; m works too) and y
updated:updated:<1d, updated:2026-01last changed (tags, rating, source, status, …) this long ago, or on these days
md5:md5:d41d8cd9…the file’s MD5 hash
pixelhash:pixelhash:9e107d9d…the MD5 of the image’s decoded pixels: the same picture in any file
similar:similar:123looks like post 123 (the post included), if you can see it; found once files are processed
parent:parent:123, parent:none, parent:anya post and its children, posts without a parent, or posts with one
child:child:any, child:noneposts with children (that aren’t deleted), or without
tagcount:tagcount:<5number of tags
<category>tags:arttags:0, gentags:>20number of tags in a category: the category’s name followed by tags (artisttags:, charactertags:), or Danbooru’s gentags:, arttags:, copytags:, chartags: and metatags:; arttags:0 finds posts missing an artist
ai:ai:long_hairthe tagger suggests this tag, and the post doesn’t have it yet
status:status:deletedpending, active, flagged, deleted, modqueue, unmoderated, appealed or any (see below)

is: and has: are shorthands for other filters, as on Danbooru:

ShorthandSame as
is:parent, has:childrenchild:any
is:child, has:parentparent:any
is:sfw, is:nsfwrating:g,s, rating:q,e
is:general, is:explicit, …rating:g, rating:e, …
is:pending, is:deleted, …status:pending, status:deleted, …
has:sourcesource:any
has:poolspool:any
has:notes, has:commentsnotecount:>0, commentcount:>0

Numbers (and sizes and dates) can be compared:

FormMeaning
5exactly 5
>5, >=5, <5, <=5more / at least / less / at most
5..10from 5 to 10, both included
5.., ..10at least 5 / at most 10
1,2,3any of these

Dates take the same forms: date:2026-01-31, date:>=2026-01, date:2025..2026 (all of 2025 and 2026).

A site can limit the ratings logged-out visitors see (Admin → Settings → Ratings visitors see). Their searches, post pages, feeds and API results then leave out other ratings, whatever the search asks for.

Statuses

Searches show active and flagged posts, plus your own uploads that are waiting for approval. Staff who review uploads also see pending posts. Deleted posts only appear with status:deleted or status:any (or with a status: inside a group, such as (status:deleted or rating:e)), and only to those allowed to see them. They see how many deleted posts a search left out, with a link to include them, or can include them in every search with Include deleted posts in searches in their settings. For staff who review uploads, status:unmoderated finds the pending posts left for them: ones they didn’t upload and haven’t disapproved; status:appealed finds deleted posts with an open appeal. status:modqueue finds everything waiting for a moderator: pending and flagged posts.

When nothing is found

If a search finds nothing, tags in it that match no posts get suggestions: the tag a retired alias pointed to, or used tags spelled almost the same (long_hiar → long_hair). Each links to the same search with the tag swapped. Excluded tags, wildcards and filters get none.

Order and page size

FilterOrder
order:id (default), order:id_ascnewest / oldest first (order:created_at works too)
order:score, order:score_aschighest / lowest score
order:favcount, order:favcount_ascmost / fewest favourites
order:mpixels, order:mpixels_asclargest / smallest image
order:filesize, order:filesize_asclargest / smallest file
order:landscape, order:portraitwidest / tallest first
order:duration, order:duration_asclongest / shortest video
order:tagcount, order:tagcount_ascmost / fewest tags
order:arttags, order:gentags_asc, …most / fewest tags in a category
order:comment, order:comment_ascmost / least recently commented (only posts with comments)
order:note, order:note_ascmost / least recently noted (only posts with notes)
order:change, order:change_ascmost / least recently changed, e.g. to follow recent tag edits (order:updated works too)
order:rankhot posts: from the last two days with a positive score, highest score first, discounted by age
order:upvotes, order:downvotes (and _asc)most / fewest up or down votes
order:comment_bumped, order:comment_bumped_asclike order:comment, leaving out comments posted with Don’t bump the post
order:comment_count, order:note_count (and _asc; commentcount and notecount work too)most / fewest comments or notes
order:customin the order of the search’s id: list: id:3,1,2 order:custom
order:md5, order:md5_ascby the file’s MD5, for a stable order that isn’t upload order
order:randomshuffled
ordfav:alicealice’s favorites, most recently favorited first
ordpool:my_comicthe pool’s posts, in the pool’s order
ordfavgroup:bestthe favorite group’s posts, in its order

limit:100 shows more posts per page (up to the site’s maximum, 200 by default).

Pages

Results have numbered pages up to page 1000 (configurable). Sorted by id, “next” links keep working beyond that; they use page=b<id> (posts before that id) and page=a<id> (after), which are as fast on page 50,000 as on page 2.

Counts are exact up to 10,000 posts. Above that, a single tag shows its known post count, and other searches show “10,000+”.

Searching by image

Search by image (/iqdb_queries, linked from Popular and as Look-alikes under every post) takes a picture, a link to one (a work’s page on a site Moekura reads works too), or a post, and lists the posts that look most like it, with how alike they are, without uploading anything. Matches are found by the same perceptual hash as similar:, so a resized or recompressed copy is found, but a crop or an edit may not be. A video searches by its poster frame; zips, ugoira included, can’t be searched with (search with the ugoira’s post instead). Each search compares the picture with every post, so they’re limited to a few a minute, counted before a link is looked up. A linked picture may be up to 20 MB (or the upload limit, if that’s lower). The API has it as POST /api/v1/posts/similar, and Danbooru clients as /iqdb_queries.json.

Popular in the menu shows what’s going on, for a day, a week (the seven days ending on the date) or a month, with links to earlier and later ones:

  • Popular: the best-scored posts posted then.
  • Most viewed: the posts whose pages were looked at most.
  • Searches: the tag searches that found posts most often. Searches naming a tag the site doesn’t have (or with a * pattern among the tags they exclude or make optional) aren’t among them, even when their other tags found posts.
  • Missed searches: tag searches that found nothing, most often because of a misspelling or a name the site calls something else; an alias can send them to the right tag.

Each person counts once a day per post or search (visitors without an account by their address, or their IPv6 /64); crawlers and link previews don’t count. Only searches of plain tags are counted (and only their first page): searches with metatags such as fav: or user:, which may name people, are left out. A person adds at most ten missed searches a day, and each web server counts at most 2,000 different ones a day. Counts are kept for about a year.

Feeds

Every search has an Atom feed of its newest posts: the Feed link beside the results, or /posts.atom?tags=cat+-dog. Add it to a feed reader to follow new posts of a tag, an artist (user:alice for a user’s uploads), or anything else you can search for. /comments.atom follows the newest comments.

Feeds may be kept for five minutes. A proxy or CDN in front of the site may keep only those read by visitors who aren’t logged in: a feed read while logged in, or with a token, is marked private, since it shows what that user may see.

On a private site, feed readers can’t log in; make a feed token under Settings → API keys and feeds (which asks for your password, as making an API key does) and add &token=… to the feed’s address. The token reads feeds as you (with your blacklist and safe mode) and does nothing else; making a new one or revoking it stops the old one working, and so does resetting your password. Since the token sits in a feed reader, it never shows more than a member sees, whatever your role: no pending or deleted posts but your own pending uploads, and no banned artists’ posts if those are hidden.

Tags

Tags describe what’s in a post. They’re lower case, with underscores instead of spaces (long_hair), and belong to a category:

CategoryFor
generalwhat’s in the picture
artistwho made it
copyrightthe series or franchise
characterwho’s in it
metathings about the file, such as animated or translated

Sites can relabel and reorder these and add their own (see Tag categories).

When you tag a post, write a new tag with a prefix to put it in a category: artist:someone. A tag already on posts keeps its category, unless you can manage tags; then the prefix moves it, as does editing it in the tag list.

Each tag can have a wiki page describing it.

Metatags in the tag box

The tags box on the edit and upload forms takes more than tags, as on Danbooru. -tag takes a tag off, and these metatags change other things:

MetatagDoes
rating:g, s, q, e (or the full name)sets the rating
source:https://…, source:nonesets or clears the source
parent:123, parent:none or -parentsets or clears the parent (a post you can see, as in the form’s parent field); -parent:123 clears it only if it’s 123
child:123, -child:123makes post 123 a child of this one, or stops it being one
pool:12, pool:name, -pool:12adds the post to the end of a pool, or takes it out
newpool:namestarts a pool with the post (or adds it to the pool of that name)
fav, -favfavorites the post, or stops favoriting it
favgroup:12, favgroup:name, -favgroup:12adds the post to one of your favorite groups, or takes it out
upvote, downvotevotes on the post (not your own upload)

Each needs the permission it would need done by hand (editing pools to use pool:, favoriting to use fav, …), and is recorded where that would be: parents in the posts’ history, pools in the pool’s. A metatag you can’t use, or one naming something that doesn’t exist, stops the save with the reason. Metatags in the box win over the form’s own rating, source and parent fields. They also work in tag scripts and the APIs’ tag fields; in a mass edit, only -tag and rating: do.

A post can have at most 1000 tags, and a tag box at most 4000 words and 256 KiB, with tags, -tags and metatags together.

Warnings after saving

After an upload or an edit, the post page lists what may be missing, without stopping the save: no artist, copyright or character tag, fewer than 10 general tags, tags no other post has yet (often a typo), and a category prefix that couldn’t move an existing tag (artist:cat when cat is already a general tag; only those who manage tags can move used tags).

Sites can also have request tags added by themselves (Admin → Settings, off by default): artist_request while a post has no artist tag and tagme while it has fewer than 10 general tags. They come off again when an edit fixes that.

Automatic tags

Sites can also tag posts from their files and sources, as Danbooru does (Admin → Settings → Automatic tags, off by default). Every upload and edit gets, or loses, these:

TagWhen
lowresat most 500×500
highres, absurdres, incredibly_absurdresat least 1600×1200, 3200×2400, or 10000 either way
wide_image, tall_imageat least 1024 long and four times as long as the other side
animated, animated_gif, animated_png, video, ugoirawhat kind of media it is
soundit has an audio track
exif_rotationits EXIF orientation turns it
non-repeating_animationan animation that plays a few times, then stops
non-web_sourcethe source isn’t a web address
bad_linkthe source is an image whose site can’t lead back to its page
bad_sourcethe source is a link on a known site that’s neither a work nor an image
tagmethe post has no tags; removed at 30 (with request tags on, those decide)
greyscale, ai-generatedthe file is stored in greyscale, or its metadata says an image generator made it

Tags that follow from the file can’t be added or removed by hand: typing highres on a small image doesn’t stick. greyscale and ai-generated can still be added by hand, since a picture can be either without its file saying so. bad_link and bad_source are left alone for sites Moekura doesn’t know. Each rule’s tag can be renamed to fit the site’s, or left empty to leave the rule out.

Beside the tags box of the upload and edit forms, a panel lists tags to consider, updated as you type: tags often used with those in the box (or with the tag under the cursor), your recent and most frequent tags, the site’s tags for words in the box that are a wiki page’s other names (paste 長い髪 and it offers long_hair), the links on the wiki page of the tag under the cursor, and, when the link or source is a work on a site Moekura can read, the artist and the site’s tags in this site’s terms (see Uploading from a link). Click a tag to add it, or to take it out if it’s already in the box. Without scripts, Related tags opens the same lists on a page of their own (/tags/related).

A post’s Edit form lists its parent and children under Copy tags. Click one to add that post’s tags to the tags box, then change what doesn’t fit and save (without scripts, the click adds them and saves at once).

Suggestions from the tagger

On sites that run the tagger, a model looks at each new upload, usually within a minute, and suggests tags and a rating. They show under Edit on the post, most confident first, with how sure the model is: click one to add it to the tags box (or, without scripts, to add it and save), then save. Tags the post already has aren’t suggested, nor tags below the confidence the site asks for in their category.

They also show on an upload’s post form once the model has looked at the file, usually within a minute: the form fills them in when they arrive (without scripts, Check again looks), and you can post before they do. Clicking one adds it to the form; tags already in the tags box aren’t offered. The post is tagged again once made, as any upload is.

The model is often right about what’s in a picture and sometimes confidently wrong, so check before saving. Search for ai:tag to find posts where a tag is suggested but not yet applied, for tidying up many posts at once.

Sites can also have the tagger apply the suggestions it is surest of by itself. Those edits appear in the post’s history as the tagger’s account (normally tagger), and are undone like anyone’s.

Aliases and implications

An alias makes one tag stand for another: with kitty aliased to cat, posts tagged kitty are tagged cat instead, and searching for kitty finds them.

An implication adds a tag: with cat implying animal, every post tagged cat is also tagged animal.

Anyone who can edit posts can request them under Tags → Aliases and Implications; people who can manage tags approve them. You can withdraw your own request while it’s pending; after that, only they can end it. Once approved, they’re applied to existing posts in the background, and to every edit after. Each post’s history shows which changes came from an alias or implication.

Requests waiting for a decision, these and bulk update requests alike, are rate limited: a few at once, then one a minute.

Voting and discussion

Each request has its own page (click its status or score in the list): members vote for or against it while it’s pending, and discuss it underneath. Votes help staff decide; they don’t decide by themselves.

Bulk update requests

Tags → Requests holds requests for several changes at once, decided together. A request has a title, a reason, and a script with one change a line:

LineDoes
alias kitty -> cataliases kitty to cat
imply cat -> animalmakes cat imply animal
unalias kitty -> cat, unimply cat -> animalends an alias or implication
update cat_ears solo -> animal_ears -cat_earsa mass edit: the posts a search finds get the tags after the arrow, and lose those with -
category someone -> artistmoves a tag to a category

Lines starting with # are ignored. Mistakes are pointed out, by line, when you send the request. Members vote and discuss as for single requests; staff who manage tags approve (which applies the lines in order, in the background) or reject it, and you can withdraw your own while it’s pending. A request with update lines is approved only by staff who can also mass edit tags, and not by whoever requested it. If a line can’t be applied (say, it would make an implication loop), the request stops there, marked failed with the reason; the lines before it stay applied.

History

Tags → History lists every change to tags: when each was created and who changed its category or deprecation, newest first, with the old and new values. Filter it by tag or by user; a tag’s edit page links to its own history.

Deprecated tags

A deprecated tag can’t be added to posts any more, not even by reverting a post to a version that had it, but stays on the posts that already have it until someone takes it off.

Tag scripts

To tag many posts quickly, those who can edit posts choose Tag script in the On click menu above search results, then type a script in the box that appears beside it. Clicking a post then applies the script to it instead of opening it, until the menu goes back to View the post (the choice and the script are kept while you move between pages): tag adds a tag, -tag removes one, and rating:s sets the rating, so cat_ears -cat rating:g does all three; the other metatags (pool:12, fav, …) work too. Changed posts are outlined green, refused ones red with the reason below the script. Each change is in the post’s history as if you had edited it.

The wiki

Every tag can have a wiki page explaining what it’s for and how to use it. Find them under Tags → Wiki, or with the ? next to a tag in search results and on post pages. Searching for a single tag shows the first paragraph of its page above the results.

A page’s title is the tag’s name, so Long Hair and long_hair are the same page, and a page can exist before any post has the tag. The page of an aliased tag points to the tag it’s aliased to.

Anyone with the Edit the wiki and artists permission (members, by default) can start or change a page. Every change is kept: History lists them, and you can view any old version or revert to it. If someone else saves the page while you’re editing it, you’re told instead of overwriting their change, and your text is kept so you can save again. Recent changes on the wiki’s index (/wiki_page_versions) lists the changes to every page, newest first, and can be filtered by user.

Other names

A page can list the tag’s other names: what it’s called elsewhere, such as its Japanese name, a romanisation or a pixiv tag. Write them separated by spaces, with underscores for spaces within a name (長い髪 long_locks). They’re shown under the title and kept in the page’s history, and the wiki’s search finds pages by them as well as by title, so a tag can be found by what other sites call it.

Formatting

WriteFor
A blank lineA new paragraph
h2. Heading (h1. to h6.)A heading, at the start of a line
* item, ** nested itemA list
[b]bold[/b], [i]italic[/i], [s]struck[/s], [u]underlined[/u]Styles
[[long_hair]], [[long_hair|long hair]]A link to a wiki page, with its own text after the |
{{cat -dog}}A link to search results
post #123, comment #45A link to a post or a comment
@nameA link to a user, who is notified when it’s in a comment, a forum post or a request’s discussion
[quote] and [/quote] on lines of their ownA quote
https://example.comA link to another site (up to 2048 characters; a longer address stays text)

Everything else is shown as written; HTML isn’t allowed. The syntax is a subset of Danbooru’s DText, so pages copied from there mostly work.

Artists

An artist tag can have an artist entry: the artist’s other names, their group or circle, and the places they post their work. Find them under Tags → Artists (/artists), searchable by any of their names, their group, or one of their URLs.

Anyone with the Edit the wiki and artists permission (members, by default) can start or change an entry: New artist on the list, or Start an artist entry on an artist tag’s wiki page. An entry’s name is its tag; a tag that doesn’t exist yet, or that no post uses yet, becomes an artist tag. Every change is kept under History, and Recent changes (/artist_versions) lists every entry’s changes, filterable by user. Entries can be deleted and restored; deleted ones, and their changes, are left out for visitors and others without that permission or See deleted posts.

The entry’s page shows the URLs, the first paragraph of the tag’s wiki page (the longer description lives there), and the artist’s newest posts.

URLs

List the artist’s profiles and galleries, one per line. Put - in front of ones no longer in use (a deleted account, a site that closed): they’re shown struck out, but still identify the artist. Profiles on the sites Moekura knows are saved in their canonical form (pixiv.net/member.php?id=1 becomes https://www.pixiv.net/users/1) and shown with the site’s icon. Quotes, angle brackets and spaces in an address are kept percent-encoded (%22, %3C, %20), and an address can be at most 2048 characters as it’s kept, encoding included.

Find an artist by URL (/artists/finder) takes any address, a profile or a page of one of the artist’s works, and lists the artists whose URLs it falls under: https://x.com/someone/status/123 finds the artist with https://twitter.com/someone. Addresses are compared without www., the scheme, or anything after ?, x.com counts as twitter.com, and a profile’s other forms count as its canonical one (someone.artstation.com as artstation.com/someone). Asking the work’s site counts against an allowance (see Lookups).

The upload form does the same with the link you upload from and the source: when they belong to a known artist, their tag is offered beside the tags box. For works on the sites Moekura reads, the site is asked who made it, so a work’s page finds the artist whose entry lists their profile, even when the page’s address doesn’t contain it (Pixiv’s don’t); an artist without an entry gets a link to start one, with their name and profiles filled in.

Banned artists

Staff who can manage tags can ban an artist from their entry (for example at the artist’s request). What that does is a site setting, under Admin → Settings → Banned artists:

  • Hide their posts (on by default): posts with the artist’s tag are left out of searches, and their pages aren’t found.
  • Refuse uploads (on by default): uploads with the tag, and edits adding it (reverting to a version that had it, too), are refused.

Staff who approve posts still see the posts and can post them.

The ban is on the tag with the entry’s name, for as long as the entry isn’t deleted. So renaming, deleting or restoring a banned artist’s entry also takes the manage tags permission; anyone who can edit artists can still change its other names, group and URLs. Bans, unbans, and renames, deletions and restorations of banned entries are recorded in the moderation log.

Commentary

A post can have the artist’s commentary: the title and description the artist gave the work where they posted it, and a translation. It’s shown under the picture, translated when there’s a translation (with the original a click away), and anyone who can edit posts can add or change it from the same place. Descriptions use the wiki’s markup. Every change is kept (Commentary history; /artist_commentary_versions lists them sitewide), and commentary: searches find posts with commentary, with or without a translation, or by its words: commentary:untranslated lists commentary waiting for a translator.

Comments

Every post has comments under the image. Anyone with the Comment permission (members, by default) can write one; they use the same formatting as the wiki, including [quote] blocks and comment #45 links. Reply starts a new comment quoting the one you’re answering. The newest 50 comments are shown on the post; the rest are a link away.

You can edit and delete your own comments; edited ones say so. Deleting a post’s last comment takes it out of order:comment. Deleted posts can’t be commented on, and comments are rate limited: a few at once, then one every 20 seconds. Edits count toward the same limit.

On public sites, a comment that looks like spam (links from a brand-new account, the same text over and over, or words the staff listed) is held until the staff check it; the same goes for forum posts and messages, and for edits, which hide a comment again until it’s checked. See the spam filter.

If the site asks new accounts for a captcha, it does so on every new comment, through the API too: clients send a solved captcha’s token as captcha, or the comment is refused until the account is old enough.

Tick Don’t bump the post to comment without moving the post up in order:comment_bumped; it still counts for order:comment. Moderators can Pin to top a comment, which then comes first among the post’s comments.

Comments in the menu lists the newest comments on the whole site, beside their posts; each profile links to that user’s comments.

Votes and reports

Vote comments up or down with the arrows (not your own). Comments voted down to −5 or lower are folded away, a click from being read.

Report asks the moderators to look at a comment; they can hide it, restore it later, or dismiss the report. See Moderation.

Searching

FilterFinds
commentcount:>0posts with comments
order:commentposts with comments, most recently commented first

Messages

Users can send each other private messages (Danbooru’s dmails). Messages at the top of every page opens yours, with a count of those you haven’t read; Send a message on someone’s profile, or New message, writes one. Messages use the same formatting as comments.

Your Inbox has what you received, Sent what you sent, and Unread what you haven’t opened yet. Deleting a message removes your copy only; the other person keeps theirs. Mark unread and Mark all read do what they say.

Blocking and reporting

Block (on a message, or Block messages on a profile) refuses that user’s messages from then on; the list of people you blocked is at the bottom of your messages, each with Unblock.

Report to the staff, on a message you received, sends it to the staff’s reports (Moderation → Reports) with your reason, which is required. Staff with Read reported and held private messages (moderators, by default) see reported messages there, as they were when reported, and no other messages anyone sends; they uphold or dismiss each report, saying how it ended, which goes in the moderation log. You can report a message once; after a report is settled, reporting it again waits a week.

Limits

Sending needs the Send private messages permission (members, by default; banned users can’t), and each user can send a handful at once, then about one a minute. Danbooru clients can read and send messages at /dmails.json.

The forum

Forum in the menu has the site’s discussions, in categories: General, Tags, Bugs and features and Site news. Anyone who can comment can start a topic (New topic) or reply, in the same markup as comments; you can edit your own posts while the topic is open, and vote other people’s posts up or down. Site news is the staff’s: only staff start topics there, move topics into it or rename topics in it, though anyone can reply. Posts and edits go through the same rate limit and spam filter as comments.

Topics you haven’t read since someone last posted in them are marked unread; opening a topic reads it, and Mark all read reads them all. Stickied topics stay at the top of the list. Search posts finds posts by their words or writer, and the list’s search finds topics by title.

Tag requests

Requesting an alias, an implication or a bulk update starts a topic about it in Tags, with the request and its reason; the request’s page links to the topic, and the topic back to the request. Requests made by those who can manage tags take effect at once and get no topic.

Moderation

Staff with Hide comments and handle reports about them can, from a topic’s Moderate section, stick it to the top, lock it (only staff can post in a locked topic), delete or restore it, and merge it into another topic: its posts move there, it’s deleted, and links to it lead to the other. They can also hide posts (hidden posts stay visible to staff, marked) and edit or rename the posts and topics of people ranked below them. All of this goes in the moderation log, and each change to a post keeps the text it replaced, which staff see from the post’s history link.

Danbooru clients can read topics, posts and their own votes, and post, at /forum_topics.json, /forum_posts.json and /forum_post_votes.json.

Pools

A pool is an ordered collection of posts: a series (a comic, a set of pages meant to be read in order) or a collection (posts that belong together). Find them under Pools in the menu.

Making and changing pools

Anyone with Create and edit pools (members, by default) can start a pool with New pool and change any pool’s name, kind, description and posts. The posts are a list of post numbers in order; on the edit page you can also drag the thumbnails into order. To add one post, open it and use Add to a pool beside it, which puts it at the end. Only posts you can see go in, and not deleted ones: a post you can’t see is refused as if it didn’t exist. Posts already in a pool stay when you save it, even those you can’t see, and everyone sees only the posts in it they may see (on its page, in the reader and through the APIs).

Every change is kept: History shows who added, removed or reordered posts (linking the first 100 posts a change added or removed, and counting the rest), and any version can be restored (posts taken out since come back only if they could be added again). If someone else saves the pool while you’re editing it, you’re told instead of overwriting their change. Staff who can delete posts can also delete and restore pools. Recent changes on the pool list (/pool_versions) shows the changes to every pool, newest first, and can be filtered by user.

Reading

A post in a pool shows a bar above the image with the pool’s name, the post’s place in it, and links to the first, previous, next and last post. Posts opened from a pool’s page step through the pool with the a and d keys (or the arrow keys).

Series have a reader: Read on the pool’s page shows the posts one after another, 20 at a time, and One page at a time shows a single page, with a and d to turn it (clicking the image turns it too). Your browser remembers the last page you read, and the pool’s page offers to continue from there.

Searching

FilterFinds
pool:my_comic, pool:12posts in the pool (by name, regardless of case, or number)
pool:any, pool:noneposts in some pool, or in none
ordpool:my_comicthe pool’s posts, in the pool’s order

Pools also appear in the API and to Danbooru apps.

Notes

Notes are boxes on a post’s image with text in them, usually translations of what’s written in the picture. A post with notes shows them as boxes over the image; point at a box, tap it or tab to it to read its note. Hide notes under the image (or the n key) hides them, and your browser remembers that. Every note is also listed below the image under Notes, which is what screen readers read.

Notes are drawn on the original image, so they stay in place at any size the image is shown. Videos don’t have notes.

Adding and changing notes

Anyone with Edit notes (members, by default) gets Edit notes under the image. While it’s on:

  • drag across the image to draw a new note, then type its text and Save;
  • drag a note to move it, or drag its bottom-right corner to resize it;
  • click a note to change its text, or Delete it.

Each change is saved as you make it. If someone else changed the same note since you loaded the page, yours is refused rather than overwriting theirs; reload to see their change. Notes use the same formatting as the wiki. Drawing notes needs scripts; without them you can still read notes and revert them.

Embedded notes

Translations of speech bubbles and signs read best in place. Draw the notes’ text on the picture, under the list of notes, shows each note’s text inside its box all the time, rather than when pointed at (Danbooru’s embedded notes); the same button switches back. It’s for the whole post, needs Edit notes, and embedded:true finds such posts.

History

Note history (beside the post’s history) lists every version of every note on the post: its box, its text, who changed it and when. Revert a note to an earlier version to undo a change, or to bring back a deleted note. All note changes (/note_versions) lists the note changes on every post you can see, newest first, and can be filtered by user.

Searching

FilterFinds
note:good_morningposts whose notes contain these words (underscores for spaces)
notecount:>0posts with notes
order:noteposts with notes, most recently changed first

The API

Everything the site does is available as JSON under /api/v1. Each site documents its own version of the API at /api/docs, generated from the code, and serves the OpenAPI description at /api/v1/openapi.json for generating clients (moekura openapi prints it too).

Apps made for Danbooru can use the site too; see Danbooru apps.

Authenticating

Create a key under Settings → API keys and feeds and send it with each request:

curl -H "Authorization: Bearer mka_…" https://booru.example.com/api/v1/me

A key acts as you: it can do what your role allows, and while you’re banned only what visitors can. It’s shown once, when created; revoke it from the same page if it leaks. Keys start with mka_ so that secret scanners can spot them. Without a key, requests are made as a visitor.

A key can do everything you can, or only the permissions you tick when making it (say, View posts and Upload for an uploader script), so a leaked key gives away less. Ticking never adds anything your role lacks, and a limited key doesn’t gain permissions your role is given later. Without View posts, even searching is refused. Your own account’s things that need no permission, such as your saved searches, stay reachable with any key. GET /api/v1/me lists what the key in use may do.

Site admins can also make keys from the shell, with moekura admin create-api-key, for bots or scripts set up alongside the site.

Making a key asks for your password. Accounts made through single sign-on have none to give, so for them it works only within 10 minutes of logging in. A key can’t manage keys or the feed token, or change your address, password, two-factor login or single sign-on links: those need you logged in on the site. Resetting your password revokes all your keys, and changing it does too unless you untick that.

Errors

Errors are JSON with the HTTP status:

{"error": {"status": 422, "message": "Choose a rating."}}

A duplicate upload is a 409 whose error also has post_id, the post that already has the file. If that post is one you can’t see (someone else’s that was deleted or waits for approval), the upload is a 422 that doesn’t name it.

An upload that looks like posts already on the site (see Duplicates and look-alikes) is a 409 too, with similar, those posts closest first, and staged, the number of the file kept meanwhile:

{"error": {"status": 409, "message": "This file looks like posts…", "similar": [12], "staged": 3}}

To post it anyway, send the same fields again with staged=3 instead of the file, or the file with allow_similar=true. Automated uploaders that check for themselves can always send allow_similar=true.

Rate limits

Each client may make a few hundred requests a minute (300 by default, with bursts of up to 60; the site’s admins set api_requests_per_minute and api_burst). Requests with a key count against its account, requests without one against the address they come from. The Danbooru-compatible API shares the same allowance. Every response says what’s left:

HeaderMeaning
X-RateLimit-Limitrequests that may be made at once (the burst)
X-RateLimit-Remainingrequests left right now
X-RateLimit-Resetwhen the full burst is available again, in Unix time

Past the limit, requests get a 429 with Retry-After, the seconds to wait. Some actions also have their own, tighter limits, the same as on the site: logging in, uploading (see upload limits), posting comments, flagging and reporting, and forms that send email.

Browser apps on other websites

Browsers only let a script on another website call the API if the site allows that website. Admins list the allowed origins in [server.cors]; by default none are, and only the site’s own pages can call it from a browser.

From an allowed origin, scripts can use /api/v1 and the Danbooru-compatible API with any method, sending Authorization and Content-Type headers, and can read the rate-limit headers, Retry-After, Location and X-Request-Id in answers. Authenticate with an API key:

const response = await fetch("https://booru.example.com/api/v1/me", {
  headers: { Authorization: `Bearer ${apiKey}` },
});

Cookies are ignored on these requests, so an app can’t act through the visitor’s login on the site, unless the admins turn on allow_credentials for origins they trust. Then a script can send credentials: "include" to act as whoever is logged in; the site’s cookies are SameSite=Lax, so that only works for origins on the same site (another subdomain of the same domain). A private site still refuses requests without a key or login, wherever they come from.

Examples

Search, 100 posts at a time:

curl "https://booru.example.com/api/v1/posts?tags=cat+-dog&limit=100"

The response has posts, a count, and next_page: pass it back as page for the next page, until it’s absent.

Upload a file:

curl -H "Authorization: Bearer $KEY" \
  -F file=@cat.png -F rating=g -F "tags=cat artist:someone" \
  https://booru.example.com/api/v1/posts

Add and remove tags without touching the others:

curl -X PATCH -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"add_tags": ["sleeping"], "remove_tags": ["standing"]}' \
  https://booru.example.com/api/v1/posts/123

Change a wiki page, refusing if someone else changed it since version 3:

curl -X PUT -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"body": "A small [[animal]].", "base_version": 3}' \
  https://booru.example.com/api/v1/wiki-pages/cat

Comment on a post (accounts new enough that the site asks them for a captcha also send a solved one’s token as "captcha"):

curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"body": "Lovely colours."}' \
  https://booru.example.com/api/v1/posts/123/comments

Make a pool of three posts, then add a fourth at the end:

curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name": "My comic", "category": "series", "post_ids": [120, 121, 122]}' \
  https://booru.example.com/api/v1/pools
curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"post_id": 123}' \
  https://booru.example.com/api/v1/pools/1/posts

Add a note (the box is in the original image’s pixels):

curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"x": 120, "y": 40, "width": 200, "height": 80, "body": "Good morning!"}' \
  https://booru.example.com/api/v1/posts/123/notes

Saved searches (/saved-searches) and favorite groups (/favorite-groups) work the same way; the site’s /api/docs lists every endpoint.

Danbooru apps

Moekura answers Danbooru’s API too, so apps and tools made for Danbooru can use a Moekura site: point them at the site as if it were a Danbooru instance. Logged out, they see what visitors see. To log in, make an API key under Settings → API keys and feeds and give the app your name and the key (not your password).

Put Danbooru: in front of a site URL:

gallery-dl "Danbooru:https://booru.example.com/posts?tags=cat"
gallery-dl -u yourname -p mka_… "Danbooru:https://booru.example.com/posts?tags=cat"

Or add the site once in gallery-dl’s configuration, and use its URLs as they are:

{
  "extractor": {
    "Danbooru": {
      "mybooru": { "root": "https://booru.example.com" }
    },
    "mybooru": { "username": "yourname", "password": "mka_…" }
  }
}

CI checks gallery-dl against every change.

The apps below aren’t tested automatically; if one trips over something, please open an issue.

Grabber

Add a source with the site’s address and choose Danbooru (2.0) as its type. In the source’s settings, enter your name and your API key under login.

Boorusama

Add a booru with the site’s address and choose Danbooru as its engine, then log in with your name and your API key.

What works

EndpointNotes
/posts.json, /posts/{id}.json, /posts/random.json, /counts/posts.jsonsearch with the site’s syntax; page takes numbers, b<id> and a<id>; up to 200 per page; only= picks fields
PUT /posts/{id}.jsonpost[tag_string] (with post[old_tag_string]), post[rating], post[source], post[parent_id]
/post_versions.jsonby search[post_id]
/tags.json, /autocomplete.json, /related_tag.jsonrelated tags are estimated from a search’s newest 200 posts; for a single tag, wiki_page_tags are the tags its wiki page links to
/tag_aliases.json, /tag_implications.json
/tag_versions.jsonby search[tag_id], search[name], search[updater_id] or search[updater_name]
/wiki_pages.json, /wiki_pages/{title or id}.jsonby search[title], search[other_names_match] (* wildcards; without one, the whole name) or search[other_names_include_any]
/profile.json, /users.json, /users/{id}.jsonlevels follow roles: Member 20, Contributor 35, Janitor 37, Moderator 40, Admin 50; last_logged_in_at and is_banned only for yourself and staff who see moderation records (otherwise null and false)
/favorites.json, /favorites/{post_id}.json, /posts/{id}/favorites.jsonfavorites of posts you can see, newest first, by search[user_id] (otherwise yours) or search[post_id] (up to 100 posts); logged out without search[user_id], numbered pages go as far as the newest 20,000
/posts/{id}/votes.json, /post_votes.jsononly your own votes are listed
/artists.json, /artists/{id}.json, /artist_urls.json, /artist_versions.jsonread-only; artists by search[name], search[any_name_matches], search[url_matches] (any page of the artist’s), search[is_banned], search[is_deleted] or search[id], each with its urls; URLs by search[artist_id] or search[url_matches]; versions by search[artist_id], search[updater_id] or search[updater_name]; deleted artists and their versions only with Edit the wiki and artists or See deleted posts, as on the site
/artist_commentaries.json, /artist_commentaries/{post_id}.json, /posts/{id}/artist_commentary.json, /artist_commentary_versions.jsona commentary’s id is its post’s; by search[post_id], search[text_matches], search[original_present] or search[translated_present]; PUT /artist_commentaries/create_or_update.json sets artist_commentary[post_id]’s texts (those left out stay)
/media_assets.json, /media_assets/{id}.json, /media_metadata.jsona post’s file has the post’s id; files by search[id] or search[md5]; metadata by search[media_asset_id], as Group:Tag pairs like EXIF:Make
/post_replacements.jsonread-only, by search[post_id] or search[creator_id]
/iqdb_queries.jsonsearching by image: GET with search[url] or search[post_id], or POST a file too; [{post_id, score, post}], score in percent
/wiki_page_versions.json, /pool_versions.jsonwiki versions by search[wiki_page_id], search[title], search[updater_id] or search[updater_name]; pool versions by search[pool_id] or the updater, with added_post_ids and removed_post_ids, up to 100 per page
/dmails.json, /dmails/{id}.jsonyour messages, by search[folder] (received, sent or all) and search[is_read]; send with dmail[to_name] (or dmail[to_id]), dmail[title] and dmail[body]
/forum_topics.json, /forum_topics/{id}.json, /forum_posts.json, /forum_posts/{id}.json, /forum_post_votes.jsontopics by search[title_matches] (* wildcards), search[category_id] or search[id]; posts newest first by search[topic_id], search[creator_id], search[creator_name] or search[body_matches]; your own votes; post with forum_post[topic_id] and forum_post[body], or start a topic with forum_topic[title], forum_topic[category_id] (by default the first you may start topics in; Site news is for staff) and forum_topic[original_post_attributes][body]
/explore/posts/popular.json, /explore/posts/viewed.jsonthe best-scored and most viewed posts of a date’s day, or with scale, week or month
/explore/posts/searches.json, /explore/posts/missed_searches.json[query, count] pairs: the searches that most often found posts, and those that most often found nothing, by date and scale like the posts
/comments.json, /comments/{id}.jsonlisted newest first, by search[post_id], search[creator_id] or search[creator_name]; page takes b<id>, and numbers as far as the newest 20,000 comments; post with comment[post_id] and comment[body] (and captcha, a solved captcha’s token, from accounts new enough to be asked for one), and change or delete your own
/comments/{id}/votes.json, /comment_votes.jsononly your own votes are listed
/pools.json, /pools/{id}.jsonby search[name_matches], search[name_contains], search[id] (each pool once) or search[category]; post_ids lists the posts you can see; up to 100 per page
/favorite_groups.json, /favorite_groups/{id}.jsonby search[creator_id] or search[creator_name], otherwise yours; up to 100 per page
/notes.json, /notes/{id}.json, /note_versions.jsonnotes by search[post_id] (one or more posts); versions by search[post_id] or search[note_id]; read-only
POST /uploads.json, /uploads.json, /uploads/{id}.jsonthe first step of an upload: a file as upload[files][0], or a link as upload[source] (its first file); an upload media asset and its media asset share one id, the upload has its own. Your uploads are listed newest first
POST /posts.jsonthe second step: upload_media_asset_id (or upload_id for the upload’s first file not posted) with post[tag_string], post[rating], post[source] and optionally post[parent_id]; upload limits apply. Files not made into posts within a day are removed
/ai_tags.jsonthe tagger’s suggestions on posts you can see, newest posts first, by search[post_id] (or search[media_asset_id], the same number), search[tag_name], search[tag_id], search[is_posted] and search[score] (>=50, 50..90); score is 0 to 100; numbered pages go as far as the first 20,000
/user_feedbacks.json, /user_feedbacks/{id}.jsonfeedback on users, newest first, by search[user_id], search[user_name], search[creator_id], search[creator_name] and search[category] (positive, neutral or negative); read-only
/user_name_change_requests.json, /user_name_change_requests/{id}.jsonusers’ name changes, newest first, by search[user_id], search[original_name] and search[desired_name]; they take effect at once, so there’s nothing to approve; inactive users’ changes only for staff who manage users
/news_updates.json, /news_updates/{id}.jsonsite news, newest first; read-only
/saved_searches.jsonyours; add with saved_search[query] and saved_search[label_string], and delete

What doesn’t

  • Favorites and your votes on posts and comments have no ids of their own: their id is the post’s or comment’s.
  • Pools, favorite groups and notes are read-only here; change them on the site or with Moekura’s API.
  • A page of pools, favorite groups or pool versions lists at most 100,000 post ids between them; a page that would list more is refused with 400, so ask for a smaller limit.
  • Responses are JSON only, not XML.

Development

Moekura is written in Rust, with pages rendered on the server and a little TypeScript on top.

You need Rust 1.94+, the media tools, and a PostgreSQL server for the database tests:

podman run -d --name moekura-pg -p 55432:5432 \
  -e POSTGRES_USER=moekura -e POSTGRES_PASSWORD=moekura -e POSTGRES_DB=moekura \
  docker.io/library/postgres:18-alpine

export DATABASE_URL=postgres://moekura:moekura@localhost:55432/moekura
cargo test --workspace          # each database test gets its own database
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all
cargo deny check                # licenses, advisories, sources

The page scripts are TypeScript in frontend/, bundled with esbuild into crates/web/static/js/. The bundle is committed, so building the binary needs no Node; after changing frontend/src, rebuild it (Node 24+):

cd frontend
npm ci
npm run check     # typecheck
npm test          # unit tests
npm run build     # or npm run watch

Build version

The footer embeds the version when the Rust binary is compiled. A checkout at the release tag matching Cargo.toml shows that semver; other commits show git- followed by the first seven characters of the commit hash. MOEKURA_BUILD_VERSION overrides detection, so CI can distinguish release builds from main builds even when they share a commit.

For a local Docker build, pass the version explicitly because .git is excluded from the build context:

docker build --build-arg MOEKURA_BUILD_VERSION="git-$(git rev-parse --short=7 HEAD)" -t moekura .

For a release build, pass its semver instead. Source archives without Git metadata also need MOEKURA_BUILD_VERSION; without it, the footer displays git-unknown and the build emits a warning.

End-to-end tests

e2e/ has Playwright tests that drive a real browser through a running site: registering, uploading, tagging, searching, the wiki, favorites, moderation and private mode. CI runs them against deploy/compose.tiny.yml; to run them yourself, see e2e/README.md.

Renaming something public

What Stability promises can’t be renamed outright within a major version: the old name keeps working, with a warning, until the next one. Each kind has its shim:

  • Config keys: rename the field, then add the old and new dotted paths to CONFIG_KEYS in crates/app/src/deprecated.rs. The old key, in the file or as its MOEKURA_* variable, is moved to the new one before the configuration is read, and startup logs a warning naming the new key. Setting both is an error.
  • CLI flags and subcommands: rename it, then add it to CLI_NAMES in the same file ("admin seed --batch" → "--batch-size"). Old spellings are rewritten before parsing, so they stay out of --help, and print a warning.
  • API operations: add the method and path to DEPRECATED in crates/web/src/api/mod.rs. The OpenAPI description marks it deprecated and says what to use instead, and its responses carry a Deprecation header (RFC 9745).
  • API fields: keep sending the old field beside the new one, and mark it with #[schema(deprecated)].

Tests check that each old config key and CLI name leads to one that exists. Say what was renamed in the changelog’s upgrading notes, and remove the shims in the next major release.

This book

The documentation is an mdBook in docs/:

mdbook serve docs    # http://localhost:3000, rebuilt as you edit

CI builds it and checks its links on every pull request. Pushes to main publish it to GitHub Pages once the repository is public (set Settings → Pages → Source to GitHub Actions).

Releasing

  1. Draft the changelog entry from the commits since the last release, then edit it into notes people can read: git cliff --unreleased --tag vX.Y.Z --prepend CHANGELOG.md.
  2. Set the workspace version in Cargo.toml, and the date in the changelog heading.
  3. Merge that, then tag the merge commit vX.Y.Z and push the tag. The Release workflow checks the version and changelog, publishes the image and creates the GitHub release with the binaries.

Layout

crates/core     domain types and pure logic (config, permissions, search syntax)
crates/db       PostgreSQL pools, migrations, queries, the search planner
crates/storage  file storage: local disk or S3
crates/media    identifying and processing media with vips and ffmpeg
crates/jobs     the job queue's workers and handlers
crates/web      the HTTP server: pages, the API, middleware
crates/app      the moekura binary: commands, configuration, logging
frontend/       TypeScript for the pages
deploy/         compose files
docs/           this book