No description
  • Rust 94.8%
  • Dockerfile 5.2%
Find a file
2026-10-20 06:23:25 -05:00
.github/workflows Rebranding 2026-10-20 06:23:25 -05:00
sql Rename category to category_id 2026-10-18 07:52:06 -05:00
src Rename category to category_id 2026-10-18 07:52:06 -05:00
.dockerignore Add docker 2023-04-05 17:32:10 +02:00
.env.sample Add metrics 2026-07-12 08:12:46 -05:00
.gitignore add health check 2024-10-06 12:27:44 -05:00
Cargo.lock Add metrics 2026-07-12 08:12:46 -05:00
Cargo.toml Add metrics 2026-07-12 08:12:46 -05:00
docker-compose.yml Add metrics 2026-07-12 08:12:46 -05:00
Dockerfile Change build action 2026-07-12 09:18:03 -05:00
LICENSE Add a license 2023-04-05 22:09:29 +02:00
README.md Rebranding 2026-10-20 06:23:25 -05:00

autocompleted

A tag autocomplete API service for Fennec, written in Rust using actix-web. It queries a PostgreSQL database for matching tags and caches results in memory. Used for GayFurCity.

Endpoints

Method Path Description
GET / Autocomplete tags
GET /up Health check (returns 204)

Prometheus metrics are served separately, on METRICS_ADDR, so /metrics is never reachable through the public reverse proxy:

Method Path Description
GET /metrics Prometheus metrics (on METRICS_ADDR, not SERVER_ADDR)

Exposes standard actix-web-prom HTTP metrics (autocompleted_http_requests_total, autocompleted_http_requests_duration_seconds) plus:

  • autocompleted_cache_hits_total / autocompleted_cache_misses_total — in-memory cache effectiveness
  • autocompleted_db_query_duration_seconds — tag lookup query latency

GET /?search[name_matches]=<prefix>

Returns a JSON array of matching tags. The prefix must be 3–100 characters.

Example:

GET /?search[name_matches]=cani

Response:

[
  {"id": 1, "name": "canine", "post_count": 12345, "category_id": 0, "antecedent_name": null}
]

Responses are cached for 6 hours (up to 15,000 entries). Supports * as a wildcard in the prefix.

Configuration

Copy .env.sample to .env and fill in the values:

SERVER_ADDR=0.0.0.0:3000
METRICS_ADDR=0.0.0.0:9396
PG__USER=postgres
PG__PASSWORD=secret
PG__HOST=localhost
PG__PORT=5432
PG__DBNAME=mydb
PG__POOL__MAX_SIZE=16

Running

# Development
cargo run

# Docker
docker compose up

Building

cargo build --release

License

See LICENSE.