Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/syhily/yufan.me/llms.txt

Use this file to discover all available pages before exploring further.

yufan.me reads its infrastructure configuration from environment variables at process startup. These variables control how the server binds, which Postgres and Redis instances to connect to, and how the session layer signs cookies. They are intentionally separate from the database-backed site settings, which control runtime behaviour such as navigation links, SEO meta, and caching policy — settings you can change without restarting the server. Copy .env.example to .env and fill in the required variables before your first boot.
cp .env.example .env

Server

HOST
string
default:"0.0.0.0"
The network interface the Hono HTTP server binds to. The default 0.0.0.0 listens on all interfaces, which is correct for most containerised deployments. Set to 127.0.0.1 if you put a reverse proxy (nginx, Caddy) in front and do not want the server exposed directly.
PORT
number
default:"4321"
The TCP port the server listens on. Defaults to 4321. Override this when the port conflicts with another service or when your hosting platform injects its own PORT variable.
LOG_LEVEL
string
Controls log verbosity. Accepts standard level names: trace, debug, info, warn, error, fatal. When left unset the server picks a sensible default for the NODE_ENV. Set to debug or trace locally to see incoming request details and query logs.

Database

DATABASE_URL
string
required
Postgres connection string in the standard URI format.
postgres://user:password@host:5432/database
Drizzle opens a connection pool against this URL on startup. The database must exist and be reachable before the server starts; migrations in drizzle/ should be applied by your deployment workflow before boot.
REDIS_URL
string
required
Redis connection string.
redis://host:6379
Redis is used for session storage, rate-limit counters, and generated-image caches (OG images, calendar SVGs, avatar proxies, embedding search results). A single Redis instance is sufficient; the server namespaces every key with a configurable prefix set in the cache settings section.

Session security

SESSION_SECRET
string
required
A high-entropy secret string used to sign the __session cookie. The Hono session middleware rejects any cookie whose signature does not match, so changing this value immediately invalidates all active sessions.Generate a suitable value with:
openssl rand -base64 48
SESSION_SECRET must be a long random string — at minimum 32 bytes of entropy. Do not commit it to version control, do not share it between environments, and rotate it if you suspect it has been exposed. All active sessions are invalidated on rotation.

Analytics (optional)

MAXMIND_DB_PATH
string
default:"./data/maxmind/GeoLite2-City.mmdb"
Filesystem path to a MaxMind GeoLite2-City .mmdb binary. When provided, the analytics ingestion pipeline enriches each visit record with country, region, city, latitude, longitude, and timezone columns. When left unset, visits are still recorded but all geo columns are NULL.Download the free GeoLite2-City database from maxmind.com and place the .mmdb file at the configured path. The file is gitignored by default.
ANALYTICS_TRACK_ADMIN
boolean
default:"false"
When true, visits made by logged-in admin sessions to public-facing pages (home, post detail, etc.) are written to access_log alongside regular visitor traffic and appear in the analytics dashboard. The default false keeps the dashboard owner out of their own visitor metrics.Set to true locally when debugging the analytics pipeline or testing the dashboard with live traffic.
All other runtime settings — site name and description, navigation links, SEO meta, sidebar widgets, comment configuration, Redis cache TTLs, rate limits, search mode, fonts, and scheduled backups — are stored in the database and are edited from the admin console at /admin/settings. No server restart is required to apply those changes. See the site settings sections overview for the full list.

Build docs developers (and LLMs) love