Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rmlaptopabs's avatar

Front-end and back-end code in single repository to load into Forge.

Hello - I have a new project that I am trying to setup in Forge, but when I try to install the repository (Git), the process fails with "Your project does not contain a composer.json file.". The repository is a single repository with two directories - one for the front-end and one for the back-end. What is the best way to address the issue with this approach. Thanks in advance! Brian

0 likes
4 replies
LaryAI's avatar
Level 58

Hello Brian,

It sounds like you're trying to deploy a project on Laravel Forge, but Forge is expecting a composer.json file at the root of your repository because it's designed to work with PHP projects (like Laravel) out of the box.

If your back-end is a PHP/Laravel project, you should ensure that the composer.json file is located at the root of your repository. However, since you mentioned that you have two directories, one for the front-end and one for the back-end, it seems like your project structure is not what Forge expects by default.

Here's what you can do to resolve this issue:

  1. Move the composer.json to the root: If possible, restructure your repository so that the composer.json file for your back-end is in the root of the repository. This is the simplest solution and will allow Forge to recognize your project as a PHP project.

  2. Use a Custom Deployment Script: If restructuring the repository is not an option, you can use a custom deployment script in Forge to navigate to your back-end directory and run composer install from there. Here's an example of what that script might look like:

cd /home/forge/default/back-end
composer install --no-interaction --prefer-dist --optimize-autoloader

# Add any additional deployment steps for your back-end below
# ...

# Now navigate to your front-end directory and build your assets
cd /home/forge/default/front-end
# Run npm/yarn commands or any other build steps you have
# npm install
# npm run prod

Replace /home/forge/default/back-end and /home/forge/default/front-end with the actual paths to your back-end and front-end directories within the Forge server.

To add a custom deployment script in Forge:

  • Go to your site on Forge.
  • Click on the "Deploy" tab.
  • Scroll down to "Deployment Script".
  • Edit the deployment script to match the one you need (similar to the example above).

Remember to commit any changes you make to your composer.json or deployment scripts to your Git repository before triggering a deployment on Forge.

I hope this helps you get your project up and running on Forge! If you have any more questions or need further assistance, feel free to ask.

Snapey's avatar

why don't you ask Forge support?

gych's avatar

Are you using quick deploy?

rmlaptopabs's avatar

Thanks guys - Forge AI support responded with moving the composer file / deployment script, which I'm sure will work. This is my first time setting up a Laravel project, and to complicate things, there is a front-end and a back-end repository (which I combined into a single repository to use Forge). I'm trying to avoid creating problems for future support. @Gych - I am using the quick deploy.

1 like

Please or to participate in this conversation.