π Full Documentation β https://snapcube.netlify.app
Clone and recreate complete project structures in seconds! π
Snapcube is a lightweight CLI tool that snapshots your project's entire directory tree (including or excluding file contents) into a single JSON file β and recreates it anywhere instantly. Perfect for templates, backups, AI-assisted reviews, and team sharing.
- π¦ Local Project Cloning β Save your project's structure and contents into JSON
- π GitHub Repo Cloning β Fetch any public GitHub repository directly into JSON (no manual download needed)
- π¦ GitLab Repo Cloning β Fetch GitLab repositories with full support for public and private repos
- π Private Repo Cloning β Clone private GitHub/GitLab repositories by passing a Personal Access Token (
--token) - π Project Creation β Rebuild projects exactly from saved JSON
- π« Smart Filtering β Skips unnecessary directories like
node_modules - π Recursive Scanning β Handles deeply nested folder structures
- π Content Control β Choose to include all, only non-binary, or no file contents
- π Structure-Only Mode β Return only an array of file paths (no metadata/contents) β lightweight for AI/LLM project analysis
- β‘ Fast & Efficient β Minimal disk and memory overhead
- β
Validation β Detects and warns if a
.snapcube.jsonis invalid before creation
npm install -g snapcubeThen use it anywhere:
snapcube clone ./my-projectIf you don't want to install globally, you can run Snapcube directly:
npx snapcube clone ./my-projectπ‘ Notes for npx usage:
- On first run,
npxdownloads the package temporarily. - You must have Node.js installed (version 18+ recommended).
- If you get
command not found, try again β sometimes the first run only fetches dependencies.
Example workflow with npx:
# Clone a project structure without binary contents
npx snapcube clone ./my-project --ignore-binaries
# Restore it later
npx snapcube create my-project.snapcube.jsonsnapcube clone <directory-path>Example:
snapcube clone ./my-awesome-projectThis will generate:
my-awesome-project.snapcube.json
snapcube clone-repo github:<username/repo>@<branch>Examples:
# Clone Snapcube repo itself (main branch)
snapcube clone-repo github:tanmayvaij/snapcube@main
# Clone without binary file contents
snapcube clone-repo github:tanmayvaij/artistly@main --ignore-binaries
# Clone only structure (no file contents)
snapcube clone-repo github:tanmayvaij/artistly@main --ignore-allπ Generates {username}_{repo-name}.snapcube.json.
snapcube clone-repo gitlab:<username/repo>@<branch>Examples:
# Clone a GitLab repo
snapcube clone-repo gitlab:username/my-project@main
# Clone with authentication token
snapcube clone-repo gitlab:username/private-project@main --token <your_gitlab_token>Private repositories require authentication with a Personal Access Token.
snapcube clone-repo github:username/private-repo@main --token <your_github_token>
snapcube clone-repo gitlab:username/private-repo@main --token <your_gitlab_token>Examples:
# Clone a private GitHub repo fully
snapcube clone-repo github:myorg/secret-project@main --token ghp_xxx123abc
# Clone private GitLab repo but skip binary files
snapcube clone-repo gitlab:myorg/secret-project@main --ignore-binaries --token glpat_xxx123abc--token, Snapcube will throw an error.
π How to generate tokens:
GitHub:
- Go to GitHub Settings β Developer Settings β Personal Access Tokens.
- Click Generate new token β Choose classic token.
- Select scopes:
repo(to access private repos)
GitLab:
- Go to GitLab Settings β Access Tokens
- Create token with
read_repositoryscope
snapcube create <json-file>Example:
snapcube create my-awesome-project.snapcube.jsonThe project will be recreated inside a folder named after the original project.
If you only want the directory tree (without file contents, sizes, encodings, etc.), use --structure-only.
snapcube clone ./my-project --structure-onlyExample Output:
[
"my-project/package.json",
"my-project/src/index.js",
"my-project/src/App.jsx",
"my-project/public/index.html"
]This is extremely useful for AI/LLM project understanding, lightweight snapshots, or tech stack analysis.
| Command / Option | Description | Example |
|---|---|---|
clone |
Save local project structure to JSON | snapcube clone ./my-project |
clone-repo |
Save structure of a remote repo to JSON | snapcube clone-repo github:user/repo@main |
create |
Restore project from JSON | snapcube create my-project.snapcube.json |
--ignore-binaries |
Ignore content of binary files (images, PDFs, videos, etc.) | snapcube clone ./my-project --ignore-binaries |
--ignore-all |
Ignore content of all files β only structure & metadata saved | snapcube clone ./my-project --ignore-all |
--structure-only |
Save only the file paths (no metadata/contents) | snapcube clone ./my-project --structure-only |
--token <token> |
Provide authentication token for private repos | snapcube clone-repo github:user/private@main --token xxx |
--help |
Show help information | snapcube --help |
--version |
Show version number | snapcube --version |
π‘ Tip: If both --ignore-all and --ignore-binaries are provided, --ignore-all takes priority.
π‘ Note: --structure-only overrides everything else and just outputs an array of file paths.
Example output:
[
{
"fileName": "package.json",
"filePath": "my-awesome-project",
"content": "{\n \"name\": \"my-project\"...\n}",
"isBinary": false,
"encoding": "utf-8"
},
{
"fileName": "logo.png",
"filePath": "my-awesome-project/assets",
"content": null,
"isBinary": true,
"encoding": "base64"
}
]π Structure-only mode simplifies this to just file paths:
[
"my-awesome-project/package.json",
"my-awesome-project/assets/logo.png"
]- π Project Templates β Distribute starter kits instantly
- π Backup & Restore β Keep lightweight project backups
- π Clone Remote Repos to JSON β Store snapshots for later use
- π Private Repo Snapshots β Archive or share internal projects securely
- π€ Collaboration β Share codebases without using Git
- π Education β Distribute coding examples & tutorials
- π€ AI Code Review β Send
.snapcube.jsonfor AI-assisted debugging - π§ LLM Project Analysis β Use
--structure-onlyto let AI quickly identify frameworks, languages, and project setup
- Scans the target directory or remote repo recursively
- Skips ignored folders (
node_modules,.git, etc.) - Reads file content (Base64 for binary, UTF-8 for text) unless ignored
- Saves everything to a
.snapcube.jsonfile
- Validates the
.snapcube.jsonformat - Creates necessary folders
- Restores files with their original content (if available)
- Recreates the exact directory structure
node_modules/.git/and hidden directories.next/,dist/,out/, and build output folders__pycache__/,venv/,vender/- Temporary files like
.DS_Store,thumbs.db, and cache directories
- π΄ Fork the repo
- π± Create a branch:
git checkout -b feature/AmazingFeature - πΎ Commit changes:
git commit -m "Add some AmazingFeature" - π€ Push:
git push origin feature/AmazingFeature - π Open a Pull Request
- π Report a Bug
- π‘ Request a Feature
- π§ Email: [email protected]
- Built with β€οΈ using Node.js + Commander.js
- Inspired by the need for quick project structure sharing
- Thanks to all contributors and early adopters
β If you like Snapcube, star the repo to support development!
Made with π by Tanmay Vaij