## Project requirements
#### Backend stack:
- Php 7.3
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP Extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension

**Or if you want to use Homestead for local development**
- Vagrant
- Virtualbox

#### Frontend stack:
- Node 10.x or higher
- Npm (installs with node)

## Setup instructions
### Backend
If you are on Windows and want to use Homestead you need to download and install [VirtualBox](https://download.virtualbox.org/virtualbox/6.1.16/VirtualBox-6.1.16-140961-Win.exe)
and [Vagrant](https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.msi) 
**or** follow [this](https://www.virtualbox.org/wiki/Linux_Downloads) and
[this](https://learn.hashicorp.com/tutorials/vagrant/getting-started-install) instructions if you are using Linux.

After you have installed Vagrant and VirtualBox just run `init.sh` or `init.bat`
from `scripts/development` directory. Every time you need to start development server just run `vagrant up` from project directory. 


**Or** if you prefer to use your system environment then follow instructions:

<details>
<summary>CLICK TO VIEW</summary>

```bash
$ add-apt-repository ppa:ondrej/php
$ apt-get update
```

Install PHP 7.3  
```bash
$ apt-get install php7.3
```
Install PHP extensions
```bash
$ apt-get install php7.3 php7.3-mbstring php7.3-mcrypt php7.3-mysql php7.3-xml php7.3-bcmath php7.3-curl php7.3-gmp php7.3-zip php7.3-gd
```

Install composer https://getcomposer.org/download/

Install and setup MySQL server 5.7 https://help.ubuntu.ru/wiki/mysql  
**or** https://dev.mysql.com/downloads/installer/ for Windows  
Then create new database named `repricev2`

In `backend/` directory copy file `.env.example` as `.env` and provide your database credentials, 
and set `APP_URL` properly

In `backend/` directory run 
```bash
$ composer install
``` 
Then 
```bash
$ php artisan key:generate
```
Run migrations and seeds
```bash
$ php artisan migrate
$ php artisan db:seed
```

To start backend run 
```bash
$ php artisan serve
```
from `backend/` directory

</details>

### Frontend

#### Installation

1. Install node at least 10 version
  - To install on Ubuntu run these commands
     ```
      $ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
      $ sudo apt-get install -y nodejs
     ```
  - To install on Windows just download .msi file from [nodejs.org](https://nodejs.org/en/download/) 
  - Also you can use NVM: [For Linux](https://github.com/nvm-sh/nvm), [NVM for Windows **(Recommended if running Windows)**](https://github.com/coreybutler/nvm-windows)
  and run `nvm install 12` and then just run `nvm use` in project directory (`.nvmrc` file included)
2. Move to project directory and run 
     ```bash
      $ npm install
     ```

#### Development server

Run `$ npm run dev` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

#### Build

Run `$ npm run build` to build the project. The build artifacts will be stored in the `dist/` directory.

___
Default credentials for login:  
email: **admin@gmail.com**  
password: **secret**
