### Setup Development Environment Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/contributing.md Clone the repository, navigate to the project directory, install dependencies, and start the development servers. Ensure Node.js 22+ and pnpm 9+ are installed. ```bash git clone https://github.com//snapotter.git cd snapotter pnpm install pnpm dev ``` -------------------------------- ### Install Dependencies and Start Dev Servers Source: https://github.com/snapotter-hq/snapotter/blob/main/CONTRIBUTING.md Clone the repository, install project dependencies using pnpm, and start the development servers for the web and API. Ensure Node.js 22+ and pnpm 9+ are installed. ```bash git clone https://github.com//snapotter.git cd snapotter pnpm install pnpm dev ``` -------------------------------- ### Build and Run SnapOtter from Source Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/getting-started.md Instructions to clone the SnapOtter repository, install dependencies using pnpm, and start the development server. Prerequisites include Node.js, pnpm, Python, and Git. ```bash git clone https://github.com/snapotter-hq/SnapOtter.git cd SnapOtter pnpm install pnpm dev ``` -------------------------------- ### Start Development Servers Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Run the command to start both the frontend and backend development servers. ```bash pnpm dev ``` -------------------------------- ### Docker Compose Configuration for SnapOtter Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/configuration.md This example demonstrates how to configure SnapOtter within a Docker Compose setup. It shows how to map ports, mount volumes for persistent data and workspace, and set essential environment variables for authentication, upload size, and concurrent job processing. Ensure to set `DEFAULT_PASSWORD` to a secure value. ```yaml services: SnapOtter: image: snapotter/snapotter:latest ports: - "1349:1349" volumes: - SnapOtter-data:/data - SnapOtter-workspace:/tmp/workspace environment: - AUTH_ENABLED=true - DEFAULT_USERNAME=admin - DEFAULT_PASSWORD=changeme - MAX_UPLOAD_SIZE_MB=200 - CONCURRENT_JOBS=4 - FILE_MAX_AGE_HOURS=12 restart: unless-stopped ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Clone the SnapOtter repository and install project dependencies using pnpm. ```bash git clone https://github.com/snapotter-hq/snapotter.git cd snapotter pnpm install ``` -------------------------------- ### Run SnapOtter with Docker Source: https://github.com/snapotter-hq/snapotter/blob/main/README.md This command starts SnapOtter in detached mode, mapping port 1349 and mounting a volume for persistent data. Use this for a basic setup. ```bash docker run -d --name snapotter -p 1349:1349 -v snapotter-data:/data snapotter/snapotter:latest ``` -------------------------------- ### Run Docker Compose for CPU Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Command to start the SnapOtter container using the CPU Docker Compose configuration. Ensure the docker-compose.yml file is in your current directory. ```bash docker compose up -d ``` -------------------------------- ### POST /api/v1/admin/features/:bundleId/install Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Installs a specified feature bundle. This is an asynchronous operation that returns a job ID for tracking the installation progress. ```APIDOC ## POST /api/v1/admin/features/:bundleId/install ### Description Install a feature bundle (async, returns `jobId` for progress tracking). ### Method POST ### Endpoint /api/v1/admin/features/:bundleId/install ### Parameters #### Path Parameters - **bundleId** (string) - Required - The ID of the feature bundle to install ### Response #### Success Response (200) - **jobId** (string) - The ID of the installation job ``` -------------------------------- ### GET /api/v1/features Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Lists all available feature bundles and their current installation status within the Docker environment. ```APIDOC ## GET /api/v1/features ### Description List all feature bundles and their install status. ### Method GET ### Endpoint /api/v1/features ### Response #### Success Response (200) - **features** (array) - List of feature bundles with their status ``` -------------------------------- ### Run SnapOtter with Docker Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/getting-started.md Quickly start SnapOtter using a single Docker command. This command maps the necessary port and mounts a volume for persistent data storage. ```bash docker run -d --name SnapOtter -p 1349:1349 -v SnapOtter-data:/data snapotter/snapotter:latest ``` -------------------------------- ### Create a New Backend Tool Route Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Example of creating a new backend route for an image processing tool using Fastify and Zod for schema validation. ```typescript import { z } from "zod"; import type { FastifyInstance } from "fastify"; import { createToolRoute } from "../tool-factory.js"; const settingsSchema = z.object({ intensity: z.number().min(0).max(100).default(50), }); export function registerMyTool(app: FastifyInstance) { createToolRoute(app, { toolId: "my-tool", settingsSchema, async process(inputBuffer, settings, filename) { // Use sharp or other libraries to process the image const sharp = (await import("sharp")).default; const result = await sharp(inputBuffer) // ... your processing logic .toBuffer(); return { buffer: result, filename: filename.replace(/\.[^.]+$/, ".png"), contentType: "image/png", }; }, }); } ``` -------------------------------- ### Run Cloudflare Tunnel Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Start a Cloudflare Tunnel to expose your local SnapOtter instance to the internet. Note Cloudflare's upload limits. ```bash cloudflared tunnel --url http://localhost:1349 ``` -------------------------------- ### SSE Event Format Example Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Example of the data format for Server-Sent Events, indicating progress and status updates. ```text data: {"progress":42,"status":"processing","message":"Upscaling frame 2/5"} data: {"progress":100,"status":"completed"} ``` -------------------------------- ### Executing a Pipeline with cURL Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Shows how to execute a sequence of image processing operations defined in a pipeline. This example resizes an image, compresses it, and adds a watermark. ```bash # Single file curl -X POST http://localhost:1349/api/v1/pipeline/execute \ -H "Authorization: Bearer " \ -F "file=@input.jpg" \ -F 'pipeline={"steps":[ {"toolId":"resize","settings":{"width":1200}}, {"toolId":"compress","settings":{"quality":80}}, {"toolId":"watermark-text","settings":{"text":"© 2025"}} ]}' ``` -------------------------------- ### Run Docker Compose for GPU Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Command to start the SnapOtter container using the GPU-enabled Docker Compose configuration. Specify the correct compose file using the -f flag. ```bash docker compose -f docker-compose-gpu.yml up -d ``` -------------------------------- ### Docker Run with GPU Acceleration Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/docker-tags.md Run the SnapOtter Docker image with GPU acceleration enabled using the NVIDIA Container Toolkit. Ensure the NVIDIA Container Toolkit is installed on the host. ```bash docker run -d --name SnapOtter --gpus all -p 1349:1349 -v SnapOtter-data:/data snapotter/snapotter:latest ``` -------------------------------- ### GET /api/v1/meme-templates/full/:filename Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Serves the full-size image of a specified meme template. ```APIDOC ## GET /api/v1/meme-templates/full/:filename ### Description Serve full-size template image. ### Method GET ### Endpoint /api/v1/meme-templates/full/:filename ### Parameters #### Path Parameters - **filename** (string) - Required - The filename of the template image ### Response #### Success Response (200) - **image/png** (binary) - The full-size template image ``` -------------------------------- ### Docker Named Volume Configuration Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Example of configuring a named volume for persistent data storage in Docker. ```yaml volumes: - SnapOtter-data:/data ``` -------------------------------- ### Docker Compose for GPU Acceleration Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Configure SnapOtter for NVIDIA GPU acceleration. This requires the NVIDIA Container Toolkit to be installed. It includes GPU device reservations in the deploy section. ```yaml # docker-compose-gpu.yml — Requires: NVIDIA GPU + nvidia-container-toolkit # Install toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html services: SnapOtter: image: snapotter/snapotter:latest container_name: SnapOtter ports: - "1349:1349" volumes: - SnapOtter-data:/data - SnapOtter-workspace:/tmp/workspace environment: - AUTH_ENABLED=true - DEFAULT_USERNAME=admin - DEFAULT_PASSWORD=admin restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:1349/api/v1/health"] interval: 30s timeout: 5s start_period: 60s retries: 3 shm_size: "2gb" # Required for PyTorch CUDA shared memory deploy: resources: reservations: devices: - driver: nvidia count: all # Or set to 1 for a specific GPU capabilities: [gpu] logging: driver: json-file options: max-size: "10m" max-file: "3" volumes: SnapOtter-data: SnapOtter-workspace: ``` -------------------------------- ### GET /api/v1/config/analytics Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Fetches the analytics configuration, including PostHog key, Sentry DSN, and sample rate. Returns empty values if analytics are disabled. ```APIDOC ## GET /api/v1/config/analytics ### Description Get analytics configuration (PostHog key, Sentry DSN, sample rate). Returns empty values if `ANALYTICS_ENABLED=false`. ### Method GET ### Endpoint /api/v1/config/analytics ### Response #### Success Response (200) - **posthog_key** (string) - PostHog API key - **sentry_dsn** (string) - Sentry DSN - **sample_rate** (number) - Analytics sample rate ``` -------------------------------- ### Nginx Reverse Proxy Configuration Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Configure Nginx as a reverse proxy for SnapOtter. This example sets up basic proxying, WebSocket support, and adjusts the client body size for uploads. ```nginx server { listen 80; server_name images.example.com; # Match MAX_UPLOAD_SIZE_MB (0 = nginx default 1M, so set high for unlimited) client_max_body_size 500M; location / { proxy_pass http://localhost:1349; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # SSE support (batch progress, feature install progress) proxy_buffering off; proxy_read_timeout 300s; } } ``` -------------------------------- ### Resize Image using SnapOtter REST API Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/getting-started.md Example of resizing an image via the SnapOtter REST API using curl. Requires an API key and specifies image dimensions and fit strategy. ```bash curl -X POST http://localhost:1349/api/v1/tools/resize \ -H "Authorization: Bearer si_" \ -F "file=@photo.jpg" \ -F 'settings={"width":800,"height":600,"fit":"cover"}' ``` -------------------------------- ### SnapOtter Health Check API Response (GPU Enabled) Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/docker-tags.md Example response from the admin health endpoint indicating that GPU acceleration is detected and available after the first AI request. ```json GET /api/v1/admin/health {"ai": {"gpu": true}} ``` -------------------------------- ### GET /api/v1/admin/features/disk-usage Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Retrieves the total disk space occupied by all installed AI models. ```APIDOC ## GET /api/v1/admin/features/disk-usage ### Description Get total disk usage of AI models. ### Method GET ### Endpoint /api/v1/admin/features/disk-usage ### Response #### Success Response (200) - **disk_usage_bytes** (integer) - Total disk usage in bytes ``` -------------------------------- ### Run SnapOtter with Docker and GPU Acceleration Source: https://github.com/snapotter-hq/snapotter/blob/main/README.md This command enables GPU acceleration for tasks like background removal, upscaling, and OCR. It requires an NVIDIA GPU and the NVIDIA Container Toolkit. The system falls back to CPU if no GPU is detected. ```bash docker run -d --name snapotter -p 1349:1349 --gpus all -v snapotter-data:/data snapotter/snapotter:latest ``` -------------------------------- ### Recommended Deployment Resources (CPU AI) Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Defines resource limits for deployments using AI tools on the CPU, balancing performance and hardware needs. ```yaml deploy: resources: limits: cpus: '4' memory: 4G ``` -------------------------------- ### Run SnapOtter with Docker and GPU Acceleration Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/getting-started.md Enable NVIDIA GPU acceleration for enhanced performance on AI-powered image processing tasks. Requires the NVIDIA Container Toolkit. ```bash docker run -d --name SnapOtter -p 1349:1349 --gpus all -v SnapOtter-data:/data snapotter/snapotter:latest ``` -------------------------------- ### Monorepo Build and Test Commands Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Common commands for building, type checking, linting, and running tests across the SnapOtter monorepo. ```bash pnpm build pnpm typecheck pnpm lint pnpm lint:fix pnpm test pnpm test:unit pnpm test:integration pnpm test:e2e pnpm test:coverage ``` -------------------------------- ### GET /api/v1/meme-templates/thumbs/:filename Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Serves a thumbnail version of the specified meme template image. ```APIDOC ## GET /api/v1/meme-templates/thumbs/:filename ### Description Serve template thumbnail. ### Method GET ### Endpoint /api/v1/meme-templates/thumbs/:filename ### Parameters #### Path Parameters - **filename** (string) - Required - The filename of the template thumbnail ### Response #### Success Response (200) - **image/png** (binary) - The template thumbnail image ``` -------------------------------- ### GET /api/v1/meme-templates/fonts/:filename Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Serves a font file used for rendering text on meme templates. ```APIDOC ## GET /api/v1/meme-templates/fonts/:filename ### Description Serve font file used for meme text rendering. ### Method GET ### Endpoint /api/v1/meme-templates/fonts/:filename ### Parameters #### Path Parameters - **filename** (string) - Required - The filename of the font file ### Response #### Success Response (200) - **font/ttf** (binary) - The font file ``` -------------------------------- ### GET /api/v1/meme-templates Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Lists all available meme templates, including information about their text box positions. ```APIDOC ## GET /api/v1/meme-templates ### Description List all available meme templates with text box positions. ### Method GET ### Endpoint /api/v1/meme-templates ### Response #### Success Response (200) - **templates** (array) - List of meme templates with their details ``` -------------------------------- ### Get Image Metadata Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/image-engine.md Use the 'info' tool to retrieve metadata about an image, including dimensions, format, size, and EXIF data. ```json { "width": 1920, "height": 1080, "format": "jpeg", "size": 245678, "channels": 3, "hasAlpha": false, "dpi": 72, "exif": { ... } } ``` -------------------------------- ### Full Deployment Resources (GPU AI) Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Configures resource limits and device reservations for deployments leveraging GPU acceleration for AI tools. ```yaml deploy: resources: limits: cpus: '4' memory: 8G reservations: devices: - driver: nvidia count: all capabilities: [gpu] ``` -------------------------------- ### Docker Bind Mount Configuration with User Permissions Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Demonstrates using a bind mount for data persistence and setting PUID/PGID environment variables to manage host user permissions. ```yaml volumes: - ./SnapOtter-data:/data environment: - PUID=1000 # Your host UID (run: id -u) - PGID=1000 # Your host GID (run: id -g) ``` -------------------------------- ### GET /api/v1/audit-log Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Retrieves a paginated list of audit log entries. This endpoint is restricted to administrators and supports filtering by action type and date range. ```APIDOC ## GET /api/v1/audit-log ### Description Admin-only endpoint for reviewing security-relevant actions. Provides a paginated audit log with optional filters. ### Method GET ### Endpoint /api/v1/audit-log ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number (default: 1) - **limit** (integer) - Optional - Entries per page (default: 50, max: 100) - **action** (string) - Optional - Filter by action type (e.g. `ROLE_CREATED`, `ROLE_DELETED`) - **from** (string) - Optional - Filter entries after this ISO 8601 date - **to** (string) - Optional - Filter entries before this ISO 8601 date ### Response #### Success Response (200) - **audit_log_entries** (array) - List of audit log entries - **pagination** (object) - Pagination details ``` -------------------------------- ### Build Docker Image with BuildKit Cache Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Use BuildKit cache mounts for faster Docker image rebuilds. This command enables BuildKit and then builds the 'snapotter:latest' image. ```bash DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile -t snapotter:latest . ``` -------------------------------- ### Upgrade SnapOtter using Docker Source: https://github.com/snapotter-hq/snapotter/blob/main/.release-notes.md Pull the latest SnapOtter image using Docker. ```bash docker pull snapotter/snapotter:1.17.1 ``` -------------------------------- ### Generate WebP Preview Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Generate a browser-compatible WebP preview for image formats like HEIC, HEIF, or RAW. ```bash POST /api/v1/preview ``` -------------------------------- ### Project Structure Overview Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/architecture.md Illustrates the directory layout of the SnapOtter monorepo, detailing the organization of applications and shared packages. ```tree snapotter/ ├── apps/ │ ├── api/ # Fastify backend │ ├── web/ # React + Vite frontend │ └── docs/ # This VitePress site ├── packages/ │ ├── image-engine/ # Sharp-based image operations │ ├── ai/ # Python AI model bridge │ └── shared/ # Types, constants, i18n └── docker/ # Dockerfile and Compose config ``` -------------------------------- ### Verify Translations Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/translations.md Run these commands to check for missing or mistyped keys, ensure correct formatting, and manually verify strings. ```bash pnpm typecheck # catches missing or mistyped keys pnpm lint # formatting check pnpm dev # manually verify strings appear correctly ``` -------------------------------- ### Perform Single File Tool Operation Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Send a POST request to a tool endpoint with the file and settings as form data. The `settings` parameter should be a JSON string. ```bash curl -X POST http://localhost:1349/api/v1/tools/ \ -H "Authorization: Bearer " \ -F "file=@input.jpg" \ -F 'settings={"width":800,"height":600}' ``` -------------------------------- ### Defining a New Translation Locale Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/translations.md Example of how to define a new locale object, including its code, name, native name, and text direction, for registration within the i18n system. ```typescript { code: "xx", name: "Language Name", nativeName: "Native Name", dir: "ltr" }, ``` -------------------------------- ### Docker Compose for CPU Deployment Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Use this configuration for deploying SnapOtter on a CPU-only system. It sets up persistent storage, environment variables for authentication and limits, and a health check. ```yaml # docker-compose.yml — Copy this file and run: docker compose up -d services: SnapOtter: image: snapotter/snapotter:latest # or ghcr.io/snapotter-hq/snapotter:latest container_name: SnapOtter ports: - "1349:1349" # Web UI + API volumes: - SnapOtter-data:/data # Database, AI models, user files (PERSISTENT) - SnapOtter-workspace:/tmp/workspace # Temp processing files (can be tmpfs) environment: # --- Authentication --- - AUTH_ENABLED=true # Set to false to disable login entirely - DEFAULT_USERNAME=admin # First-run admin username - DEFAULT_PASSWORD=admin # First-run admin password (you'll be forced to change it) # --- Limits (0 = unlimited) --- # - MAX_UPLOAD_SIZE_MB=0 # Per-file upload limit in MB # - MAX_BATCH_SIZE=0 # Max files per batch request # - RATE_LIMIT_PER_MIN=0 # API rate limit (0 = disabled, 100 = recommended for public) # - MAX_USERS=0 # Max user accounts # --- Networking --- # - TRUST_PROXY=true # Trust X-Forwarded-For headers (set false if not behind a proxy) # --- Bind mount permissions --- # - PUID=1000 # Match your host user's UID (run: id -u) # - PGID=1000 # Match your host user's GID (run: id -g) restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:1349/api/v1/health"] interval: 30s timeout: 5s start_period: 60s retries: 3 shm_size: "2gb" # Needed for Python ML shared memory logging: driver: json-file options: max-size: "10m" max-file: "3" volumes: SnapOtter-data: # Named volume — Docker manages permissions automatically SnapOtter-workspace: ``` -------------------------------- ### Roles - Create Custom Role Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Create a new custom role with specified name, description, and permissions. Requires 'users:manage' access. ```bash POST /api/v1/roles ("name", "description", "permissions") ``` -------------------------------- ### Upgrade SnapOtter using Docker Compose Source: https://github.com/snapotter-hq/snapotter/blob/main/.release-notes.md Pull the latest SnapOtter image and restart services using Docker Compose. ```bash docker compose pull && docker compose up -d ``` -------------------------------- ### Build Production Docker Image Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Build the full production Docker image for Snapotter locally. This command creates an image tagged as 'snapotter:latest'. ```bash docker build -f docker/Dockerfile -t snapotter:latest . ``` -------------------------------- ### Settings - Bulk Update Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Bulk update system settings. Accepts a JSON body containing key-value pairs for the settings to be modified. ```bash PUT /api/v1/settings JSON body with key-value pairs ``` -------------------------------- ### Docker Compose Configuration for SnapOtter Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/getting-started.md Set up SnapOtter using Docker Compose, including environment variables for authentication and default user settings. This configuration ensures the service restarts automatically. ```yaml services: SnapOtter: image: snapotter/snapotter:latest # or ghcr.io/snapotter-hq/snapotter:latest ports: - "1349:1349" volumes: - SnapOtter-data:/data environment: - AUTH_ENABLED=true - DEFAULT_USERNAME=admin - DEFAULT_PASSWORD=admin restart: unless-stopped volumes: SnapOtter-data: ``` -------------------------------- ### Copying the English Translation File for a New Language Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/translations.md Instruction for creating a new translation file by copying the reference English file. This is a prerequisite for adding a new language. ```bash cp packages/shared/src/i18n/en.ts packages/shared/src/i18n/XX.ts ``` -------------------------------- ### Batch Processing with a Pipeline Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Upload multiple files and process them using a defined pipeline. The output of each step is the input for the next. ```bash curl -X POST http://localhost:1349/api/v1/pipeline/batch \ -H "Authorization: Bearer " \ -F "files=@a.jpg" \ -F "files=@b.jpg" \ -F 'pipeline={"steps":[{"toolId":"resize","settings":{"width":800}}]}' ``` -------------------------------- ### Check GPU Detection in Logs Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/deployment.md Verify that SnapOtter has successfully detected and is utilizing the NVIDIA GPU. This command displays the last 20 lines of the SnapOtter container logs. ```bash docker logs SnapOtter 2>&1 | head -20 # Look for: [INFO] GPU detected — AI tools will use CUDA acceleration ``` -------------------------------- ### Run SnapOtter from GHCR Docker Registry Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/getting-started.md An alternative Docker command to run SnapOtter, pulling the image from the GHCR registry instead of Docker Hub. The image content is identical. ```bash docker run -d --name SnapOtter -p 1349:1349 -v SnapOtter-data:/data ghcr.io/snapotter-hq/snapotter:latest ``` -------------------------------- ### Create API Key Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Generate a new API key by sending a POST request with a name for the key. The key is returned only once, so store it securely. ```bash curl -X POST http://localhost:1349/api/v1/api-keys \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"name":"my-script"}' ``` -------------------------------- ### Database Migration Commands Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/developer.md Commands to generate database migrations based on schema changes and apply them to the SQLite database. ```bash cd apps/api npx drizzle-kit generate npx drizzle-kit migrate ``` -------------------------------- ### Download Processed File from Workspace Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Download a processed file that was temporarily stored in a workspace. ```bash GET /api/v1/download/:jobId/:filename ``` -------------------------------- ### SnapOtter Docker Compose with GPU Acceleration Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/guide/docker-tags.md Configure SnapOtter in Docker Compose for GPU acceleration by specifying resource reservations for NVIDIA GPUs. This requires Docker Compose v2.3+ and the NVIDIA Container Toolkit. ```yaml services: SnapOtter: image: snapotter/snapotter:latest ports: - "1349:1349" volumes: - SnapOtter-data:/data - SnapOtter-workspace:/tmp/workspace deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu] restart: unless-stopped volumes: SnapOtter-data: SnapOtter-workspace: ``` -------------------------------- ### Login with Session Token Source: https://github.com/snapotter-hq/snapotter/blob/main/apps/docs/api/rest.md Use this snippet to obtain a session token by providing username and password. The token is required for authenticating subsequent requests. ```bash curl -X POST http://localhost:1349/api/auth/login \ -H "Content-Type: application/json" \ -d '{"username":"admin","password":"admin"}' ```