Skip to content

AaronConlon/codia

Repository files navigation

Codia

English | 简体中文

Beautiful code images for humans and APIs.

Codia turns source code into crisp images for docs, blogs, social posts, and automation. It provides a browser playground at /try-it, a render API, lightweight render statistics, and an llms.txt endpoint for agent-facing documentation.

Features

  • Interactive /try-it playground with language, theme, background, padding, width, line-number, copy, and download controls.
  • POST /v1/code/render API for generating code images from JSON payloads.
  • SQLite-backed render records for usage stats.
  • OpenAPI documentation at /docs.
  • Docker Compose and OVO deployment scripts.

Requirements

  • Node.js 24
  • npm
  • SQLite-compatible filesystem access

Development

npm ci
npm run dev

The app runs on http://localhost:3000 by default.

Useful commands:

npm run typecheck
npm run build
npm start

Environment

PORT=3000
DATABASE_DIR=/root/apps/codia/databases

DATABASE_DIR is the directory where Codia stores codia.sqlite.

For Docker Compose, DATABASE_DIR is treated as the host persistence directory and is mounted into the container at /app/databases.

Docker

docker compose up -d --build

With a custom database directory:

DATABASE_DIR=/root/apps/codia/databases docker compose up -d --build

API

Render a code image:

curl -X POST http://localhost:3000/v1/code/render \
  -H "content-type: application/json" \
  -d '{
    "language": "typescript",
    "theme": "dracula",
    "code": "console.log(\"hello codia\")",
    "bgColor": "#0f172a",
    "borderSize": 12,
    "containerWidth": 600,
    "showLineNumbers": true
  }'

More details are available at /docs and /llms.txt.

Deployment

The repository includes an OVO release workflow and deploy scripts under scripts/ovo.

The main deployment variable for database persistence is:

DATABASE_DIR=/root/apps/codia/databases

The application always creates the directory if needed and stores the SQLite file as codia.sqlite.

npm run build:release creates a minimal OVO runtime bundle: it installs dependencies, builds dist, installs production-only node_modules, and writes a runtime Dockerfile into the release archive. The target server's Docker build only copies those runtime files into the image; it does not run npm install or compile TypeScript.

About

Beautiful code images for humans and APIs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors