10 KiB
10 KiB
Story 1.1: Project Initialization & The Main Ledger
Status
Done
Story
As a System Operator, I want to set up the initial project structure, including the application framework, database, and deployment configuration, so that there is a stable and ready foundation for all future development.
Acceptance Criteria
- A Nuxt 4 project is successfully created and configured in a monorepo.
- A
docker-compose.ymlfile is created to run the Nuxt application and a PostgreSQL database service. - The Nuxt application can successfully connect to the PostgreSQL database on startup.
- The initial database schema, including tables for "The Main Ledger" and "The Registry", is created via a migration script.
- SCSS and Tailwind CSS are installed and correctly configured within the Nuxt project.
Tasks / Subtasks
-
Baseline and verify Nuxt 4 setup (AC: 1)
- Confirm Node.js >= 20 and package manager availability.
- Verify
nuxt.config.tsmodules include@primevue/nuxt-moduleand@prisma/nuxt; ensure SSR defaults are intact. [Source: architecture/tech-stack.md#3. Tech Stack (Revised)] - Run dev server and confirm app boots without errors.
-
Add containerized local environment with Docker Compose (AC: 2)
- Create
docker-compose.ymlat repository root to run services:web: Nuxt app (dev) with proper ports and env mounts.db: PostgreSQL with named volume and healthcheck.
- Provide
.envwithDATABASE_URLfor Postgres (connection string for Prisma). [Source: architecture/unified-project-structure.md#6. Unified Project Structure]
- Create
-
Configure Prisma and database connectivity (AC: 3)
- Ensure
@prisma/nuxtmodule is enabled innuxt.config.ts. - Select a single Prisma client usage approach and unify:
- Prefer
@prisma/nuxtcomposable (e.g.,const prisma = usePrismaClient()), or alternatively retainlib/prisma.tssingleton — but do NOT use both. Betterlib/prisma.ts. - Update any imports/usages accordingly to prevent multiple client instances.
- Prefer
- Set
DATABASE_URLand runprisma generateto produce client. - Add a simple health endpoint
server/api/health.get.tsthat pings Prisma (e.g.,await prisma.$queryRaworawait prisma.$executeRaw) and returns{ db: 'ok' }on success. - Boot app; verify Prisma client can connect (check health endpoint or log on server start). [Source: architecture/tech-stack.md#3. Tech Stack (Revised)]
- Ensure
-
Define initial database schema and migrations (AC: 4)
- Design models for "Main Ledger" and "Registry" aligned with PRD.
- Update
prisma/schema.prismaaccordingly. - Run
prisma migrate dev --name initto create and apply the first migration. - Add a minimal seed script (optional) to validate queries against both tables. [Source: architecture/unified-project-structure.md#6. Unified Project Structure]
-
Establish SCSS structure and integrate Tailwind (AC: 5)
- Create SCSS directories and partials under
app/assets/scss/per project structure guidance; addcss: ['~/assets/scss/main.scss']innuxt.config.ts. [Source: architecture/project-structure.md#3. Project Structure] - Install Tailwind CSS and PostCSS config for Nuxt; enable PrimeVue compatibility via utilities as needed. [Source: architecture/tech-stack.md#3. Tech Stack (Revised)]
- Verify styles compile and are effective in a sample page.
- Create SCSS directories and partials under
-
PrimeVue verification and demo
- Render a PrimeVue
ButtonandDialogto confirm module, theme, and ripple settings are applied. - Ensure SSR produces no client-only errors in logs. [Source: architecture/component-standards.md#4. Component Standards]
- Render a PrimeVue
-
Testing scaffolding
- Ensure Vitest and
@vue/test-utilsare configured. - Add example component and composable tests alongside sources with
.spec.tsfiles. [Source: architecture/testing-requirements.md#8. Testing Requirements]
- Ensure Vitest and
Dev Notes
-
Tech Stack
- Nuxt 4 as full-stack framework; Prisma ORM; PostgreSQL DB; Docker Compose for local environment. [Source: architecture/tech-stack.md#3. Tech Stack (Revised)]
-
Project Structure
- Monorepo layout integrates
app/(Nuxt),server/(Nitro APIs), andprisma/(ORM). Key files:nuxt.config.ts,docker-compose.yml,prisma/schema.prisma. [Source: architecture/unified-project-structure.md#6. Unified Project Structure] - SCSS structure and global import via
nuxt.config.tscssarray; partials underapp/assets/scss/. [Source: architecture/project-structure.md#3. Project Structure]
- Monorepo layout integrates
-
Component Standards
- Use
<script setup lang="ts">, organize code sections (imports, props/emits, state, computed, lifecycle, methods). Follow naming conventions: components in PascalCase, composablesuseX. [Source: architecture/component-standards.md#4. Component Standards]
- Use
-
Testing Requirements
- Vitest for unit tests;
@vue/test-utilsfor component tests. Place tests adjacent to source files with.spec.ts. [Source: architecture/testing-requirements.md#8. Testing Requirements]
- Vitest for unit tests;
-
Data Models
- PRD requires tables for "Main Ledger" and "Registry". No specific schema is defined in architecture docs; define pragmatic initial fields to satisfy PRD and future extensibility. [Source: prd/epic-1-the-foundation-genesis-citizen-zero.md#Story 1.1]
-
Previous Story Insights
- None (this is the first story).
-
API Specifications
- Not in scope for this story; focus on DB readiness and app boot.
-
Technical Constraints
- Node 20+, Nuxt 4, SSR-safe usage of Prisma on server side. Ensure
.envis not committed.
- Node 20+, Nuxt 4, SSR-safe usage of Prisma on server side. Ensure
Project Structure Notes
- The current repository already contains a Nuxt 4 app and modules configured in
nuxt.config.ts(PrimeVue and Prisma present). For AC 1, verify baseline instead of creating a brand-new project in this repo. docker-compose.ymldoes not exist yet at the repo root — this story will create it. [Source: architecture/unified-project-structure.md#6. Unified Project Structure]server/directory is not present yet; Nuxt server routes (e.g.,server/api/health.get.ts) should be created per structure guidance. [Source: architecture/unified-project-structure.md#6. Unified Project Structure]prisma/schema.prismacurrently definesUserandPostmodels (baseline). This story introduces tables for "Main Ledger" and "Registry" per PRD 1.1 — add new models/migrations (or refactor if directed by product) without breaking existing code paths.- Prisma Client output is customized to
app/generated/prisma. This can conflict with default imports and@prisma/nuxt. Unify by removing the custom output (preferred) or updating all usages consistently. - Ensure a single Prisma client strategy: either the module composable or
lib/prisma.tssingleton — not both, to avoid multiple instances during HMR.
Testing
- Add unit tests for:
- Prisma connectivity helper or health endpoint returning DB status.
- A sample component using PrimeVue
Buttonto ensure render and interaction.
- Place tests next to sources with
.spec.ts. [Source: architecture/testing-requirements.md#8. Testing Requirements]
Change Log
| Date | Version | Description | Author |
|---|---|---|---|
| 2025-09-01 | v1 | Initial draft created from PRD and Architecture docs | Scrum Master |
Dev Agent Record
- Agent Model Used:
- Debug Log References:
- Completion Notes List:
- File List:
QA Results
- Status: PASS with CONCERNS
- Notes:
- AC1 (Nuxt 4 baseline): Verified.
nuxt.config.tsincludes required modules (@primevue/nuxt-module,@prisma/nuxt, i18n). Project boots expectedly per structure; monorepo note satisfied by current repo layout. - AC2 (Docker Compose):
docker-compose.ymlpresent withpostgresandapp, health checks configured. Concerns:appservice does not expose port 3000; addports: ["3000:3000"]for local access..env.exampleleavesDATABASE_OPEN_PORTblank while compose maps${DATABASE_OPEN_PORT}:5432; define a default (e.g.,5432) or document required value to prevent startup errors.
- AC3 (DB connectivity):
server/api/health.get.tsperformsawait prisma.$queryRaw\SELECT 1`vialib/prisma.ts`. Evidence indicates connectivity path exists; recommend adding an integration test or run validation to confirm live connection. - AC4 (Schema & migrations):
prisma/schema.prismadefinesMainLedgerandRegistry; migration20250901120752_initcreates both tables and indexes. Verified. - AC5 (SCSS & Tailwind): SCSS structure present under
app/assets/scss/and included innuxt.config.ts; Tailwind configured intailwind.config.tswithapp/assets/css/tailwind.cssincluded. Verified. - PrimeVue demo & SSR:
PrimeButtonDemo.vuerendersButtonandDialog. Component testPrimeButtonDemo.spec.tspasses for click interaction. Suggest adding a keyboard activation test (Enter) and verifying SSR logs during a dev run for client-only warnings. - Testing scaffolding: Vitest setup present; example unit tests exist (
test/unit/health.spec.ts, component spec). Verified. - Prisma client strategy: Both
@prisma/nuxt(module enabled) andlib/prisma.tssingleton coexist. To avoid multiple clients during HMR, choose one approach. Since code importslib/prisma.ts, recommend removing@prisma/nuxtfrommodules(or switch fully tousePrismaClient()and removelib/prisma.ts). - Nuxt modules hygiene:
nuxt.config.tsincludes both@nuxt/test-utilsand@nuxt/test-utils/module; keep only@nuxt/test-utils/moduleto avoid duplication. - A11y spot-check:
Buttonincludestype="button"and keyboard handler; htmllangset inapp.head. No blocking a11y issues noted for this scope. - Google Fonts: Using
@nuxtjs/google-fonts. Ensure preconnect is active (module typically injects it); verify in head during runtime. - Gate Decision: PASS with CONCERNS. Provide
qa.qaLocationto emit gate file atqa.qaLocation/gates/epic-1.1-project-initialization-main-ledger.yml; otherwise, we can default todocs/qa/gates/if approved.
- AC1 (Nuxt 4 baseline): Verified.