Getting Started
Last updated
Last updated
This quick start guide will help you get a full stack web application running in just a few minutes by leveraging amber’s code generators.
It will take us just 7 steps. Let’s get started!
crystal
and amber
Installing Amber with these package managers also installs Crystal.
Homebrew
MacPorts
Then install Amber (from source)
NOTE: At the time of this writing, v1.4.1 is the current stable release, but you should use the most recent tag in place of that.
Amber works with postgresql
(default), mysql
, or sqlite
.
If you don’t already have one of these installed, please follow the guides provided by each database maintainer:
With all dependencies successfully installed, we can generate a new application with amber new
After the code for the new application is generated, we will cd
into the new directory and execute a shards install
.
The shards install command may take a little while - it has to download all shard dependencies.
With the skeleton application generated, we can generate our first RESTful resource.
The amber generate scaffold
command will help us do this.
Generating the application and the scaffolded resource provides the configuration and migration files needed to set up the database.
amber db
will help us do this, as you will see you can chain the db
commands together.
This will create a new database and run the migration to create a pets
table with the specified columns.
We can use amber watch
to both build the binary application and start the server. Additionally, amber watch
will detect code changes then recompile and restart the application automatically.
The watch
commands will keep observing for file changes within the project and recompiling the application.
You can use these commands to create new awesome applications :-)
If you already have crystal
, amber
, and a database installed, you can .
Instructions for OS X using Homebrew or MacPorts and Debian/Ubuntu are below. See full installation instructions for RedHat & CentOS, ArchLinux & Derivatives, and more complete instructions.
First install crystal (from the ):
You can also install Amber with
Above are the steps for building from source, the dependencies are specific to Ubuntu/Debian. See for other Linux Distributions.
Open any browser and goto You should see a home page load and “Pets” in the nav bar. If you click on the “Pets” link, you should be able to perform all seven RESTful actions for the “pets” resource.
Here is the Quick Start demo app and the source code is available on .