Skip to content

Local development

Run the API and dashboard from source, run the checks, add migrations and translations, and test against S3.

Avenvail is an ASP.NET Core API (backend/), a Nuxt dashboard (frontend/) and this documentation site (docs-site/). For how the code is laid out, see the repository README.

Running from source

Requirements: .NET SDK 10.0.4xx, Node 26, pnpm 11.

# API on :5080 (Development environment)
cd backend/Avenvail.Api
dotnet run
# First run: complete setup with the secret in .data/bootstrap-secret

# SPA on :3000, proxying /api, /s/, /d/ and /health to :5080
cd frontend && pnpm install && pnpm dev

Use http://localhost:3000 in development; it is the configured base URL, so cookies and CSRF origin checks behave as in production.

To serve the built SPA from the API on one origin without Docker, run pnpm generate, copy frontend/.output/public/* into backend/Avenvail.Api/wwwroot/ (gitignored), and start the API with Avenvail__BaseUrl=http://localhost:5080. Then open http://localhost:5080.

Translations

  • Dashboard: strings live in frontend/i18n/locales/en.json. To add a language, add its JSON file, an entry in i18n.locales in nuxt.config.ts and the matching Nuxt UI locale in app.vue.
  • API errors: every problem response has a stable code (and args for values such as the upload limit). The dashboard shows apiErrors.<code> from the locale file; detail stays English for ShareX and other clients.
  • Share, deletion and not-found pages: strings live in backend/Avenvail.Api/Resources/Sharing/SharePageStrings.resx. Add SharePageStrings.<culture>.resx (for example SharePageStrings.de.resx) and the language is picked up from the dashboard's language cookie or Accept-Language, with English for anything missing.

Database migrations

The schema is a versioned EF Core migration history in backend/Avenvail.Api/Data/Migrations, applied at startup before the app serves requests. After changing the model, add a migration and commit it; a test fails if the model and migrations drift apart.

dotnet tool restore
dotnet ef migrations add <Name> --project backend/Avenvail.Api --output-dir Data/Migrations

Databases created by the 0.0 spike have no migration history and are refused at startup. Delete the data directory's db and blobs folders to start fresh.

Checks

dotnet test Avenvail.slnx
cd frontend && pnpm typecheck && pnpm generate

Testing S3 locally

cp deployments/dev/seaweedfs-s3.json.example deployments/dev/seaweedfs-s3.json   # set a secret
docker compose --profile s3 up -d s3
docker compose exec s3 sh -c "echo 's3.bucket.create -name avenvail' | weed shell"
# then set the Avenvail__Storage__* variables in .env (see .env.example) and restart avenvail

The S3 credentials can also be read from files, e.g. Docker secrets: set Avenvail__Storage__S3__AccessKeyFile and Avenvail__Storage__S3__SecretKeyFile instead of the plain values.

To check that storage works, open Settings › Storage and click Test storage. It writes a small probe object, reads it back and deletes it, and shows which step failed if one does.

To try the whole app on S3 in one step, with the bucket created for you and throwaway credentials:

docker compose -f deployments/dev/compose.s3.yaml up --build
# open http://localhost:8081; the setup secret is printed by:
docker compose -f deployments/dev/compose.s3.yaml exec avenvail cat /data/bootstrap-secret
# when done (removes its data):
docker compose -f deployments/dev/compose.s3.yaml down -v

Running the S3 contract tests

dotnet test always runs the storage contract tests (ADR 0006) against local storage. To run them against S3 as well, start the same SeaweedFS that CI uses and point the tests at it. PowerShell:

docker run -d --rm --name avenvail-test-s3 -p 8333:8333 `
  -v "${PWD}/deployments/ci/seaweedfs-s3.json:/etc/seaweedfs/s3.json:ro" `
  chrislusf/seaweedfs:4.55 server -dir=/data -s3 -s3.port=8333 -s3.config=/etc/seaweedfs/s3.json
$env:AVENVAIL_TEST_S3_SERVICE_URL = "http://localhost:8333"
$env:AVENVAIL_TEST_S3_ACCESS_KEY = "avenvail-ci"
$env:AVENVAIL_TEST_S3_SECRET_KEY = "avenvail-ci-throwaway-secret"
dotnet test Avenvail.slnx --filter StorageContractTests
docker stop avenvail-test-s3

Any other S3-compatible service works the same way, with AVENVAIL_TEST_S3_BUCKET (default avenvail-test) naming a bucket the tests may write to and AVENVAIL_TEST_S3_REGION (default us-east-1) the signing region. Set AVENVAIL_TEST_S3_CONDITIONAL_WRITES=false for a service that rejects If-None-Match. A token scoped to one existing bucket is enough. For Cloudflare R2, use a separate test bucket:

$env:AVENVAIL_TEST_S3_SERVICE_URL = "https://<account_id>.r2.cloudflarestorage.com"
$env:AVENVAIL_TEST_S3_REGION = "auto"
$env:AVENVAIL_TEST_S3_BUCKET = "avenvail-test"
$env:AVENVAIL_TEST_S3_ACCESS_KEY = "<Access Key ID>"
$env:AVENVAIL_TEST_S3_SECRET_KEY = "<Secret Access Key>"
dotnet test Avenvail.slnx --filter "StorageContractTests|ServingTests|BackupTests"

Documentation

The docs site is in docs-site/. Run docker compose up docs from the repository root and open http://localhost:3001, or pnpm install && pnpm dev inside docs-site/. pnpm generate && pnpm check builds it and checks its pages. See Writing documentation.