← Alle Vorlagen

Composition API, typisierte Props, schlanke Server-Routen.

Constitution — Vue 3 + Nuxt app

Version 1.0.0 · Ratified 2026-11-10

These principles hold for every spec, plan and task of the project. A spec may add rules; it never weakens these.

  1. Composition API. Components use <script setup lang="ts">; the Options API is not used in new code. Logic shared between components lives in composables named useSomething.

  2. Typed props and emits. Props and events are declared with defineProps<Props>() and defineEmits<Events>(). vue-tsc --noEmit runs in CI and a type error fails the build.

  3. Server routes kept thin. A handler in server/api validates its input with a schema (readValidatedBody, getValidatedQuery), calls a function in server/utils and returns. Business rules or SQL inside a handler fail the review.

  4. Data fetched once. Data for the first render comes from useFetch or useAsyncData with a stable key, so it is fetched on the server and reused on the client. Fetching it again in onMounted is a defect.

  5. No state shared across requests. Shared state uses useState or a Pinia store. A mutable ref at module level leaks between requests on the server and fails the review.

  6. Secrets in private runtime config. Secrets live in the private keys of runtimeConfig; only runtimeConfig.public reaches the browser. No secret is read through import.meta.env in a component.

  7. Tested and accessible. Components are tested with Vitest and @nuxt/test-utils, and key pages run axe with zero violations. The tests are green before the merge.