ArtNote is a TanStack Start application that publishes scholarly notices about paintings for a French-speaking audience. It uses Prisma on a PostgreSQL database, MinIO for uploaded images, and Better Auth for authentication. It is self-hosted on Dokploy (docs/adr/0011-self-hosted-on-dokploy.md).
-
Install Vite+, the one toolchain for this project: it manages Node.js and the package manager, and runs the dev server, build, tests, lint and format (ADR 0008).
curl -fsSL https://vite.plus | bashNo nvm or separate Node.js install:
vpreads Node.js 26 fromdevEngines.runtimeand Bun frompackageManagerinpackage.json, and downloads both on first use. Bun is only the package manager undervp; the app runs on Node.js. Change either version withvp env pin <version>orvp env pin bun@<version>, and keep theDockerfile'snode:image on the same Node.js version. -
Install dependencies:
vp install
Dependency lifecycle scripts only run for packages listed in
trustedDependencies(currently justesbuild). Prisma's postinstall is skipped on purpose; the client is generated byworktree:setup,check,prisma:migrateand theDockerfile. -
Environment variables:
vp run worktree:setup(next step) writes.envon its first run:.env.example, overridden by the main checkout's.envwhen this is another worktree, with a database and dev port of its own for this checkout..envand.env.localare loaded intoprocess.envfor server code (.env.localwins). The variables are validated insrc/lib/env-schema.ts. Image uploads go to the local MinIO thatworktree:setupstarts (console at http://localhost:9001, userartnote, passwordartnote-dev-storage). A.envwritten before MinIO was added lacks theS3_*variables: copy them from.env.example. -
Start the local database and MinIO (Docker), create this checkout's database and the shared
artnotebucket, apply migrations, generate the Prisma client and seed sample data:vp run worktree:setup
Sign in with
admin@example.com,writer@example.com(a second admin),user@example.comorbanned@example.com(refused), passwordartnote-dev-password. Staging has the same accounts with other passwords (AGENTS.md, Environments and QA).worktree:setup,db:resetand the seed refuse to run against a non-local database. -
Run the development server:
vp run dev
The app is served at
BASE_URLfrom.env.
Run the package.json scripts with vp run <script>. vp dev, vp build, vp test, vp check, vp lint and vp fmt are Vite+'s built-in commands, so vp run dev is needed for the script that checks the setup first. vp exec <bin> runs a dependency's binary (vp exec prisma studio), vpx <file.ts> runs a TypeScript script, and vp add / vp remove / vp update change dependencies.
vp run dev– Vite dev server with TanStack Start, after checking this checkout is set up.vp build– production build (client assets and the Nitro server output in.output/).vp run start– serve the production build locally (node .output/server/index.mjs).docker build .– the production image Dokploy builds; the container runsprisma migrate deploy, then the server on port 3000.vp run check– everything CI runs: Prisma generate, validate and format check,vp check(Oxfmt, Oxlint and the TypeScript type check),vp test(Vitest), knip and the build (regeneratessrc/routeTree.gen.ts).vp run fix– format and apply lint fixes.vp run test:e2e– Playwright end-to-end tests (e2e/) on a throwaway copy of the seeded database (AGENTS.md, End-to-end tests). Install Chromium once withvp exec playwright install chromium.vp run worktree:setup– set up this checkout:.env, Postgres and MinIO, its database, migrations, Prisma client and seed.vp run db:seed/db:reset/db:down– re-seed, recreate this checkout's database, stop the shared containers.
AGENTS.md (imported by CLAUDE.md) is the guide for coding agents: setup, commands, conventions and how to verify a change.
Dokploy, on our own server, builds the Dockerfile from GitHub (ADR 0011):
| Environment | Address | Deploys on | Database and MinIO |
|---|---|---|---|
| Production | https://artnote.melvyn.be | a push to production (only the Release workflow moves it) |
its own |
| Staging | https://stg.artnote.melvyn.be | a push to main |
its own |
| Preview | a *.artnote.melvyn.be address |
a PR from this repository labelled preview |
staging's |
Uploaded files are served from https://files.artnote.melvyn.be (production) and https://files.stg.artnote.melvyn.be (staging and previews). Every container runs prisma migrate deploy before it starts, so a preview's migration reaches the staging database (ADR 0006). Deploys don't wait for CI.
Nobody pushes to main, v* tags or production: rulesets allow it only to the release workflows' deploy key (ADR 0012).
To release, run the Release workflow from the Actions tab on main and pick patch, minor or major (or gh workflow run release.yml -f bump=minor). It requires a passing Check on main's HEAD, commits chore(release): vX.Y.Z bumping package.json, pushes it with its tag, creates the GitHub Release and moves production, which Dokploy deploys.
To roll back, run the Rollback workflow with an earlier tag (gh workflow run rollback.yml -f tag=v1.2.0). It moves production to that tag and changes nothing else.
Each Dokploy app sets these variables (src/lib/env-schema.ts): BASE_URL, PRISMA_DATABASE_URL, BETTER_AUTH_SECRET, CRON_SECRET, CLIENT_IP_HEADER=x-real-ip, the five S3_* variables, and UMAMI_WEBSITE_ID in production only. Previews get staging's values; Dokploy adds DOKPLOY_DEPLOY_URL, which replaces BASE_URL. A Dokploy schedule on production and staging calls the nightly cron from inside the container:
node -e "fetch('http://localhost:3000/api/cron/prune-view-records',{headers:{authorization:'Bearer '+process.env.CRON_SECRET}}).then(r=>r.text()).then(console.log)"A new MinIO gets its bucket from scripts/storage/init-bucket.sh (public reads, no listing). There are no automatic backups.
AGENTS.md describes the folder layout, how to write a server function (guard, Zod validator, errors), how the UI reads and mutates data, and audience measurement. GLOSSARY.md defines the domain terms, and docs/adr/ records the decisions behind the architecture.
Vite+ (vp) is the toolchain: Vite for dev and build, Vitest for tests, Oxlint for linting and Oxfmt for formatting, all configured in vite.config.ts. vp check formats, lints and type-checks in one pass. knip covers unused code. See docs/adr/0008-vite-plus-toolchain.md.