{"title":"Create New App","description":"","section":"guides","version":"v1.5","path":"guides/create-new-app","canonical_url":"https://amberframework.org/docs/v1.5/guides/create-new-app","markdown_url":"https://amberframework.org/docs/v1.5/guides/create-new-app.md","inherited":true,"content_markdown":"# Create New App\n\nBefore we begin, please take a minute to read the [Installation Guide](installation.md). By installing any necessary dependencies beforehand, we’ll be able to get our application up and running smoothly.\n\nAt this point, we should have Crystal and Amber installed. We should also have PostgreSQL and NodeJS installed to build a default application.\n\nTo verify you have Amber installed, run the command `amber -v` in your terminal window:\n\n```bash\n$ amber -v\nAmber CLI (amberframework.org) - vX.Y.Z\n```\n\n## Bootstrap an Application\n\nTo bootstrap your Amber application, run `amber new` with an absolute or relative directory path to the application directory it should create. Assuming that the name of your application is \"weblog\", let's run:\n\n```bash\n$ amber new weblog\n```\n\nAdditionally, the following options may be passed to the above command:\n\n* `-d` This specifies the database driver to use. It defaults to pg, for PostgreSQL.\n* `-t` This specifies the template rendering engine. It defaults to slang, the Slim-inspired templating language.\n\nAmber generates the [directory structure](https://github.com/amberframework/online-docs/tree/77946b0fbe0e43bff1a43e42ac904d10ff436067/guides/getting-started/Installation/directory-structure.md#directory-structure) along with files necessary for the application.\n\nChange your current directory to `weblog`, if that was the path you chose:\n\n```bash\ncd weblog\n```\n\n## Creating the database\n\nAmber makes it easy to interact with your database. Amber supports Postgres, MySql, and Sqlite.\n\nEdit the database setting for your current environment by editing the file:\n\n```text\n{project_name}/config/environments/{current_environment}.yml\n```\n\nAmber looks at the `database_url` key for the default database connection string.\n\n{% hint style=\"info\" %}\nAmber assumes that your PostgreSQL database will have a `postgres` user account with the correct permissions and no password set for this user. If that isn’t the case, update the `database_url` key with the correct database credentials for your environment.\n{% endhint %}\n\nWith your database credentials ready, run the following command in your terminal window:\n\n```bash\namber db create\n```\n\nThis creates your application's Postgres database. It should output:\n\n```bash\nCreated database weblog_development\n```\n\nAnd finally, we’ll start the Amber server:\n\n```bash\namber watch\n```\n\nBy default Amber accepts requests on port 3000. If we point our favorite web browser at [http://localhost:3000](http://localhost:3000), we should see the Amber Framework welcome page.\n\n![Oh, yeah!](https://raw.githubusercontent.com/amberframework/site-assets/master/images/amber-framework-welcome.png)\n\nIf your screen looks like the image above, congratulations!\n\nYou now have a working Amber application. If you don’t see the page above, try accessing it via [http://127.0.0.1:3000](http://127.0.0.1:3000).\n\nLocally, the application is running in a Crystal process. To stop it, we hit ctrl-c once, just as we would terminate the program normally.\n\n{% hint style=\"info\" %}\nThe `amber watch` command watches for any changes in your source files, recompiling automatically. If you don't want this, you can compile and run manually:  \n1. Build the app `shards build -v`  \n2. Run with `./[your_app]`  \n3. Visit [http://127.0.0.1:3000](http://127.0.0.1:3000)\n{% endhint %}"}