# Projects Specification

> Generated by openlore v1.0.0 on 2025-06-15
> Source files: src/projects/project-model.ts, src/projects/project-service.ts

## Purpose

Manages projects that group tasks together, including membership and archival.

## Entities

### Project

| Property | Type | Description |
|----------|------|-------------|
| id | string | Unique project identifier (format: proj_{timestamp}) |
| name | string | Project name (required, trimmed) |
| description | string | Description (defaults to "") |
| ownerId | string | User who created the project |
| members | string[] | User IDs with access (owner is auto-added) |
| isArchived | boolean | Whether the project is archived |

## Requirements

### Requirement: ProjectCreation

The system SHALL create projects with a required name, auto-adding the creator as owner and first member.

#### Scenario: ValidCreation
- **GIVEN** a valid project name
- **WHEN** createProject is called
- **THEN** the system creates the project with the creator as owner and member

### Requirement: ProjectMembership

The system SHALL allow adding members to a project, preventing duplicate membership.

#### Scenario: DuplicateMember
- **GIVEN** a user who is already a member
- **WHEN** addMember is called
- **THEN** the system throws "User is already a member"

### Requirement: ProjectArchival

The system SHALL allow only the project owner to archive a project.

#### Scenario: NonOwnerArchival
- **GIVEN** a user who is not the project owner
- **WHEN** archiveProject is called
- **THEN** the system throws "Only the owner can archive a project"

## Technical Notes

- **Implementation**: `src/projects/project-model.ts`, `src/projects/project-service.ts`
- **Dependencies**: auth domain
