legit

Fork of https://git.icyphox.sh/legit

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
<!--
Copyright 2026 Shota FUJI <pockawoooh@gmail.com>
SPDX-License-Identifier: MIT
-->

# Development

Commands and tips for developing legit.

## Issues / Tickets

See <https://tangled.org/pocka.jp/legit/issues> for active issues.

## Load Testing

`tests/k6` directory contains `*.js` for [k6](https://grafana.com/oss/k6/), an OSS load testing tool.

These test files access a test server on localhost:8080.
Run `nix run .#testing` (you need Nix Flakes) or follow steps described in `tests/k6/.gitignore` manually (you need bash, git, and built `legit` binary) to launch the test server.

Once the test server is ready, pass your desired test file to `k6 run` command.
Nix user can use `nix run .#k6 -- run` without installing k6 manually.

## Code Formatting

This project use [dprint](https://dprint.dev/).
You have to install [`nixfmt`](https://github.com/NixOS/nixfmt) and Go toolchain as well.

Nix user can run `nix fmt` without installing or configuring anything.

## Build an OCI Image

You can build an [OCI](https://opencontainers.org/) image easily with [podman](https://podman.io/).
legit works perfectly fine in an unprivilege (rootless) container.

On the project root directory run the following command:

```sh
podman build . -t pocka/legit
```

That would create and register `pocka/legit` image on your local registry.
To test the image works, run the following command:

```sh
podman run --volume ./demo:/var/www/legit --publish 5555:5555 pocka/legit:latest
```

If you don't have podman on your NixOS system and quickly test these steps, use `nix develop .#podman` devShell.
It has podman and configures minimum podman environment.