Files
SYSTEM/docs/prd/epic-1-the-foundation-genesis-citizen-zero.md
2025-09-01 01:52:06 +03:00

3.2 KiB

6. Epic 1: The Foundation - "Община" Genesis & Citizen Zero

Epic Goal: To establish the absolute core of the system. This includes the initial project setup, the database schema for "The Main Ledger", and the complete, secure onboarding flow for the very first "Citizen" (the Initiator). The ultimate goal of this epic is a running, deployable application that can securely support a single, authenticated user, creating the foundation for all future functionality.

Story 1.1: Project Initialization & The Main Ledger

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 new 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.

Story 1.2: Genesis - First Citizen Creation

As a first-time user (Initiator), I want to be guided through creating a new "Община" and my "Citizen" identity, so that I can become the first registered member and start using the system.

Acceptance Criteria:

  1. When the application is launched in an empty state (no Citizens in the Registry), it must display a "Create Община" welcome screen.
  2. The user is guided through a process that generates a new Ed25519 public/private key pair on the client-side.
  3. The application must present the newly generated private key to the user for them to copy and save, displaying a prominent warning about the importance of keeping it secure and the consequences of its loss.
  4. The user must be able to provide a name, which will be associated with their new public key in the "Registry".
  5. Upon submission, a CITIZEN_CREATED transaction, signed with the new private key, must be successfully recorded as the first entry in "The Main Ledger".

Story 1.3: Authenticated Session & Dashboard Placeholder

As a newly created Initiator, I want my session to be securely authenticated using my private key, so that I can access the main application interface and perform actions on behalf of my "Citizen" identity.

Acceptance Criteria:

  1. After successfully creating a "Citizen" identity, the user is automatically redirected to a main dashboard view.
  2. The private key must be securely stored for the duration of the browser session in a script-accessible, non-persistent manner (e.g., in-memory variable).
  3. The main dashboard must be a protected route, inaccessible to unauthenticated users.
  4. The dashboard must display a simple welcome message that includes the "Citizen's" name from the "Registry" to confirm successful authentication.
  5. Any future actions initiated from the UI must be able to access the session's private key to sign transactions.