New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details β†’
Socket
Book a DemoSign in
Socket

snapcube

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snapcube

πŸ“¦ Snapshot, backup, and restore any project β€” binary-safe, fast, and simple CLI.

latest
Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
1
-90%
Maintainers
1
Weekly downloads
Β 
Created
Source

Snapcube

License: MIT npm

πŸ“– 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.

✨ Features

  • πŸ“¦ 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.json is invalid before creation

πŸ“¦ Installation

npm install -g snapcube

Then use it anywhere:

snapcube clone ./my-project

Using Without Installation (npx)

If you don't want to install globally, you can run Snapcube directly:

npx snapcube clone ./my-project

πŸ’‘ Notes for npx usage:

  • On first run, npx downloads 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.json

πŸš€ Usage Examples

1. Clone a Local Project

snapcube clone <directory-path>

Example:

snapcube clone ./my-awesome-project

This will generate:

my-awesome-project.snapcube.json

2. Clone a GitHub Repository

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.

3. Clone a GitLab Repository

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>

πŸ”‘ Clone a Private Repository

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

⚠️ If you try cloning a private repo without --token, Snapcube will throw an error.

πŸ‘‰ How to generate tokens:

GitHub:

GitLab:

  • Go to GitLab Settings β†’ Access Tokens
  • Create token with read_repository scope

4. Recreate a Project

snapcube create <json-file>

Example:

snapcube create my-awesome-project.snapcube.json

The project will be recreated inside a folder named after the original project.

5. Structure-Only Mode

If you only want the directory tree (without file contents, sizes, encodings, etc.), use --structure-only.

snapcube clone ./my-project --structure-only

Example 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.

πŸ“‹ Commands & Flags

Command / OptionDescriptionExample
cloneSave local project structure to JSONsnapcube clone ./my-project
clone-repoSave structure of a remote repo to JSONsnapcube clone-repo github:user/repo@main
createRestore project from JSONsnapcube create my-project.snapcube.json
--ignore-binariesIgnore content of binary files (images, PDFs, videos, etc.)snapcube clone ./my-project --ignore-binaries
--ignore-allIgnore content of all files β€” only structure & metadata savedsnapcube clone ./my-project --ignore-all
--structure-onlySave only the file paths (no metadata/contents)snapcube clone ./my-project --structure-only
--token <token>Provide authentication token for private repossnapcube clone-repo github:user/private@main --token xxx
--helpShow help informationsnapcube --help
--versionShow version numbersnapcube --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.

πŸ“ JSON File Structure

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"
]

🎯 Use Cases

  • πŸ“‹ 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.json for AI-assisted debugging
  • 🧠 LLM Project Analysis – Use --structure-only to let AI quickly identify frameworks, languages, and project setup

βš™οΈ How It Works

Cloning Process

  • 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.json file

Creation Process

  • Validates the .snapcube.json format
  • Creates necessary folders
  • Restores files with their original content (if available)
  • Recreates the exact directory structure

🚫 Ignored by Default

  • 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

🀝 Contributing

  • 🍴 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

πŸ› Issues & Support

πŸ™ Acknowledgments

  • 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

Keywords

cli

FAQs

Package last updated on 28 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts