# Build from Source

Clone the repository, install the toolchain with mise, and run the development loop.

## Prerequisites

- [mise](https://mise.jdx.dev/) (version manager — installs Go, Node, sqlc, golangci-lint from `.mise.toml`)
- Git (with submodule support)
- Docker or Podman (for the container build)

## Clone

```sh
git clone --recurse-submodules https://gitlab.com/yotoshelf/yotoshelf.git
cd yotoshelf
```

The `--recurse-submodules` flag is required — the `frontend/design` submodule provides design tokens, shared Svelte components, and brand assets.

## Install tools

```sh
mise install
```

This reads `.mise.toml` and installs the pinned versions of Go, Node, sqlc, golangci-lint, and just. Everything is project-local — no system-level installs required.

## Development loop

```sh
just dev
```

This starts the Go backend on `:8080` and the Astro frontend on `:4300` with hot reload. The frontend proxies `/api/**` to the backend.

## Common just recipes

```sh
just check    # run all checks: lint, test, build
just generate # run sqlc + openapi-typescript code generation
just seed     # seed the database with fixture data for development
just test     # run unit tests
just e2e      # run Playwright E2E tests (requires both servers up)
```

## Container build

```sh
docker build -t yotoshelf:local .
```

The Containerfile is a three-stage build: Node (frontend) → Go (binary) → Alpine (runtime + ffmpeg). The binary embeds the compiled frontend via `//go:embed all:frontend/dist`.
