Getting Started
Scaffoldrite helps you define, enforce, and generate your project structure in minutes. This guide will get you up and running.
1. Install Scaffoldrite
Install globally using npm:
npm install -g scaffoldriteYou can then use either:
sr # Short command (recommended)
scaffoldrite # Full nameBoth commands behave the same—use whichever fits your workflow.
2. Initialize Your Project
Create your project blueprint:
sr initThis generates the .scaffoldrite/ folder with:
structure.sr– your project’s architectural blueprint.scaffoldignore– files and folders to ignoreproject.json– project metadata
3. Define Your Structure
Edit .scaffoldrite/structure.sr to define your files and folders:
folder src {
folder components {
file Button.tsx
file Header.tsx
}
folder utils {
file helpers.ts
}
file index.ts
}
constraints {
mustContain src index.ts
maxFiles src/components 10
}Key Points:
- Literal names: Scaffoldrite creates exactly what you declare.
- Constraints: Enforce rules like max files, required files, or naming patterns.
4. Generate Your Structure
Apply your blueprint to the filesystem:
sr generate .Your project is now structured exactly as defined.
Tips:
- Use
--dry-runto preview changes without writing files. - Use
--copyto preserve file contents when generating to a different directory.
sr generate ./output --copy5. Validate Your Structure
Ensure everything is in sync:
sr validate- Detect missing, extra, or misaligned files
- Fail on violations in CI/CD pipelines
- Allow extras during migration with
--allow-extra:
sr validate --allow-extra README.md .env🎯 Recommended Workflow
# Initialize project
sr init
# Define structure
# Edit structure.sr
# Generate skeleton
sr generate .
# Validate in CI/CD
sr validateScaffoldrite ensures your project structure is predictable, enforceable, and maintainable from day one.
Next: The Structure Language