$ show ctk-hq/ctk
Container Tool Kit (CTK) is a web application that provides a visual editor for Docker Compose and Kubernetes manifest files. Users can create and manage projects by dragging and dropping services, volumes, and networks onto a canvas, editing node configurations through detailed forms, and viewing the resulting YAML/JSON in a synchronized code editor. The backend is built with FastAPI and PostgreSQL, handling project persistence, user authentication (JWT-based), manifest generation (including calling kompose for Kubernetes), and project import from remote YAML URLs. The frontend is a React/TypeScript single-page application using jsPlumb for the interactive canvas, Formik for form management, and Monaco Editor for code editing. The application supports both anonymous and authenticated usage, with features like autosave, visibility toggles, and pagination for project lists.
The LLM identified 4 files worth highlighting for reuse:
Provides the `composeToCanvasGraph` function that parses a Docker Compose object (from YAML or JSON) and maps it to the internal canvas graph representation (nodes, connections, networks). It handles legacy v1 format, short/long syntax for volumes and dependencies, and preserves existing node positions where possible. This is a self-contained utility that demonstrates solid parsing and mapping logic, making it reusable for any project needing to convert a Compose specification into an editable graph.
A collection of utility functions for working with Formik forms, including `pruneObject`, `pruneArray`, `packArrayAsObject`, `packArrayAsStrings`, `extractObjectOrArray`, and `reportErrorsAndSubmit`. These functions handle common patterns like converting arrays of key-value objects to plain objects, trimming empty values, and displaying form validation errors to the user. They are decoupled from business logic and can be reused in any React/Formik project.
Contains `generate_docker_compose_yaml` and `generate_kubernetes_manifest` functions. The Docker Compose generator uses ruamel.yaml to produce properly indented YAML with support for version specifiers and different major versions. The Kubernetes generator calls the `kompose` CLI tool to convert Docker Compose into Kubernetes manifests, then cleans up annotations. This module is self-contained (except for the kompose binary dependency) and could be extracted as a standalone service or library for Docker Compose and Kubernetes YAML generation.
Provides `getInitialValues`, `getFinalValues`, and `validationSchema` for network forms. It maps between the internal `INetworkNodeItem` structure and the form's `IEditNetworkForm` state, handling nested structures like IPAM config, aux addresses, options, and labels. This follows a clean pattern of separating form concerns (initialization, finalization, validation) from UI components, making it reusable for other Docker Compose entity forms (services, volumes).