# Installation

### Prerequisites

You will need:

* [a paid subscription](https://petal.build/pro) to Petal Pro (or be part of a team with a paid subscription)
* this guide is written from the point of view of a Mac. However, it shouldn't be hard to find the equivalents for Linux or Windows

### Quick install instructions

If you just want to see something running without configuring anything:

1. Download the [latest release](https://petal.build/downloads)
2. Run `mix setup`&#x20;
3. Run `mix phx.server`

You can now sign in as admin:

* Email: `admin@example.com`&#x20;
* Password: `password`

Or a normal user:

* Email: `user@example.com`
* Password: `password`

### Comprehensive install instructions

#### 1. Download and unzip a release

We recommend downloading the latest version from a proper "Release" (either from [Github](https://github.com/petalframework/petal_pro/releases) or via a Project).&#x20;

To download via a project you first need to go to the [projects page](https://petal.build/pro/projects) and create one:

<figure><img src="https://content.gitbook.com/content/Yos1ARQNZ0mySw9UuAwA/blobs/U4hkgV9DfE2QsfHgqalu/Xnapper-2023-04-29-13.03.24.jpg" alt=""><figcaption><p>Create a new Petal Pro project</p></figcaption></figure>

Then you can download:

<figure><img src="https://content.gitbook.com/content/Yos1ARQNZ0mySw9UuAwA/blobs/llV8otWIPsb0AN2pt24G/Xnapper-2023-04-29-13.08.24.jpg" alt=""><figcaption><p>Download the zip file</p></figcaption></figure>

Done!

If you're a Github member it is possible to clone from the `main` branch, but we don't recommend it because there is a higher chance of bugs. Before each release, we do comprehensive testing and ensure the docs are up to date.

#### 2. Install Elixir & Erlang with asdf&#x20;

If you already have Elixir and Erlang installed you can skip to the next section.

We recommend using [asdf](https://asdf-vm.com/) to manage your Elixir and Erlang versions. It allows you to have multiple versions on your computer.

For Macs using Homebrew:

```bash
brew install coreutils curl git gnupg gnupg2
brew install asdf

# Add executable to your terminal setup file. 
# Bash users:
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.bash_profile

# zsh users
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc

# Reload your terminal
asdf plugin add erlang
asdf plugin add elixir

# Navigate to the root of your Petal Pro folder
# Check the file .tool-versions - these are the version we will use.
asdf install
```

#### 3. Rename your project (not recommended if you want updates)

{% hint style="warning" %}
***Warning***: if you plan to merge in future Petal Pro commits (eg. if you're waiting for an upcoming feature), then perhaps hold off renaming as it makes merging harder.
{% endhint %}

Your app module is currently called `PetalPro`. There is a hex package to help you rename:

```elixir
# mix.exs

{:rename_project, "~> 0.1.0", only: :dev, runtime: false}

```

This package enables you to use this command:

```bash
mix rename PetalPro YourNewName
```

#### 4. Run the setup command

In your terminal, run the command:&#x20;

```bash
mix setup
```

This will fetch dependencies, create and migrate your database, and run the seeds script (creates and admin user and some dummy users).

#### 5. Install chromedriver

In order for tests to work, you will need to install [Chromedriver](https://chromedriver.chromium.org/downloads) (we utilize [Wallaby](https://github.com/elixir-wallaby/wallaby) for e2e tests). On a Mac you can install it with:

```bash
brew install --cask chromedriver

# You may also need to run this (if it says something like "Unable to open chromedriver"):
xattr -d com.apple.quarantine $(which chromedriver)
```

#### 6. Run the server

```bash
mix phx.server

# Or, if you want IEX running at the same time:
iex -S mix phx.server
```

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.

You can now sign in as admin:

* Email: `admin@example.com`&#x20;
* Password: `password`

Or a normal user:

* Email: `user@example.com`
* Password: `password`

#### 7. Add in your branding and details (can be done later)

We have added comments throughout the codebase providing instructions on how to add in your app details and branding. Simply do a global find in your code editor for the text "SETUP\_TODO" and follow the instructions.

#### 8. Look over our recipes&#x20;

We have some recipes to cover common use cases that aren't part of the normal setup. For example, UUID's instead of ordinary IDs. You can git cherry pick them into your codebase. Check them out [here](https://docs.petal.build/petal-pro-documentation/recipes).

### Other tools we use to help develop web apps

* [iTerm2](https://www.iterm2.com/) to replace Mac terminal
* [Fig](https://fig.io/) to enhance your terminal
* [ZSH Prezto](https://github.com/sorin-ionescu/prezto) to replace BASH with zsh within the terminal
* Database GUI - pick one based on your budget:
  * [TablePlus](https://tableplus.com/) (paid) - though it's included with a [SetApp](https://setapp.com/) subscription
  * [Beekeeper](https://www.beekeeperstudio.io/) (free)
* [SourceTree](https://www.sourcetreeapp.com/) to help use git
* [Dash](https://kapeli.com/dash) for near instantaneous documentation. Useful when you keep looking up Elixir functions like `String.match?`.
* [Linear](https://linear.app/) for issue tracking
* [Figma](https://figma.com) for design
* [Raycast](https://www.raycast.com/) to replace spotlight

### Contributing

Petal Pro is a paid product but we welcome PR's if you find small bugs / typos / improvements. Let us know if you want to contribute in a more significant way and we can offer unlimited membership in return.
