> ## 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 und Upload

> Laden Sie eine neue Anwendung auf Square Cloud hoch oder committen Sie neue Dateien in eine bestehende.

## Eine neue Anwendung hochladen

`api.applications.create(file)` lädt eine Zip-Datei hoch und erstellt eine brandneue Anwendung. Das Argument `file` ist entweder ein lokaler Dateipfad oder ein `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
```

Die Zip-Datei muss mindestens enthalten:

* **Hauptdatei** — Einstiegspunkt Ihrer Anwendung
* **Abhängigkeitsdatei** — `package.json`, `requirements.txt`, usw.
* **`squarecloud.app`** — Konfigurationsdatei mit Name, Beschreibung, Hauptdatei, Version usw. Siehe den [Leitfaden zur Konfigurationsdatei](/de/getting-started/config-file)

## Dateien in eine bestehende Anwendung committen

`app.commit(file, fileName?)` lädt Dateien in eine bereits bereitgestellte Anwendung hoch. Übergeben Sie eine Zip-Datei, um mehrere Dateien auf einmal zu ersetzen, oder eine einzelne Datei, um nur diese eine zu aktualisieren.

| Parameter  | Typ                | Beschreibung                                                                                                                        |
| ---------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| `file`     | `string \| Buffer` | Lokaler Dateipfad oder `Buffer`-Inhalt                                                                                              |
| `fileName` | `string?`          | An den Upload angehängter Name. `.zip` wird auf dem Server extrahiert; jede andere Erweiterung wird als einzelne Datei geschrieben. |

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

  <Tab title="Eine Zip-Datei von der Festplatte committen">
    ```typescript theme={null}
    import { readFile } from "node:fs/promises";

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

  <Tab title="Eine Datei per Pfad committen">
    ```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 akzeptierte `commit()` ein drittes Argument `restart`. **In v4 wurde der dritte Parameter entfernt** — verwenden Sie `app.restart()` nach dem Commit, wenn Sie einen Neustart benötigen.
</Warning>

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