{"id":13504990,"url":"https://github.com/vapor/toolbox","last_synced_at":"2025-06-16T04:15:18.468Z","repository":{"id":38360303,"uuid":"58954829","full_name":"vapor/toolbox","owner":"vapor","description":"Simplifies common command line tasks when using Vapor","archived":false,"fork":false,"pushed_at":"2024-04-23T11:35:43.000Z","size":30204,"stargazers_count":277,"open_issues_count":17,"forks_count":84,"subscribers_count":24,"default_branch":"main","last_synced_at":"2024-05-01T11:26:41.369Z","etag":null,"topics":["command-line-tool","server-side-swift","swift","vapor"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vapor.png","metadata":{"funding":{"github":["vapor"],"open_collective":"vapor"},"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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-16T17:59:24.000Z","updated_at":"2024-05-13T13:45:36.609Z","dependencies_parsed_at":"2024-03-03T23:30:54.108Z","dependency_job_id":"c56a0be0-aa91-46a9-b834-80e3d4dab2e6","html_url":"https://github.com/vapor/toolbox","commit_stats":null,"previous_names":[],"tags_count":105,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor%2Ftoolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor%2Ftoolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor%2Ftoolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor%2Ftoolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vapor","download_url":"https://codeload.github.com/vapor/toolbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246254077,"owners_count":20747946,"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":["command-line-tool","server-side-swift","swift","vapor"],"created_at":"2024-08-01T00:00:56.323Z","updated_at":"2025-03-29T22:31:22.956Z","avatar_url":"https://github.com/vapor.png","language":"Swift","funding_links":["https://github.com/sponsors/vapor","https://opencollective.com/vapor"],"categories":["Resources","HarmonyOS"],"sub_categories":["Tools","Windows Manager"],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg \n        src=\"https://user-images.githubusercontent.com/1342803/87364900-cf9e6880-c542-11ea-9cdf-9621a11925e1.png\" \n        height=\"64\" \n        alt=\"Vapor Toolbox\"\n    \u003e\n    \u003cbr\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://docs.vapor.codes/4.0/\"\u003e\u003cimg src=\"https://design.vapor.codes/images/readthedocs.svg\" alt=\"Documentation\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://discord.gg/vapor\"\u003e\u003cimg src=\"https://design.vapor.codes/images/discordchat.svg\" alt=\"Team Chat\"\u003e\u003c/a\u003e\n    \u003ca href=\"LICENSE.txt\"\u003e\u003cimg src=\"https://design.vapor.codes/images/mitlicense.svg\" alt=\"MIT License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/vapor/toolbox/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/vapor/toolbox/test.yml?event=push\u0026style=plastic\u0026logo=github\u0026label=tests\u0026logoColor=%23ccc\" alt=\"CI\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/github/vapor/toolbox\"\u003e\u003cimg src=\"https://img.shields.io/codecov/c/github/vapor/toolbox?style=plastic\u0026logo=codecov\u0026label=codecov\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://swift.org\"\u003e\u003cimg src=\"https://design.vapor.codes/images/swift60up.svg\" alt=\"Swift 6.0\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n🧰 A CLI tool to easily create new Vapor projects.\n\n### Supported Platforms\n\nVapor Toolbox supports macOS 13.0+ and all Linux distributions that Swift 6.0 supports.\n\n### Installation\n\n#### Homebrew\n\nOn macOS and Linux, the Toolbox is distributed via Homebrew. If you do not have Homebrew yet, visit [brew.sh](https://brew.sh/) for install instructions.\n\n```sh\nbrew install vapor\n```\n\nDouble check to ensure that the installation was successful by printing help.\n\n```sh\nvapor --help\n```\n\nYou should see a list of available commands.\n\n#### Makefile\n\nIf you want, you can build the Toolbox from source. View the Toolbox's [releases](https://github.com/vapor/toolbox/releases) on GitHub to find the latest version.\n\n```sh\ngit clone https://github.com/vapor/toolbox.git\ncd toolbox\ngit checkout \u003cdesired version\u003e\nmake install\n```\n\nIf you want to specify a different location, pass the `DEST` variable to the `make install` command.\n\n```sh\nmake install DEST=/usr/local/bin/vapor\n```\n\nIf you don't want to use `sudo`, pass the `SUDO` variable to the `make install` command.\n\n```sh\nmake install SUDO=false\n```\n\nDouble check the installation was successful by printing help.\n\n```sh\nvapor --help\n```\n\nYou should see a list of available commands.\n\n## Overview\n\nThe Vapor Toolbox is a command line tool that helps you create new Vapor projects.\nIt is the easiest way to get started with Vapor.\n\nThe Toolbox only has one subcommand: `new`.\nIt's marked as the default one, so you can omit it when running the Toolbox.\nFor example:\n\n```sh\nvapor new Hello -n\n```\n\nis the same as\n\n```sh\nvapor Hello -n\n```\n\n### Getting Started\n\nTo create a new Vapor project, open a terminal and, replacing `\u003cProjectName\u003e` with the name of your project, run the following command:\n\n```sh\nvapor new \u003cProjectName\u003e\n```\n\nYou will be asked for all the necessary information to create the project.\n\n\u003e [!TIP]\n\u003e If you want to skip the questions, you can pass the `-n` flag to the command to automatically answer \"no\" to all questions.\n\nOnce the command finishes, you will have a new folder in the current directory containing the project. If you want to create the project in a specific folder, you can pass the `--output` flag to the command with the path to the folder.\n\nBy default, a Git repository is initialized in the project folder and a commit is made with the initial project structure.\nIf you don't want to initialize a Git repository, you can pass the `--no-git` flag to the command.\nIf you just want to skip the initial commit, but still want a Git repo, pass the `--no-commit` flag.\n\nTo show help information for the Toolbox, run:\n\n```sh\nvapor --help\n```\n\nYou can also see the [Getting Started](https://docs.vapor.codes/getting-started/hello-world/#new-project) guide to learn more about creating a new project with the Toolbox.\n\n### Custom Templates\n\nThe Toolbox uses templates to create new projects.\nBy default, it uses the official [Vapor template](https://github.com/vapor/template).\n\nYou can also specify a custom template by passing a URL of a Git repository to the `--template` flag.\nBy default, the toolbox uses the `main` branch. If you want to use a different branch, you can use the `--branch` flag.\n\n\u003e [!TIP]\n\u003e Add the `--help` flag to the command, along with the `--template` and optionally the `--branch` and `--manifest` flags, to see all the available options for the custom template.\n\n#### Creating a Custom Template\n\nIf you are creating a custom template and want to dynamically generate the project depending on some variable given to the Toolbox, you have to add to the template a manifest file.\n\nBy default, the Toolbox looks for a YAML file named `manifest.yml` in the root of the template; if it doesn't exist, it then looks for `manifest.json`, also in the root of the template.\nYou can specify a different path to a YAML or JSON file with the `--manifest` flag.\n\nThis file should contain a list of variables that will be asked for during project generation and a list of all template files and folders, which will be processed based on the variables.\n\n```yaml\nname: Custom Vapor Template\nvariables:\n  - name: fluent\n    description: Would you like to use Fluent (ORM)?\n    type: nested\n    variables:\n      ...\n  - name: leaf\n    description: Would you like to use Leaf (templating)?\n    type: bool\nfiles:\n  - file: Package.swift\n    dynamic: true\n  - folder: Sources\n    files:\n      ...\n```\n\n##### Variables\n\nThere are four kinds of variables you can define in the manifest file:\n\n- **Boolean**: the user can answer \"yes\" or \"no\"\n```yaml\n- name: leaf\n  description: Would you like to use Leaf (templating)?\n  type: bool\n```\n\n- **String**: the user can answer with any string\n```yaml\n- name: hello\n  description: What would you like to display on the `/hello` route?\n  type: string\n```\n\n- **Option**: the user can choose one of the options and its associated data will be passed to the template\n```yaml\n- name: db\n  description: Which database would you like to use?\n  type: option\n  options:\n    - name: Postgres (Recommended)\n      data:\n        module: Postgres\n        id: psql\n        version: \"2.8.0\"\n    - name: MySQL\n      data:\n        module: MySQL\n        id: mysql\n        version: \"4.4.0\"\n    - name: SQLite\n      data:\n        module: SQLite\n        id: sqlite\n        version: \"4.6.0\"\n```\n\n- **Nested**: a variable that contains other variables; the value of the nested variable will be a dictionary with the values of the nested variables\n```yaml\n- name: fluent\n  description: Would you like to use Fluent (ORM)?\n  type: nested\n  variables:\n    - name: db\n      ...\n    - name: model\n      description: How would you like to name your model?\n      type: string\n```\n\n##### Files and Folders\n\nYou can specify if some file or folder should be added to the project based on the value of a variable by adding an `if` key.\n\n```yaml\n- folder: Migrations\n  if: fluent\n  files:\n    - CreateTodo.swift\n- folder: Controllers\n  files:\n    - file: TodoController.swift\n      if: fluent\n```\n\nYou can also have files and folders with dynamic names: they must be Mustache templates and will be processed based on the variables.\n\n```yaml\n- folder: AppTests\n  dynamic_name: \"{{name}}Tests\"\n  files:\n    - file: AppTests.swift\n    dynamic_name: \"{{name}}Tests.swift\"\n```\n\nThe content of a file can also be a Mustache template, and if you define it as `dynamic`, it will be processed using the variables.\n\n```yaml\n- file: Package.swift\n  dynamic: true\n```\n\n\u003e [!TIP]\n\u003e You can take a look at the [`manifest.yml` file](https://github.com/vapor/template/blob/main/manifest.yml) of the official Vapor template and [an overly complicated one](Tests/VaporToolboxTests/manifest.yml) we use for testing.\nIt may also be helpful to look at the [manifest's structure](Sources/VaporToolbox/TemplateManifest.swift).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvapor%2Ftoolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvapor%2Ftoolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvapor%2Ftoolbox/lists"}