# Importing an Existing Project

If you already have an Electron app and want to try out Electron Forge, you can either use Forge's `import` script or manually configure Forge yourself.

These steps will get you set up with a basic build pipeline that can create [squirrel.windows](https://www.electronforge.io/config/makers/squirrel.windows "mention") (Windows), [zip](https://www.electronforge.io/config/makers/zip "mention") (macOS), and [deb](https://www.electronforge.io/config/makers/deb "mention") (Linux) installers when running `electron-forge make`.

## Using the import script

Importing an existing Electron app into the Electron Forge workflow can be done automatically using Forge's `import` command.

```shell
cd my-app
npm install --save-dev @electron-forge/cli
npm exec --package=@electron-forge/cli -c "electron-forge import"
```

This script will set up Forge to package your app and build installers for it.

{% hint style="info" %}
If you're already using other Electron tooling, it will try to automatically migrate the settings as much as possible, but some of it may need to be migrated manually.
{% endhint %}

## Setting up Forge manually

If the import script does not work for some reason, you can also install Forge manually. To get identical behavior to the script, follow the steps below.

### Installing dependencies

First, install Forge's CLI and the target Makers as devDependencies in your project.

```bash
cd my-app
npm install --save-dev @electron-forge/cli @electron-forge/maker-squirrel @electron-forge/maker-deb @electron-forge/maker-zip
```

### Configuring package.json

To start using Forge, add a few command scripts to your package.json file:

{% code title="package.json" %}

```json
{
  // ...
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish"
  }
  // ... 
}
```

{% endcode %}

Then, set up your Forge [configuration](https://www.electronforge.io/config/configuration "mention") in the `config.forge` field in package.json.

{% code title="package.json" %}

```json
{
  // ...
  "config": {
    "forge": {
      "packagerConfig": {},
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "electron_quick_start"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]
    }
  }
  // ...
}
```

{% endcode %}

In the above object, we configure each Maker that we installed into the `makers` array. We also create an empty `packagerConfig` object that you should edit to your app's packaging needs.

### Adding Squirrel.Windows boilerplate

When distributing a [squirrel.windows](https://www.electronforge.io/config/makers/squirrel.windows "mention") app, we recommend installing [`electron-squirrel-startup`](https://github.com/mongodb-js/electron-squirrel-startup) as a runtime dependency to handle Squirrel events.

```bash
cd my-app
npm install electron-squirrel-startup
```

Then, add the following snippet as early as possible in the main process execution (before the `app.ready` event).

{% code title="main.js" %}

```javascript
if (require('electron-squirrel-startup')) app.quit();
```

{% endcode %}

### Optional: publishing your app

You can also configure Forge to upload your release artifacts to a self-hosted release server such as [electron-release-server](https://www.electronforge.io/config/publishers/electron-release-server "mention") or [nucleus](https://www.electronforge.io/config/publishers/nucleus "mention"), or cloud storage providers such as [s3](https://www.electronforge.io/config/publishers/s3 "mention").

For example, for the S3 Publisher:

```bash
cd my-app
npm install --save-dev @electron-forge/publisher-s3
```

{% code title="package.json" %}

```json
{
  // ...
  "config": {
    "forge": {
      "packagerConfig": {},
      "makers": [ /* ... */],
      "publishers": [
        {
        "name": "@electron-forge/publisher-s3",
        "platforms": ["darwin", "linux"],
          "config": {
            "bucket": "my-bucket",
            "folder": "my/key/prefix"
          }
        }
      ]
    }
  }
  // ...
}
```

{% endcode %}

See the [publishers](https://www.electronforge.io/config/publishers "mention") documentation for more information.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.electronforge.io/import-existing-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
