FrontForge is a frontend development environment designed to simplify the lives of frontend developers. It provides a comprehensive platform with all the essential tools required for local development of Node.js applications.
Before setting up FrontForge, ensure you have the following installed on your local machine:
To get started with FrontForge, clone the repository to your local machine:
git clone https://github.com/sconz2/frontforge.git
After cloning the repository, you need to copy the example configuration file and rename it:
cp FrontForge.json.example FrontForge.json
The FrontForge.json
file is used to configure various aspects of the Vagrant VM. Below is a breakdown of each section and its purpose.
This section provides Vagrant with the resources to allocate to the VM.
ip
: The VM's IP address.memory
: The amount of RAM allocated to the VM (in MB).cpus
: The number of CPUs allocated to the VM.provider
: The VM provider. By default, this is set to virtualbox
as other providers are not currently supported.Example:
"vm": {
"ip": "192.168.56.57",
"memory": 1028,
"cpus": 2,
"provider": "virtualbox"
}
This section defines a list of shared folders between the host and the VM.
Each folder object contains:
map
: The folder path on the host machine.to
: The folder path on the VM.Example:
"folders": [
{
"map": "{host project folder}",
"to": "{vm project folder}"
}
]
This section specifies all the sites that Vagrant should set up.
Each site object contains:
map
: The local URL of your app.to
: The folder on the VM that the site should be linked to.proxy
: An object containing the host
and port
of the Node.js app.Example:
"sites": [
{
"map": "{url}",
"to": "{vm project folder}",
"proxy": {
"host": "127.0.0.1",
"port": 5000
}
}
]
This section defines any ports that need to be forwarded.
Each port object contains:
send
: The port on the host machine.to
: The port on the VM.Example:
"ports": [
{
"send": 33060,
"to": 3360
}
]
To ensure that the local URLs defined in the sites
section of your FrontForge.json
file correctly map to the VM's IP address, you'll need to edit the hosts file on your host machine.
Open the Hosts File:
C:\Windows\System32\drivers\etc
.hosts
file.sudo nano /etc/hosts
Add Entries for Your Sites:
map
field of your sites
section) to the VM's IP address.<VM_IP> <local_URL>
FrontForge.json
specifies the following site configuration:"sites": [
{
"map": "myapp.local",
"to": "/var/www/myapp",
"proxy": {
"host": "127.0.0.1",
"port": 5000
}
}
]
192.168.56.57 myapp.local
Save the Hosts File:
By updating the hosts file, you ensure that your local development URLs resolve correctly to the VM, enabling seamless access to your sites.
Once the FrontForge.json
file is configured, you can start the development environment by running:
vagrant up
This command will boot the VM and provision it based on the settings defined in your FrontForge.json file. The initial setup may take a few minutes, depending on the resources allocated to the VM. After the initial provisioning, starting and stopping the VM will be quick and efficient.
Once Vagrant has finished provisioning the VM, you can view your Node.js app by navigating to the local URL specified in the sites section of your FrontForge.json file. Simply enter the URL into your web browser, and you should see your app displayed.
Note: Ensure you have updated your hosts file to map the local URL to the VM's IP address for proper resolution. See the 'Hosts File' section above.
This project is licensed under the MIT License. See the LICENSE file for more details.
FrontForge is largely inspired by and based on Laravel Homestead. We extend our gratitude to the Laravel team for their incredible work and the inspiration behind FrontForge.