Files
Julien Lengrand-Lambert 16ae2a1430 Creating the project
2025-11-11 10:06:56 +01:00

132 lines
7.3 KiB
Markdown

# Implementation Plan: Christmas Checker Website
**Branch**: `001-christmas-checker` | **Date**: 2025-11-11 | **Spec**: [spec.md](spec.md)
**Input**: Feature specification from `/specs/001-christmas-checker/spec.md`
**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/commands/plan.md` for the execution workflow.
## Summary
A simple, delightful website that tells users whether today is Christmas Day (December 25th-26th). On non-Christmas days (363 days/year), displays "NO" with a sad smiley face. On Christmas (2 days/year), displays "YES" with festive falling snow animation using Canvas API. The website uses client-side date checking with user's local timezone, works offline, and includes automatic midnight transitions via page reload.
## Technical Context
**Language/Version**: Java 21 (backend), Vanilla JavaScript ES6+ (frontend)
**Primary Dependencies**: Java stdlib HttpServer (backend), nginx (frontend serving), Docker Compose (orchestration)
**Storage**: N/A (ephemeral, no persistence required)
**Testing**: Optional - not explicitly requested in specification
**Target Platform**: Linux containers (backend: eclipse-temurin:21-jre-alpine, frontend: nginx:alpine)
**Project Type**: Web application (backend + frontend)
**Performance Goals**: <1s date check, <2s page load, 30-60 FPS snow animation
**Constraints**: <2s page load on broadband, responsive 320px-1920px+, prefers-reduced-motion support
**Scale/Scope**: Single-page application, 2 user stories, minimal dependencies (YAGNI)
## Constitution Check
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
### Principle I: User Story-Driven Development ✅ PASS
- ✅ Two prioritized user stories (P1: Non-Christmas day, P2: Christmas day)
- ✅ Each story independently testable and deployable
- ✅ Given/When/Then acceptance scenarios provided
- ✅ MVP = P1 story (363 days/year coverage)
### Principle II: Specification-First Planning ✅ PASS
- ✅ spec.md includes user stories, functional requirements, success criteria
- ✅ plan.md (this file) includes technical context and constitution check
- ✅ research.md, data-model.md, contracts/ generated in Phases 0-1
- ✅ Specification uses technology-agnostic language focused on "what"
### Principle III: Test-Optional with Clear Intent ✅ PASS
- ✅ Tests not explicitly requested in specification
- ✅ Task list will mark any test tasks as "OPTIONAL - only if tests requested"
- ✅ No TDD cycle required for this feature
### Principle IV: Independent User Story Implementation ✅ PASS
- ✅ Two user stories can be implemented independently
- ✅ Foundational phase will establish shared infrastructure (date checking, page structure)
- ✅ P1 can deploy without P2 (show "NO" always, skip snow animation)
- ✅ P2 adds snow animation without modifying P1 logic
### Principle V: Simplicity and Justified Complexity ✅ PASS
- ✅ Minimal dependencies: Java stdlib (no Spring), vanilla JS (no React)
- ✅ Client-side date checking (simplest approach, no server roundtrip)
- ✅ Docker Compose (requested by user for deployment)
- ✅ nginx for static files (standard, lightweight)
- ⚠️ Java backend existence: While spec allows offline client-only, plan includes backend API as optional fallback - justification in Complexity Tracking
## Project Structure
### Documentation (this feature)
```text
specs/001-christmas-checker/
├── plan.md # This file (/speckit.plan command output)
├── research.md # Phase 0 output (/speckit.plan command)
├── data-model.md # Phase 1 output (/speckit.plan command)
├── quickstart.md # Phase 1 output (/speckit.plan command)
├── contracts/ # Phase 1 output (/speckit.plan command)
│ └── api.md # REST API contract for /api/christmas endpoint
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
```
### Source Code (repository root)
```text
backend/
├── src/main/java/christmas/
│ ├── ChristmasChecker.java # Date logic (December 25-26 check)
│ ├── ChristmasServer.java # HTTP server (GET /api/christmas)
│ └── Main.java # Entry point
└── tests/ # Optional - not included unless requested
frontend/
├── index.html # UI structure (loading, content, canvas)
├── styles.css # Styling & animations (NO/YES states, snow canvas)
├── script.js # Date check, rendering, Canvas snow animation
└── tests/ # Optional - not included unless requested
docker/
├── Dockerfile.backend # Java 21 multi-stage build
├── Dockerfile.frontend # nginx alpine with static files
├── nginx.conf # nginx configuration (gzip, cache headers)
└── docker-compose.yml # Two services: backend (8080), frontend (80)
.gitignore # Java, IDE, OS patterns
.dockerignore # Exclude specs, docs, IDE files from build context
README.md # Quickstart, features, tech stack
```
**Structure Decision**: Web application pattern selected due to backend (Java API) + frontend (HTML/CSS/JS) separation. Backend provides optional server-side date checking API at `/api/christmas`, though primary flow is client-side. Frontend served via nginx on port 80, backend on port 8080. Docker Compose orchestrates both services with health checks.
## Complexity Tracking
| Violation | Why Needed | Simpler Alternative Rejected Because |
|-----------|------------|-------------------------------------|
| Java backend inclusion | User specified "Java application with minimalistic frontend" and "deployment via docker compose" in planning input. Backend provides consistent server-side fallback for date checking and demonstrates full-stack architecture as requested. | Pure client-side single HTML file would meet functional requirements but contradicts user's explicit request for Java backend component. |
| Docker Compose orchestration | User explicitly requested "deployment is done via docker compose" in planning input. Multi-service setup (backend + frontend) aligns with web application pattern. | Single container with embedded server could work but violates user's specified deployment approach. |
## Phase 1 Complete: Constitution Re-Check
*Re-evaluation after design documents generated*
### All Principles: ✅ PASS
-**Principle I**: User stories remain independent (P1: Non-Christmas day, P2: Christmas day with snow)
-**Principle II**: Complete specification with research.md, data-model.md, contracts/api.md, quickstart.md
-**Principle III**: No tests requested, documentation marks tests as optional
-**Principle IV**: Foundational phase (date checking, page structure) followed by independent user story phases
-**Principle V**: Minimal complexity maintained - Java stdlib only, vanilla JS, Canvas API, no frameworks
**Clarifications Applied**:
- Christmas now includes December 25th AND 26th (Boxing Day) per clarification session
- Midnight transitions use hard reload (location.reload()) per clarification
- Canvas API confirmed for snow animation per clarification
**Ready for Phase 2**: Task generation with `/speckit.tasks`