# Product Requirement Document (PRD) - GreetingApp

## Revision History
| Version | Date | Description | Author |
|---|---|---|---|
| v1.0 | 2026-06-22 | Initial PRD for GreetingApp | Antigravity Orchestrator |

---

## 1. Executive Summary
GreetingApp is a micro-application designed to deliver personalized, localized, and dynamic greetings to users. It adapts to the user's name, current time of day, and language preferences.

## 2. Objectives & Goals
- Provide dynamic greetings based on user local time (Morning, Afternoon, Evening, Night).
- Support multi-language greetings (English, Vietnamese, Japanese).
- Track user greeting history and statistics.
- Expose both CLI and REST API interfaces.

## 3. User Personas & Use Cases
- **End User:** Wants to see a welcoming, contextual message when logging in or using the CLI.
- **Developer:** Wants an easy-to-integrate greeting microservice API for downstream services.

## 4. Functional Requirements
1. **Dynamic Greeting Generation:**
   - Detects local time of user.
   - Personalizes with name (fallback to "Guest").
2. **Localization (i18n):**
   - Supports: English (`en`), Vietnamese (`vi`), Japanese (`ja`).
3. **Greeting Analytics / History:**
   - Stores logs of generated greetings (User, Timestamp, Language).
   - Exposes statistics (e.g., total greetings generated, most active user).
4. **Interfaces:**
   - Command Line Interface (CLI): `awkit greet --name=Alice`
   - REST API endpoint: `GET /api/greet?name=Alice&lang=vi`

## 5. Non-Functional Requirements
- **Performance:** Response time for greeting generation under 50ms.
- **Reliability:** Storage fallback to memory if database/file storage is offline.
- **Extensibility:** Easy configuration to add new languages.

## 6. System Flow & Sequence Diagram
```mermaid
sequenceDiagram
    autonumber
    actor User
    participant Client as CLI / API Client
    participant Engine as Greeting Engine
    participant DB as Storage / History DB

    User->>Client: Triggers greeting command/request (name, lang)
    Client->>Engine: Resolve greeting configuration
    Engine->>Engine: Validate input & detect Time of Day
    Engine->>DB: Log transaction (user, time, format)
    DB-->>Engine: Log confirmation
    Engine->>Client: Return formatted greeting string
    Client->>User: Display greeting output
```
