> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Commit and upload

> Upload a new application to Square Cloud or commit new files to an existing one.

## Uploading a new application

`api.applications.create(file)` uploads a zip and creates a brand-new application. The `file` argument is either a local file path or a `Buffer`.

```typescript theme={null}
import { SquareCloudAPI } from "@squarecloud/api";
import { join } from "node:path";

const api = new SquareCloudAPI(process.env.SQUARE_API_KEY!);

const result = await api.applications.create(join(__dirname, "my-app.zip"));

console.log(result.id);   // newly created application ID
console.log(result.name); // display name
console.log(result.lang); // language slug (e.g. "javascript")
console.log(result.ram);  // allocated RAM in MB
```

The zip must contain at least:

* **Main file** — entry point of your application
* **Dependencies file** — `package.json`, `requirements.txt`, etc.
* **`squarecloud.app`** — configuration file with name, description, main file, version, etc. See the [config file guide](/en/getting-started/config-file)

## Committing files to an existing application

`app.commit(file, fileName?)` uploads files into an already-deployed application. Pass a zip to replace multiple files at once, or a single file to update just that one.

| Parameter  | Type               | Description                                                                                                      |
| ---------- | ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `file`     | `string \| Buffer` | Local file path or `Buffer` content                                                                              |
| `fileName` | `string?`          | Name attached to the upload. `.zip` is extracted on the server; any other extension is written as a single file. |

<Tabs>
  <Tab title="Commit a single file (Buffer)">
    ```typescript theme={null}
    const content = Buffer.from("console.log('hello')\n");
    await app.commit(content, "index.js");
    ```
  </Tab>

  <Tab title="Commit a zip from disk">
    ```typescript theme={null}
    import { readFile } from "node:fs/promises";

    const zip = await readFile("./dist.zip");
    await app.commit(zip, "dist.zip");
    ```
  </Tab>

  <Tab title="Commit a file by path">
    ```typescript theme={null}
    import { join } from "node:path";

    const filePath = join(__dirname, "index.js");
    await app.commit(filePath, "index.js");
    ```
  </Tab>
</Tabs>

<Warning>
  In v3 `commit()` accepted a third `restart` argument. **In v4 the third parameter has been removed** — use `app.restart()` after the commit if you need a restart.
</Warning>

```typescript theme={null}
await app.commit(zip, "dist.zip");
await app.restart();
```
