Prerequisites

This guide will help you set up and start using the backoffice system built with Phoenix LiveView.

Before you begin, ensure you have the following installed:

  • Erlang & Elixir: Phoenix is built with Elixir, so you need Elixir and Erlang installed on your machine. You can install them using the package manager of your choice, such as asdf, brew on macOS, or direct downloads from the Elixir website.
  • Hex: Elixir's package manager, which you can install with mix local.hex if it's not already installed.
  • Phoenix: You will install the Phoenix mix archive.
  • Node.js: This is required for installing npm dependencies, which are necessary for Phoenix assets.
  • PostgreSQL: The default database used by Phoenix applications.

Hex.pm access

To do this, ensure you have an account on Hex.pm and configure your mix project to use your Hex user credentials. This will allow you to add dependencies to your project seamlessly. For instance, to integrate specific libraries or packages that enhance the functionality of your backoffice, you'll need to include them in your mix.exs file and run mix deps.get.

Step 1: Install Hex

If you haven't already installed Hex, you can do so by running the following command in your terminal:

# This command will install Hex locally on your machine
mix local.hex

Step 2: Register or Login

If you don't have a Hex account, you'll need to register one first. You can register directly from your terminal:

mix hex.user register

Follow the prompts to provide your email address, a public username, and a password. You will also need to confirm your email address to activate your account.

If you already have an account, you can log in using the following command:

mix hex.user auth

This command will prompt you to enter your account's username and password. Once authenticated, it will store your credentials locally so you can fetch and publish packages without logging in each time.

npm access

Ensure you have an account on npmjs.com and configure your project to use your npm user credentials.

Step 1: Install npm

If you haven't already installed npm, it typically comes bundled with Node.js. To install Node.js and npm, you can download it from Node.js official website.

Step 2: Register or Login

If you do not have an npm account, you'll need to create one. You can register directly from your terminal:

npm adduser

This command will prompt you to enter a username, password, and email address. Your email address will need to be verified to activate your account. If you already have an account, you can log in using the following command:

npm login

This will prompt you to enter your username, password, and email address. Once authenticated, it will store your credentials locally, allowing you to install private packages and publish packages without logging in each time.

Was this page helpful?