denisgay/.kiro/steering/structure.md
2025-11-12 23:53:05 +07:00

1.6 KiB

inclusion
inclusion
always

Project Structure

Directory Layout

/
├── src/
│   └── index.js          # Main application entry point
├── public/
│   ├── index.html        # Frontend web interface
│   └── photo_*.jpg       # Profile photo asset
├── quotes/
│   └── quotes.json       # Generated quotes storage (gitignored)
├── .env                  # Environment variables (gitignored)
├── .env.example          # Environment template
└── package.json          # Dependencies and scripts

Architecture

Backend (src/index.js)

  • Express server with CORS enabled
  • Static file serving from public/
  • Cron job for hourly quote generation
  • REST API endpoints for quote operations

Frontend (public/index.html)

  • Single-page application
  • Vanilla JavaScript (no framework)
  • Inline CSS with gradient theme
  • Auto-refresh every 60 seconds

API Endpoints

  • GET /api/quotes - Retrieve all quotes (reversed order)
  • POST /api/generate - Manually trigger quote generation
  • POST /api/quotes/:index/react - Add emoji reaction to quote
  • POST /api/quotes/:index/comment - Add comment to quote (implemented but not used in UI)

Data Model

Quote object structure:

{
  "timestamp": "ISO 8601 date string",
  "quote": "Quote text in Russian",
  "reactions": { "emoji": count },
  "comments": [{ "id", "author", "text", "timestamp" }]
}

Conventions

  • CommonJS module system (require/module.exports)
  • Synchronous file operations for data persistence
  • Error logging to console
  • Process exits on missing API key