# Customisation

> Notes for developers customising the code of a self-hosted Advanzo CRM installation: development environment, building assets with Vite, deployment, updates.

Learn how to customise your Advanzo CRM installation. The code is not obfuscated, so you can customise it easily.

Advanzo CRM has many configuration options, but in some cases you will need to customise the code to add a new feature or modify an existing one.

You can customise the code as long as you have developer knowledge, are familiar with Laravel and VueJS and can **configure a development environment** on your computer.

For any customisation, **you will need to be familiar with common development tools** such as **NodeJS, NPM, Composer, Vite**, and with **Laravel**, **VueJS** and **Tailwind CSS**.

Advanzo CRM is built with the tech stack mentioned above as an SPA (single-page application) with an API based on Laravel and PHP.

**Please note that** if you want to customise a component and add your own code, for example to customise the navbar, you cannot just edit a regular `.html` or `.php` file, save it and see the changes on your installation. Most of the HTML is compiled for production with Vite and rendered on the fly (see JavaScript and CSS Files below).

> **Warning:** - **Customisation support is not included with the purchase**. We cannot provide customisations that extend the default Advanzo CRM features. If you do not have the knowledge for customisation, we strongly recommend hiring a professional to do the job for you.
> - **This is only a general guide to help you get started**. If you are already familiar with Laravel, VueJS and Tailwind CSS, feel free to use your own development techniques to customise your Advanzo CRM installation.
> - **We cannot teach you how to add new features or adjust existing ones**; the topic is too broad. You will need to be familiar with PHP, JavaScript, Laravel and VueJS. Explore the code to get to know it and to find a suitable way to implement your requirement.
> - **We cannot** provide general web hosting and/or general PHP/JavaScript support.
> - **We cannot** provide general Laravel and development support.
> - **We cannot** provide how-to advice on whether Advanzo CRM can do what you want or need.

## Development Environment

Before you start to customise Advanzo CRM, you need a development environment. If you are not familiar with Laravel, we strongly recommend reading the [Laravel Installation Guide](https://laravel.com/docs/10.x/#installing-laravel) first.

We use Laravel Homestead to create a virtual machine for the development environment. If you are already familiar with Laravel and use a different environment, for example Docker with Laravel Sail, you are free to use that instead.

- Make sure you have installed [Git](https://git-scm.com) on your local machine.
- Install [Laravel Homestead](https://laravel.com/docs/10.x/homestead) globally.
- If you haven't already, install [NodeJS](https://nodejs.org/en/download/) and NPM.

## Configure Advanzo CRM

After you have configured your development environment, perform a clean installation of Advanzo CRM.

- We assume that you have already installed Laravel Homestead. Extract the Advanzo CRM files, for example to `~/code/advanzo`.
- Perform a fresh Advanzo CRM installation.
- On the Homestead command line, run `composer update` to install the dev dependencies.
- Install NPM packages by running `npm install`.
- Edit the `.env` file and set the `APP_ENV` config key to `local`.
- Edit the `.env` file and set the `APP_DEBUG` config key to `true`.

## JavaScript and CSS Files

The core CSS files are located in `resources/css` and the core JavaScript files and components are located in `Modules/Core/resources/js`. This folder contains reusable Vue SFCs such as UI components.

The JavaScript and CSS files of the actual features, however, are located in the `Modules/*/resources/js` directory, where `*` is a module name.

For example, the JavaScript files and Vue components of the contacts module are located in the `Modules/Contacts/resources/js` directory.

You are free to edit the files in these directories if you need to. **Keep in mind that they are development files: changes are not compiled unless you watch the files by running the npm command `npm run dev` in the root of the Advanzo CRM directory**.

`npm run dev` starts a [Vite](https://vitejs.dev) development server and uses HMR to reflect any changes. Use `npm run dev` for development purposes only; afterwards, you still need to build the files with `npm run build`.

After the files are compiled, they are placed in the `public/dist` directory.

To learn more about Vite, see the official [Vite documentation](https://vitejs.dev) and [Laravel documentation for Vite](https://laravel.com/docs/10.x/vite).

## Deployment

When you have finished your changes, prepare Advanzo CRM for deployment on your live server.

- Run `npm run build` to build the JavaScript and CSS files for production with Vite.
- If you installed the Composer development dependencies, run `composer install --no-dev`.
- Upload the files to the server (without the `node_modules` folder, but including the `vendor` folder).

If you use a build service such as Envoyer or Forge, you can include the commands mentioned above in your build script.

## Conflicts With Advanzo CRM Updates

If you decide to customise Advanzo CRM for your requirements, we strongly recommend planning how you will merge your changes when an Advanzo CRM update is released. You can use Git to maintain your own repository for Advanzo CRM and merge the changes when a new release is published.

We cannot provide a guide on how to do this. If you do not have the knowledge or ability to maintain the changes, we strongly recommend **staying on your customised version if it fits your requirements; you do not need to update**.
