# Git - SSR websites

> SSR websites in the git repository of an account - src/ssr/<website>/ with its files, website.yaml, and a tsconfig.json and the declarations of am-ssr for editors; commit, pull and revert from the Git page.

Source: https://docs.apimaker.dev/v4/docs/ssr/git.html

The websites of an account are part of its [git repository](https://docs.apimaker.dev/v4/docs/Git/git.html), a folder each :

```text
src/
  ssr/
    shop/
      website.yaml           its name, its title, its description, its template, whether it answers
      tsconfig.json          written for editors : JSX, @/ is the root of the website
      am-ssr.d.ts            written for editors : the declarations of the module am-ssr and of JSX
      site.config.ts
      libraries.json
      pages/
        _layout.tsx
        index.tsx
        products/[slug].tsx
      components/ProductCard.tsx
      lib/shop.ts
      data/products.json
      public/
        styles.css
        logo.png             a file which is no text is in the repository as its bytes
    blog/
      …
```

## Commit, pull, revert

On the Git page, **SSR Websites** is one of the parts a commit takes, like custom APIs or schemas.

- **Commit** writes every website of the account into `src/ssr/` and pushes what changed.
- **Pull** makes every website of the folder what the branch has : a website it has not is made, its settings and its files are changed where they differ (each file is compiled), files the branch has not are taken away. A website of the account the branch has not is taken away. A website of the branch whose name belongs to another account of the installation is refused (the names of websites are unique in an installation) : rename its folder.
- **Status** lists each changed file of a website, with its diff ; **revert** takes back a file, or a whole website, as the commit of the branch has it.

## The history of a file

Every file of a website has its history : right click it in the tree, **Git history**, or above the editor. A folder has one (**Git history** in its menu : every file below it, a tab each), and so has the whole website (**Git history of the website** in the `⋮` menu of the files).

The dialog lists every commit of the branch which changed it, newest first, under the version the website has now :

- **Changes** shows the selected version against the one below it, against what the website has now, or against a version pinned in the list ; **Full version** shows it whole.
- **Load into the editor** (a text) puts a version into the editor without saving it : read it, change it, then save it — or close it.
- **Revert** writes the version into the website : a file as the commit has it, a folder with every file below it (a file the commit has not is removed), the whole website with its `website.yaml`. Nothing is committed : review it, then commit it on the Git page.
- A file removed since keeps its history : revert it to a version which had it and it comes back.
- A file which is no text — an image, a font — reads as what it is : its format, its pixels, its size and the start of its SHA-256. A [compressed image](https://docs.apimaker.dev/v4/docs/ssr/images.html) reads `2400 × 1600 pixels, 1.21 MB` in one version and `1920 × 1280 pixels, 236.4 KB` in the next.

**Load older versions** reads further back : the history reads the last 50 commits of the branch first, 1 000 at most.

## Your editor

`tsconfig.json` and `am-ssr.d.ts` make each folder of a website a project TypeScript checks as it is : open `src/ssr/shop` in VS Code or WebStorm and the pages are checked with the types of `am-ssr` (`PageProps`, `ctx`, the attributes of every element), `@/components/Card` is found, and a mistake is marked before you push.

They are written for editors and never read back : the server writes them again at every commit. A `tsconfig.json` of the website's own (made in the panel) is the website's file, and is kept.

The `tsconfig.json` at the root of the repository leaves `src/ssr` to these.

## The local client

The [local client](https://docs.apimaker.dev/v4/docs/features/developer-tools.html#your-own-editor) of the account keeps the same folders on your disk, in sync both ways :

- A file saved in your editor sends the folder of its website, saved as a pull saves it : each file is compiled, and files the folder has not are taken away. A new folder in `src/ssr/` is a new website ; a folder deleted takes its website away.
- What the panel saves comes to your disk : a saved file with the rest of its website ; a file removed or moved, a website renamed or removed, with a full sync.
- The name of a website is its folder. `website.yaml` holds its title, its description and whether it answers.
- `tsconfig.json` and `am-ssr.d.ts` come from the server : what you change in them is not read.
- A file whose path has a part which starts with `.` (`public/.well-known/security.txt`) is not synced by the local client, and stays on the server as it is. Add or change it in the panel, or with git.
