{"title":"Recipes","description":"","section":"cli","version":"v1.5","path":"cli/recipes","canonical_url":"https://amberframework.org/docs/v1.5/cli/recipes","markdown_url":"https://amberframework.org/docs/v1.5/cli/recipes.md","inherited":true,"content_markdown":"# Recipes\n\n## Recipes\n\nAmber generators can use a recipe to generate your application, and scaffold your application with controllers, models and views. Using a recipe you can get started with an amber application that extends or modifies the standard built in generator or provides additional features. For example you might want an API application that only renders JSON or use React or AngularJS for views.\n\n### Recipe contributors\n\nRecipes are provided by independent contributors in their own GitHub accounts.  To use a recipe you specify the GitHub account name and recipe name in the format _githubaccount/recipe_name_.  \nRecipe creators should add the **amber-recipe** topic to the GitHub repository for the recipe.\n\n### Available recipes\n\nSee the [Amber Recipes](https://github.com/topics/amber-recipe) that are available on GitHub for a list\nof recipes that have been created by recipe contributors. Visit the recipe repository for more information about each recipe.\n\n### Amber New Command with a recipe\n\nAdd a recipe name command line argument to create a new amber application from the recipe.  \nThe recipe name that you use to generate the application is saved so that when you generate controllers, models and views with the scaffold generator the same recipe is used - you don't have to specify the recipe each time.\n\n#### `amber new`\n\n```text\namber new [OPTIONS] NAME\n\nGenerates a new Amber project\n\nArguments:\n  NAME  name/path of project\n\nOptions:\n  -d          Select the database database engine, can be one of: pg | mysql | sqlite\n              (default: pg)\n  --deps      Installs project dependencies, this is the equivalent of running (shards update)\n  -m          Select the model type, can be one of: granite | crecto\n              (default: granite)\n  --no-color  Disable colored output\n  -r          Use a named recipe.  See documentation at  https://docs.amberframework.org/amber/cli/recipes.\n  -t          Selects the template engine language, can be one of: slang | ecr\n              (default: slang)\n  -h, --help  show this help\n```\n\n### Example Usage\n\nUsing `amber new microsecond-blog -r damianham/amber_modular` will generate a skeleton Amber application in `./microsecond-blog` using the _amber_modular_ recipe that was provided by the GitHub user _damianham_.\n\nYou can have a running web application in a matter of minutes:\n\n1. `amber new microsecond-blog -r damianham/amber_modular --deps`\n2. `cd microsecond-blog`\n3. `amber watch`\n\nNow open a web browser for your new amber app at [http://localhost:3000](http://localhost:3000).\n\nFull example in terminal:\n\n```text\n$ amber new microsecond-blog -r damianham/amber_modular\nRendering App microsecond-blog in ./microsecond-blog\nnew       .amber.yml\nnew       .amber_secret_key\nnew       .gitignore\nnew       .travis.yml\nnew       config/application.cr\nnew       config/database.yml\n... [clipped]\nnew       src/views/layouts/_nav.slang\nnew       src/views/layouts/application.slang\nnew       src/microsecond-blog.cr\n$ cd microsecond-blog/\n$ shards install\nUpdating https://github.com/amberframework/amber.git\nUpdating https://github.com/luislavena/radix.git\n... [clipped]\nInstalling garnet_spec (0.1.1)\nInstalling selenium (0.3.0)\n$ amber watch\n02:58:23 Watcher    | (INFO) Watching 22 files (server reload)...\n02:58:23 Watcher    | (INFO) Building project App01...\n02:58:31 Watcher    | (INFO) Terminating app App01...\n02:58:31 Watcher    | (INFO) Starting App01...\n02:58:31 NodeJS     | (INFO) Installing dependencies...\n02:58:31 NodeJS     | (INFO) Watching public directory\n02:58:31 Server     | (INFO) Amber 0.10.0 serving application \"App01\" at http://0.0.0.0:3000\n02:58:31 Server     | (INFO) Server started in development.\n02:58:31 Server     | (INFO) Startup Time 00:00:00.000182000\n02:58:31 Watcher    | Watching 10 client files...\n```\n\n### Amber Generate Command\n\nThe generators in amber are a great way to get an application up and running quickly. In addition, they help keep code consistent and following convention. See the **Generate** option of the **Command Line Tool** for details about the generate command.\n\nOnce an application is generated with a recipe, it will be used by future generate or scaffold commands to maintain consistency with the recipe. For example, an application generated with a \"json-api\" recipe will continue to generate controllers and views according to the \"json-api\" recipe.\n\n### Custom Recipe\n\nWhen a recipe doesn't quite suite your requirements, it's easy to modify. Recipes are application stubs written in [Liquid](https://github.com/TechMagister/liquid.cr).  \nModified recipes can be stored and sourced locally or made available to other Amber users from your own GitHub account.\n\nDownload a recipe that you want to modify, extract it, and use the extracted recipe on the command line. For example:\n\n1. `git clone https://github.com/damianham/amber_modular.git ~/mymodular`\n2. `# modify the recipe in ~/mymodular some way`\n3. `amber new microsecond-blog -r ~/mymodular`\n4. `cd microsecond-blog`\n5. `shards install`\n6. `amber watch`\n\nNow open a web browser at [http://localhost:3000](http://localhost:3000).\n\nIt is important to give the absolute path to the recipe folder as the recipe command line argument to ensure that the recipe can be found when generating subsequent artifacts.\n\n### Contributing your recipe\n\nThe best way to do this is to fork an existing recipe and then modify it.  Visit the GitHub repository of a recipe you want to use as a starting point, e.g. one of the recipes listed above in the **Available recipes** section, and create your own fork.  After you have modified the recipe and pushed your changes you can create apps with your recipe with:\n\n```\namber new myapp -r your_github_name/your_recipe_name\n```\n\nYou can easily contribute your recipe to the Amber community.  By adding the **amber-recipe** topic to your recipe repository on GitHub, it will be added to the list of [Amber Recipes](https://github.com/topics/amber-recipe)."}