{"id":13875910,"url":"https://github.com/rusty-ferris-club/backpack","last_synced_at":"2025-07-29T10:41:10.292Z","repository":{"id":44470634,"uuid":"512713430","full_name":"rusty-ferris-club/backpack","owner":"rusty-ferris-club","description":"🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀","archived":false,"fork":false,"pushed_at":"2024-05-02T14:41:39.000Z","size":6113,"stargazers_count":57,"open_issues_count":4,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T04:26:07.818Z","etag":null,"topics":["github","good-first-issue","javascript","rust","rust-lang","starter","template","templates","tools"],"latest_commit_sha":null,"homepage":"https://getbackpack.dev","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusty-ferris-club.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-11T10:34:55.000Z","updated_at":"2025-03-30T08:02:49.000Z","dependencies_parsed_at":"2023-12-27T00:22:57.440Z","dependency_job_id":"a2b2daa1-7f33-490f-98a8-4e5697fb7bb6","html_url":"https://github.com/rusty-ferris-club/backpack","commit_stats":{"total_commits":50,"total_committers":1,"mean_commits":50.0,"dds":0.0,"last_synced_commit":"da21b651e5b27843a8e473976797fc07fad695d4"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty-ferris-club%2Fbackpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty-ferris-club%2Fbackpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty-ferris-club%2Fbackpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty-ferris-club%2Fbackpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusty-ferris-club","download_url":"https://codeload.github.com/rusty-ferris-club/backpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251769307,"owners_count":21640883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","good-first-issue","javascript","rust","rust-lang","starter","template","templates","tools"],"created_at":"2024-08-06T06:00:49.564Z","updated_at":"2025-04-30T19:31:14.525Z","avatar_url":"https://github.com/rusty-ferris-club.png","language":"Rust","funding_links":[],"categories":["Rust","tools"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n   \u003cimg src=\"media/backpack-light.svg\" width=\"160\"/\u003e\n   \u003cbr/\u003e\n   Backpack\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eA tool to curate and automate your starter projects\u003c/h4\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/rusty-ferris-club/backpack/actions/workflows/build.yml/badge.svg\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#key-features\"\u003eKey Features\u003c/a\u003e •\n  \u003ca href=\"#how-to-use\"\u003eHow To Use\u003c/a\u003e •\n  \u003ca href=\"#download\"\u003eDownload\u003c/a\u003e •\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n![screenshot](media/bpnew.gif)\n\n## Key Features\n\n* **Generate from full project, subfolders, branches, tags :stars:** - use complete, versions, or any parts of repos you like\n* **Shortcuts :rocket:** - create a personal or team  list of your projects with global and local shortcuts\n* **Variable replacements** - replace variables in content and path (like cookiecutter)     \n* **Automated setup steps :robot:** - run `yarn install` or `make` automatically after a clone\n* **Interactive inputs** - define steps to take inputs and select options in YAML while generating a new project\n*  **Fast \u0026 efficient :running:** - no history or `.git` folder, local caching of content by default, supporting `git` and `tar.gz` download\n\n## How to Use\n\n\n\n```\n$ bp --help\nbackpack 2.0.0\nSet up projects and download files from existing repos\n\nUSAGE:\n    bp [OPTIONS] [ARGS] [SUBCOMMAND]\n\nARGS:\n    \u003cshortlink\u003e    A full or short link to a repo (e.g. org/user)\n    \u003cdest\u003e         Target folder\n\nOPTIONS:\n    -c, --config \u003cconfig\u003e    Use a specified configuration file\n    -f, --fetch              Fetch and apply into the current folder\n    -g, --git                Clone with git\n    -h, --help               Print help information\n    -n, --no-cache           Fetch resources without using the cache\n    -V, --version            Print version information\n    -w, --overwrite          Always overwrite target file(s)\n\nSUBCOMMANDS:\n    add       Save a repo as a project\n    cache     Cache handling\n    config    Create a personal configuration\n    help      Print this message or the help of the given subcommand(s)\n```\n\nTo download and generate a new project, you can use any repo:\n\n```\n$ bp your/repo\n```\n\n## Download\n\nFor macOS:\n\n```\nbrew tap rusty-ferris-club/tap \u0026\u0026 brew install backpack\n```\n\nOtherwise, grab a release from [releases](https://github.com/rusty-ferris-club/backpack/releases) and run `bp --help`:\n\n\n## :hammer: Create starters from ordinary repos\n\nGo to your ordinary repo and follow the `add` wizard:\n\n```\n$ cd your-repo\n$ bp add\n```\n\nNote that if a repo contains a `.backpack-project.yaml` file, it will be automatically used. A `.backpack-project.yaml` file is a way for the repo author to give instructions for how to make a template out of their project, here's an example:\n\n```yaml\nproject:\n  shortlink: kriasoft/react-starter-kit\n  actions:\n  - name: \"name of file\"\n    hook: before\n    interaction:\n      kind: input\n      prompt: name of your app\n      out: file_name\n  swaps:\n  - key: README.md\n    val_template: \"{{file_name}}\"\n    path: .*\n  - key: tsconfig.json\n    val: ts-config.json\n```\n\nYou create this file and format in your own repos to make them _backpack friendly_.\n\n## :hammer: Create starters manually\n\nCreate a `backpack.yaml`:\n\n```\n$ bp config --init\nwrote: /Users/jondot/.backpack/backpack.yaml.\n```\n\nConfigure a starter:\n\n```yaml\nprojects:\n  rust-starter: \n    shortlink: jondot/rust-starter  # you can use any custom prefix here too\n    # is_git: true # force fetch from ssh\n    actions:\n    - name: run an initial build\n      run: cargo build\n```\n\nAnd now run:\n\n```\n$ bp rust-starter\n```\n\nTo personalize a project you can take input  and replace content:\n\n```yaml\nprojects:\n  rust-starter: \n    shortlink: jondot/rust-starter  # you can use any custom prefix here too\n    actions:\n    - name: get app name\n      hook: before\n      interaction:\n        kind: input\n        prompt: name of your app\n        out: app_name\n    swaps:\n    - key: APP_NAME\n      val_template: \"Welcome to {{app_name}}\"\n      path: \"README.md\"\n```\n\nExample of a fully personalize config in my `~/.backpack/backpack.yaml`, with minimal prompts (generating from [rust-starter](https://github.com/rusty-ferris-club/rust-starter)):\n\n\u003cdetails\u003e\n  \u003csummary\u003eShow example\u003c/summary\u003e\n\n```yaml\nprojects:\n  jondot-rs:\n    shortlink: rusty-ferris-club/rust-starter\n    actions:\n      - name: project\n        interaction:\n          kind: input\n          prompt: project name (e.g. newtool)\n          out: project\n        hook: before\n      - name: description\n        interaction:\n          kind: input\n          prompt: description (e.g. one liner)\n          out: description\n        hook: before\n    swaps:\n      - key: __V_PROJECT_NAME__\n        val_template: \"{{project}}\"\n        path: \".*\"\n      - key: __V_REPO_NAME__\n        val_template: \"jondot/{{project}}\"\n        path: \".*\"\n      - key: __V_REPO_URL__\n        val_template: \"https://github.com/jondot/{{project}}\"\n        path: \".*\"\n      - key: __V_PROJECT_FORMULA__\n        val_template: \"{{project | capitalize}}\"\n        path: \".*\"\n      - key: __V_TAP_NAME__\n        val: \"jondot/homebrew-tap\"\n        path: \".*\"\n      - key: __V_BIN_NAME__\n        val_template: \"{{project}}\"\n        path: \".*\"\n      - key: __v_bin_name__\n        val_template: \"{{project}}\"\n        path: \".*\"\n      - key: __V_AUTHOR__\n        val: \"dotan@example.com\"\n        path: \".*\"\n      - key: __V_DESCRIPTION__\n        val_template: \"{{description}}\"\n        path: \".*\"\n```\n\n\u003c/details\u003e\n\n## :raising_hand_woman:     Configure user projects\n\n`bp` (with no args) will automatically display a list of projects if configure those.\n\nProjects define repos and custom actions and / or swaps you want to attach to each.\n\nGenerate a **global user** configuration file:\n\n```\n$ bp config --init --global\n```\n\nEdit the file:\n\n```\n$ vim ~/.backpack/backpack.yaml\n```\n\nAdd to the `projects` section:\n\n```yaml\nprojects:\n  rust-starter: \n    shortlink: rusty-ferris-club/rust-starter\n```\n\n\n## :rotating_light:     Run actions and user input\n\nYou can add custom actions to a project:\n\n```yaml\nprojects:\n  rust:\n    shortlink: rusty-ferris-club/rust-starter\n    actions:\n    - name: 🚨 ====== init git ===========\n      run: git init . \u0026\u0026 git add . \u0026\u0026 git commit -am \"first commit\"\n    - name: 🚨 ====== first build ========\n      run: cargo build\n```\n\nYou can also add inputs, selections and confirmation, **including variable capture**.\n\n\u003cdetails\u003e\u003csummary\u003eShow full example\u003c/summary\u003e\n\n```yaml\nactions:\n  - name: \"Install deps\"\n    interaction:\n      kind: confirm\n      prompt: \"are you sure?\"\n    run: yarn install\n    ignore_exit: true\n  - name: select a DB\n    interaction:\n      kind: select\n      prompt: select a database\n      options:\n      - sqlite\n      - postgres\n      - mysql\n      default: sqlite\n      out: db\n  - name: \"generate a model\"\n    interaction:\n      kind: input\n      prompt: name of your app?\n      out: name\n    run: yarn run init-app {{db}} {{name}}\n```\n\nActions have a `before` and `after` hook, which make them run **before** copying content (e.g. user input), and **after** the content have being copied (e.g. installing dependencies).\n\nBy default actions are hooked to the `after` event, but you can change it:\n\n```yaml\n- name: name\n  hook: before\n  interaction:\n    kind: input\n    prompt: name of your project\n    out: project_name\n```\n\n\u003c/details\u003e\n\n## :bulb:  Replace content\n\nDefine **keys to swap**, where a key can be anything.\n\n\n* Swaps can happen both in content or path.\n* You can limit to a path with a regex\n* You can use a `val_template` which pulls a variable from those you gathered while running actions. You also have a set of inflections such as `{{project_name | kebab_case}}`\n\n\u003cdetails\u003e\u003csummary\u003eShow example\u003c/summary\u003e\n\n```yaml\nprojects:\n  my-project:\n    shortlink: kriasoft/react-starter-kit\n    swaps:\n    - key: MIT\n      val: Apache 2.0\n      path: README.md\n    - key: AUTHOR_NAME\n      val_template: Dr. {{user_name}}\n      path: src/.*\n```\n\u003c/details\u003e\n\n# FAQ\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\nHow can I set up an enterprise / hosted git, or use Gitlab or others?\n\u003c/b\u003e\u003c/summary\u003e\nYou can use custom git vendors.\n\nStart by generating a  configuration file:\n\n```\n$ bp config --init\n```\n\nExample: configure a Github Enterprise instance:\n\n```yaml\nvendors:\n  custom:\n    ghe: # \u003c--- this prefix is yours\n      kind: github\n      base: enterprise-github.acme.org\n             # `---- it will point here now\n```\n\nAnd now, you can use the `ghe:` prefix for your shortlinks:\n\n```\n$ bp ghe:user/repo\n```\n\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWhat's the difference between `bp` and `bp -f`?\u003c/b\u003e\u003c/summary\u003e\n\n```\n$ bp kriasoft/react-starter-kit my-react-project\n```\n\n* Create **a new project**  into `my-react-project`   \n* Resolves to [https://github.com/kriasoft/react-starter-kit](https://github.com/kriasoft/react-starter-kit)     \n* Finds the default branch, downloads it and caches locally. Next time you run, it'll be much faster.    \n\n\n\n\n```\n$ bp -f kriasoft/react-starter-kit/-/.github\n```\n\nLet's say you really like how `react-starter-kit` configured its Github Action, and you'd like to copy that to your **existing project**. You can do this:\n\n* Use `/-/` to access a subfolder   \n* Use `-f` to overlay files onto your current working directory    \n\n\u003c/details\u003e\n\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCan I generate a project without typing the name of the repo?\u003c/b\u003e\u003c/summary\u003e\n\n\n```\n$ bp\n```\n\nAnd follow the interactive menu, which will let you:\n\n* Pick a project, if you have any configured\n* Input a shortlink\n* Input a destination or pick an auto generated one\n\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWhat's a shortlink?\u003c/b\u003e\u003c/summary\u003e\n\nA shortlink is a pointer to a Git repo which looks like this:\n\n![shortlink](media/shortlink.png)\n\nAny one of these is a legal shortlink:\n\n```\nuser/repo -\u003e resolves to https://github.com/user/repo\ngl:user/repo -\u003e resolves to https://gitlab.org/user/repo\nuser/repo/-/subfolder -\u003e takes only 'subfolder'\nuser/repo#wip -\u003e takes the 'wip' branch\n```\n\n:white_check_mark: Bare minimum is `user/repo` which defaults to Github.  \n:white_check_mark: You can set up a custom prefix if you want.  \n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eIs it possible to use backpack only on parts of source repos?\u003c/b\u003e\u003c/summary\u003e\n\nYes, use the folder notation `/-/`:\n\n```\n$ bp user/repo/-/path/to/folder dest-folder\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCan I generate from a given branch?\u003c/b\u003e\n\u003c/summary\u003e\n\nBranches or tags can be used with the `#branch` specifier.\n\n```\n$ bp kriasoft/react-starter-kit#feature/redux my-starter\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e Can I use backpack on empty or populated directories?\u003c/b\u003e\u003c/summary\u003e\n\nYes. Use `-f` to grab content and apply it to an existing empty or populated directories:\n\n```\n$ cd your-directory\n$ bp -f user/repo\n```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eCan backpack work on self hosted Git servers?\u003c/b\u003e\u003c/summary\u003e\n\nIf it's one of the supported vendors, you can create a custom prefix configuration:\n\n```yaml\nvendors:\n  custom:\n    gh:\n      kind: github\n      base: github.acme.com/my-org\n```\n\nNote that in addition to the custom hosted `github.acme.com` server, we also specified a default org `my-org` above, so it saves a bit of typing. Then you can run:\n\n```\n$ bp gh:my-repo my-repo\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eCan backpack infer the name of the destination folder and save me some more typing?\u003c/b\u003e\u003c/summary\u003e\n\nWhere it's non ambiguous, yes. For example, when you specify a subfolder:\n\n```\n$ bp user/repo/-/my-folder\n```\n\nWill grab just `my-folder` from `user/repo` and create in a destinaton folder called `my-folder`.\n\nIf there's a inference strategy you think will work, open an issue or submit a PR.\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eHow to install backpack globally?\u003c/b\u003e\u003c/summary\u003e\n\nWith `Homebrew` it happens automatically. Otherwise, download a binary and add its containing folder to your `PATH` in the way that's supported by your OS.\n\nWe're accepting PRs for other OS specific installers.\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eAny requirements or dependencies for backpack?\u003c/b\u003e\u003c/summary\u003e\n\nJust `git` to exist (and we will eventually remove that dependency). Other than that the `bp` binary is self contained and has no dependencies.\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eCan I get a single file?\u003c/b\u003e\u003c/summary\u003e\n\nYes. `backpack` will act differently when the source is a file, it will do what you're expecting it to.\n\nFor example, this will give you a `.gitignore` file from another project:\n\n```\n$ cd my-project\n$ bp -f rusty-ferris-club/backpack/-/.gitignore\n$ tree\n.gitignore\n```\n\nThis will copy just a single workflow file, but also the entire hierarchy of folders:\n\n```\n$ cd my-project\n$ bp -f rusty-ferris-club/backpack/-/.github/workflows/build.yml\n$ tree\n.github/\n  workflows/\n    build.yml\n```\n\nOr in other words:\n\n1. When you specify a target file verbatim, it will use that\n2. If you're not specifying a target file, the destination file and folder path will be copied from the source.\n\u003c/details\u003e\n\n# Contributing\n\nWe are accepting PRs. Feel free to [submit PRs](https://github.com/rusty-ferris-club/backpack/pulls).\n\nTo all [Contributors](https://github.com/rusty-ferris-club/backpack/graphs/contributors) - you make this happen, thanks!\n\n# License\n\nCopyright (c) 2022 [@jondot](http://twitter.com/jondot). See [LICENSE](LICENSE.txt) for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty-ferris-club%2Fbackpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusty-ferris-club%2Fbackpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty-ferris-club%2Fbackpack/lists"}