Template Project Structure
Understanding the structure of a CyanPrint template project
Template Project Structure
A CyanPrint template is organized as a structured project with specific files and directories.
Standard Structure
Directory Details
cyan/
Contains all template logic and SDK dependencies.
cyan/index.ts
The entry point for template logic:
import { StartTemplateWithLambda, IInquirer, IDeterminism, GlobType } from '@atomicloud/cyan-sdk';StartTemplateWithLambda(async (i: IInquirer, d: IDeterminism) => {// i: IInquirer - ask questions// d: IDeterminism - get deterministic valuesreturn {processors: [/* ... */],plugins: [/* ... */]};});
template/
Source files that will be processed and output to the user's project (located at root level, sibling to cyan/):
Use GlobType.Template for text files with variable substitution, and GlobType.Copy for binary files that should be copied as-is.
cyan.yaml
Template metadata:
username: myorgname: my-templatedescription: A description of the templateproject: https://github.com/myorg/my-templatesource: https://github.com/myorg/my-templatetags: []readme: cyan/README.mdprocessors: []plugins: []templates: []
cyan/package.json
SDK dependencies (located inside cyan/ directory):
{"name": "template","module": "index.ts","type": "module","devDependencies": {"bun-types": "latest"},"peerDependencies": {"typescript": "^5.0.0"},"dependencies": {"@atomicloud/cyan-sdk": "latest"}}
Dockerfiles
cyan/Dockerfile
Builds the template execution environment (located inside cyan/ directory):
FROM oven/bun:1.1.31LABEL cyanprint.dev=trueWORKDIR /app# Install dependenciesCOPY package.json .COPY bun.lockb .RUN bun install# Copy template codeCOPY . .# Run templateCMD ["bun", "run", "index.ts"]
blob.Dockerfile
Stores template files for efficient transfer (located at root level). Uses a multi-stage build to create a compressed archive:
FROM alpine:3.21 as base# hadolint ignore=DL3018,DL3019RUN apk add tarFROM base as buildWORKDIR /srcCOPY . .RUN rm -rf cyan && mkdir -p /cyanprint/artifact && tar -czvf /cyanprint/artifact/cyan.tar.gz /src/FROM baseLABEL cyanprint.dev=trueCOPY --from=build /cyanprint/artifact/cyan.tar.gz /cyanprint/artifact/cyan.tar.gzWORKDIR /workspaceCMD ["tar", "-xzf", "/cyanprint/artifact/cyan.tar.gz", "-C", "/workspace/cyanprint", "--strip-components=1"]
File Organization Patterns
These are recommended patterns for organizing template files.
By Type
Organize by file type:
template/├── docs/ # Markdown documentation├── src/ # Source code├── config/ # Configuration files└── static/ # Binary assets
By Feature
Organize by feature for conditional inclusion:
template/├── base/ # Always included├── typescript/ # TypeScript support├── docker/ # Docker configuration├── testing/ # Test setup└── ci/ # CI/CD configurations├── github/└── gitlab/
Generated Output
When users run cyanprint create, the output directory contains:
my-project/├── .cyan_state.yaml # Metadata for updates├── README.md├── package.json└── src/└── index.ts
The .cyan_state.yaml file stores:
- Active template configuration
- History of template applications
- User answers for reproducibility
- Deterministic states for consistent regeneration
Related
- cyan.yaml Reference - Configuration format
- Dockerfiles Reference - Docker configuration
- SDK Overview - SDK documentation