> For the complete documentation index, see [llms.txt](https://wiki.project-fika.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.project-fika.com/advanced-features/web-app.md).

# Web App

How to install the Fika Web App

## Introduction

{% hint style="info" %}
While this web app is designed to make server administration easier in the long run, the initial setup and maintenance require advanced technical knowledge.

The application runs as a fully isolated Docker container. To ensure stability and security, proficiency with container technology is essential. If you are strictly looking for a "plug-and-play" solution and are unfamiliar with Docker, this solution may not be the best fit for your needs.

A Windows-based solution is in progress, but is not yet available.
{% endhint %}

## What is the web app?

FikaWebApp is a Blazor-based web application designed to help you administrate your server.\
Features included are:

* Creating moderator/admin accounts
* Sending items (supports modded items)
  * Send items to everyone
  * Send items at a specific date
* Flea banning
* Statistics page (WIP)
* Administrate connected headless clients
* Uploading/downloading profiles
* Uploading/downloading files

## Installation

The Docker image can be found at the Docker website [here](https://hub.docker.com/r/lacyway/fikawebapp).

Use your preferable way of running the docker image. It's recommended to use the `compose.yml` below as certain variables are required to run the app, unless you are certain of what you are doing.

After running, access the site at `http://localhost:8080/` (unless you use a reverse proxy) and login using the standard account:

* **User**: admin
* **Password**: Admin123!

{% hint style="warning" %}
**Change your password after logging in!**
{% endhint %}

### Example compose

{% code title="docker-compose.yml" fullWidth="false" expandable="true" %}

```yml
services:
  fikawebapp:
    image: lacyway/fikawebapp:latest
    container_name: fikawebapp
    restart: unless-stopped
    environment:
      - PORT=5000 # internal container port the app listens on
      - API_KEY=<YOUR API KEY> # API Key generated by the Fika server
      - BASE_URL=https://localhost:6969 # URL/IP to your Fika server
    ports:
      - "8080:5000" # Host port 8080 -> container port 5000, not needed when using reverse proxy
    command: 
      #- "--reset-admin" # uncomment to reset admin password
      - "--quiet-logs" # comment out to receive verbose logs
    volumes:
      - ./webappdata:/app/data # data folder, use a volume to not lose data when updating
```

{% endcode %}

The compose above will let you run the web app, and access it without `https`.\
It is, however, recommended to use a reverse proxy, e.g. Traefik.

Make sure to read all the lines carefully, and change the required variables which are:

1. `API_KEY`
2. `BASE_URL`

### Example compose with reverse proxy

{% code title="docker-compose.yml" fullWidth="false" expandable="true" %}

```yml
services:
  # ----------------------
  # Traefik Reverse Proxy
  # ----------------------
  traefik:
    image: traefik:v3
    container_name: traefik
    restart: unless-stopped
    environment:
      - TZ=Etc/UTC
    ports:
      - 80:80      # HTTP
      - 443:443    # HTTPS
    command:
      # Basic settings
      - '--ping=true'
      - '--api=true'
      - '--api.dashboard=false'
      - '--api.insecure=false'
      - '--global.sendAnonymousUsage=false'
      - '--global.checkNewVersion=false'
      - '--log=true'
      - '--log.level=INFO'

      # Docker provider
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"

      # Entry points
      - "--entryPoints.web.address=:80"
      - "--entryPoints.websecure.address=:443"

      # TLS & Let's Encrypt
      - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.email=your@email.net"
      - "--certificatesresolvers.letsencrypt.acme.storage=/config/acme.json"

    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik:/config"
    healthcheck:
      test: ["CMD", "traefik", "healthcheck", "--ping"]
      interval: 10s
      timeout: 5s
      retries: 3

  # ----------------------
  # Fika Web App
  # ----------------------
  fikawebapp:
    image: lacyway/fikawebapp:latest
    container_name: fikawebapp
    restart: unless-stopped
    environment:
      - PORT=5000 # internal container port the app listens on
      - API_KEY=<YOUR API KEY> # API Key generated by the Fika server
      - BASE_URL=https://localhost:6969 # URL/IP to your Fika server
    command: 
      #- "--reset-admin" # uncomment to reset admin password
      - "--quiet-logs" # comment out to receive verbose logs
    volumes:
      - ./webappdata:/app/data
    labels:
      - "traefik.enable=true"

      # Router
      - "traefik.http.routers.fikawebapp.rule=Host(`your.address.net`)" # can also be your external IP
      - "traefik.http.routers.fikawebapp.entrypoints=websecure"
      - "traefik.http.routers.fikawebapp.tls.certresolver=letsencrypt"

      # Service internal port
      - "traefik.http.services.fikawebapp.loadbalancer.server.port=5000"
```

{% endcode %}

Using the compose with reverse proxy, you can now access the server at `https://your.address.net/` (or IP address, if you chose one instead)

Make sure to read all the lines carefully, and change the required variables which are:

1. `your@email.net`
2. `API_KEY`
3. `BASE_URL`
4. `your.address.net`

{% hint style="info" %}
If you won't be using Traefik, pay attention that you do not need the `ports:` anymore when using a reverse proxy.
{% endhint %}

## Updating

If you used the compose files above, the volume will automatically be safe when updating. To update, simply re-run the compose and the latest image will be fetched and installed. Your data will be safe in the `webappdata` folder.

If you ***did not use*** the compose, make sure to backup the entire data folder in `/app/data`!

{% hint style="danger" %}
Failure to use the compose, or backup the folder will result in a *permanent* data loss after updating!
{% endhint %}
