# Deploying with source upload

> Deploy applications without a git repository by uploading .zip or .tar.gz source archives directly.

Deploying with source upload
-----------------------------

Source upload lets you deploy applications without connecting a git repository. Instead of pulling code from GitHub, GitLab, or Bitbucket, you upload a `.zip` or `.tar.gz` archive containing your source code directly.

### When to use source upload

Source upload is useful when:

- Your code isn't in a git repository
- You're deploying a pre-built archive from a CI/CD pipeline
- You want to deploy without connecting a git provider
- You're migrating from another platform and have a source archive ready

### Creating an upload-type application

1. Navigate to the Applications page and click "Create application"
2. In the repository step, toggle to **Upload source code**
3. Select your source archive file (`.zip` or `.tar.gz`)
4. Continue with the remaining configuration steps as usual
5. Click "Create application" to finish

Your application will be created with the uploaded source code and begin its first deployment automatically.

### Accepted file formats

| Format | Extensions | Notes |
|--------|-----------|-------|
| tar.gz | `.gz`, `.tgz` | Used directly as-is |
| ZIP | `.zip` | Automatically converted to tar.gz during upload |

The maximum file size is 100 MB.

### Deploying new source code

To deploy updated source code to an existing upload-type application:

1. Open the application detail page
2. Click **Deploy**
3. In the deploy modal, optionally select a new source archive to upload
4. Click **Deploy** to start the deployment

If you don't select a new file, the deployment will rebuild using the previously uploaded source archive. This is useful when you've only changed configuration like environment variables or build commands.

### How it differs from git-based deployments

| | Git | Upload |
|--|-----|--------|
| Source | Cloned from repository | Uploaded archive |
| Redeploy button | Available (reuses cached image) | Not available |
| Every deployment | Can skip build with Redeploy | Always runs a full build |
| Branch selection | Yes | Not applicable |

Upload-type applications always run a full build on every deployment because there is no cached image from a previous git-based build. The Redeploy button is not shown for upload applications.

### API usage

You can upload source archives via the API for automation or CI/CD integration.

**Upload source code:**

```
POST /api/v1/applications/{id}/source
Content-Type: multipart/form-data

source: (your .zip or .tar.gz file)
```

**Response:**

```json
{
  "success": true,
  "message": "Source archive uploaded successfully.",
  "data": {
    "source_archive_path": "1/5/1741500000.tar.gz",
    "size": 1048576
  }
}
```

After uploading, trigger a deployment using the deploy endpoint as usual:

```
POST /api/v1/applications/{id}/deploy
```

### Storage behavior

- Each new upload replaces the previous source archive
- Only one source archive is stored per application at a time
- Archives are stored securely and accessed via signed URLs during the build process
