From 9b162d5d6f199f87ae531573165ed9faec08934a Mon Sep 17 00:00:00 2001 From: h Date: Mon, 1 Sep 2025 14:22:23 +0300 Subject: [PATCH] docs(agile): draft story 1.1 --- .../1.1.project-initialization-main-ledger.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 docs/stories/1.1.project-initialization-main-ledger.md diff --git a/docs/stories/1.1.project-initialization-main-ledger.md b/docs/stories/1.1.project-initialization-main-ledger.md new file mode 100644 index 0000000..d1a93b8 --- /dev/null +++ b/docs/stories/1.1.project-initialization-main-ledger.md @@ -0,0 +1,121 @@ +# Story 1.1: Project Initialization & The Main Ledger + +## Status + +Approved + +## 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 + +1. A Nuxt 4 project is successfully created and configured in a monorepo. +2. A `docker-compose.yml` file is created to run the Nuxt application and a PostgreSQL database service. +3. The Nuxt application can successfully connect to the PostgreSQL database on startup. +4. The initial database schema, including tables for "The Main Ledger" and "The Registry", is created via a migration script. +5. 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.ts` modules include `@primevue/nuxt-module` and `@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.yml` at repository root to run services: + - [ ] `web`: Nuxt app (dev) with proper ports and env mounts. + - [ ] `db`: PostgreSQL with named volume and healthcheck. + - [ ] Provide `.env` with `DATABASE_URL` for Postgres (connection string for Prisma). [Source: architecture/unified-project-structure.md#6. Unified Project Structure] + +- [ ] Configure Prisma and database connectivity (AC: 3) + - [ ] Ensure `@prisma/nuxt` module is enabled in `nuxt.config.ts`. + - [ ] Select a single Prisma client usage approach and unify: + - [ ] Prefer `@prisma/nuxt` composable (e.g., `const prisma = usePrismaClient()`), or alternatively retain `lib/prisma.ts` singleton — but do NOT use both. Better `lib/prisma.ts`. + - [ ] Update any imports/usages accordingly to prevent multiple client instances. + - [ ] Set `DATABASE_URL` and run `prisma generate` to produce client. + - [ ] Add a simple health endpoint `server/api/health.get.ts` that pings Prisma (e.g., `await prisma.$queryRaw` or `await 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)] + +- [ ] Define initial database schema and migrations (AC: 4) + - [ ] Design models for "Main Ledger" and "Registry" aligned with PRD. + - [ ] Update `prisma/schema.prisma` accordingly. + - [ ] Run `prisma migrate dev --name init` to 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; add `css: ['~/assets/scss/main.scss']` in `nuxt.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. + +- [ ] PrimeVue verification and demo + - [ ] Render a PrimeVue `Button` and `Dialog` to 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] + +- [ ] Testing scaffolding + - [ ] Ensure Vitest and `@vue/test-utils` are configured. + - [ ] Add example component and composable tests alongside sources with `.spec.ts` files. [Source: architecture/testing-requirements.md#8. Testing Requirements] + +## 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), and `prisma/` (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.ts` `css` array; partials under `app/assets/scss/`. [Source: architecture/project-structure.md#3. Project Structure] + +- **Component Standards** + - Use `