Amber Framework
WebsiteBlogGithubDiscord
  • Introduction
  • Getting Started
  • Guides
    • Overview
    • Installation
    • Create New App
    • Directory Structure
    • Configuration
    • Docker
    • Controllers
      • Sessions
      • Request & Response Objects
      • Halt!
      • Respond With
      • Params
      • Cookies
      • Filters
      • Flash
      • Redirection
      • CSRF
    • Views
      • Basic View Helpers
      • Form Builder
    • Models
      • Granite
        • Granite's README
        • Migrations
        • Validations
        • Callbacks
        • Associations
        • Querying
        • Bulk Insertions
      • Jennifer
        • Jennifer Docs
        • Migrations
        • Models
    • Routing
      • Pipelines
      • Routes
    • Websockets
      • Channels
      • Sockets
      • JavaScript Client
    • Mailers
    • Testing
      • System Tests
  • Deployment
    • Manual Deploy
    • Digital Ocean
    • Heroku
    • Dokku
  • CLI
    • New
    • Recipes
    • Plugins
    • Generate
    • Database
    • Watch
    • Routes
    • Exec
    • Encrypt
  • Examples
    • Amber Auth
    • Crystal Debug
    • Minimal Configuration
  • Cookbook
    • From Scratch
    • Hello World
    • CORS
    • File Download
    • File Upload
    • Cookies
    • Authenticate
    • JSON API
    • JSON Mapping
    • WebSocket Chat
  • Troubleshooting
  • In Production
  • Contributing
  • Code of Conduct
  • HAVE A QUESTION?
    • Join the Discord
    • Follow on Twitter
    • Submit an issue
Powered by GitBook
On this page
  • amber new
  • Example Usage
  1. CLI

New

amber new

This is the first command that you will run when generating a new Amber application. It creates a new Amber application with a default directory structure and configuration setting at the path you specify.

An .amber.yml configuration file is generated a long with the default application directory structure. This stores some metadata for the Amber CLI to make use of for generating migrations, scaffolding templates, and more.

amber new [OPTIONS] NAME

Generates a new Amber project

Arguments:
  NAME  name/path of project

Options:
  -d                Select the database database engine, can be one of: pg | mysql | sqlite
                    (default: pg)
  --minimal         Does not install npm dependencies
  --no-color        Disable colored output
  --no-deps         Does not install dependencies, this avoids running shards update
  -r                Use a named recipe.  See documentation at  https://docs.amberframework.org/amber/cli/recipes.
  -t                Selects the template engine language, can be one of: slang | ecr
                    (default: slang)
  -y, --assume-yes  Assume yes to disable interactive mode
  -h, --help        show this help

See the Recipes option of the Command Line Tool for information about using recipes to generate applications.

Example Usage

Using amber new microsecond-blog will generate a skeleton Amber application in ./microsecond-blog. You can have a running web application in a matter of minutes:

amber new microsecond-blog -d sqlite
cd microsecond-blog
amber watch
open http://localhost:3000

Full example in terminal:

$ amber new microsecond-blog
Rendering App microsecond-blog in ./microsecond-blog
new       .amber.yml
new       .amber_secret_key
new       .gitignore
new       .travis.yml
new       config/application.cr
new       config/database.yml
... [clipped]
new       src/views/layouts/_nav.slang
new       src/views/layouts/application.slang
new       src/microsecond-blog.cr
$ cd microsecond-blog/
$ shards install
Updating https://github.com/amberframework/amber.git
Updating https://github.com/luislavena/radix.git
... [clipped]
Installing garnet_spec (0.1.1)
$ amber watch        
02:58:23 Watcher    | (INFO) Watching 22 files (server reload)...
02:58:23 Watcher    | (INFO) Building project microsecond-blog...
02:58:31 Watcher    | (INFO) Terminating app microsecond-blog...
02:58:31 Watcher    | (INFO) Starting microsecond-blog...
02:58:31 Server     | (INFO) Amber 0.7.2 serving application "microsecond-blog" at http://0.0.0.0:3000
02:58:31 Server     | (INFO) Server started in development.
02:58:31 Server     | (INFO) Startup Time 00:00:00.000182000
02:58:31 Watcher    | Watching 10 client files...
PreviousCLINextRecipes

Last updated 2 years ago