Commit 5594d8b

bryfry <bryon@fryer.io>
2025-07-20 11:20:28
first 5 tasks
1 parent ec1a0b1
docs/todo/task_1.1.md
@@ -0,0 +1,97 @@
+---
+task_id: "1.1"
+title: "Project Setup and Module Configuration"
+status: "pending"
+priority: "high"
+estimated_effort: "small"
+created: "2025-07-20"
+assigned_to: "pair"
+related_rfds: "RFD 004"
+---
+
+# Task 1.1: Project Setup and Module Configuration
+
+## Summary
+
+Initialize proper Go module structure with buylater.email domain and verify basic project setup.
+
+## Motivation
+
+Following Let's Go Chapter 2.1, we need to establish a solid foundation with proper Go module configuration and a working basic web server. This sets up the project structure for all future development.
+
+## Acceptance Criteria
+
+- [ ] Go module initialized with `github.com/bryfry/buylater` module path
+- [ ] Basic main.go file creates and runs a simple "Hello World" web server
+- [ ] Server starts successfully on port 4000
+- [ ] `go run .` command works without errors
+
+## Technical Requirements
+
+### Implementation Details
+- Use `go mod init github.com/bryfry/buylater` for module initialization
+- Create minimal main.go with HTTP server listening on :4000
+- Include basic logging to show server startup
+
+### Dependencies
+- [ ] Go 1.24.2 installed and working
+- [ ] Project directory structure created
+
+## Testing Strategy
+
+### Unit Tests
+- [ ] Verify go.mod contains correct module path and Go version
+
+### Integration Tests  
+- [ ] Server starts without compilation errors
+
+### Manual Testing
+- [ ] Run `go run .` and verify server starts with log message
+- [ ] Visit http://localhost:4000 and see "Hello World" response
+
+## Definition of Done
+
+- [ ] All acceptance criteria met
+- [ ] All specified tests pass
+- [ ] Code follows project conventions (go fmt, go vet)
+- [ ] No new console errors or warnings
+- [ ] Relevant documentation updated
+- [ ] Human verification completed successfully
+
+## Implementation Notes
+
+### Approach
+Start with the simplest possible HTTP server that demonstrates all three core components (handler, router, server) working together.
+
+### Key Files to Modify
+- `go.mod` - Initialize with correct module path
+- `main.go` - Create basic HTTP server structure
+
+### Potential Risks
+- Module path conflicts if not unique
+- Port 4000 already in use during testing
+
+## Success Metrics
+
+Server responds to HTTP requests on localhost:4000 with "Hello World" message and proper HTTP status codes.
+
+## Related Tasks
+
+- **Blocks**: Task 1.2 (depends on basic project structure)
+- **Blocked by**: None (first task)
+- **Related**: All subsequent tasks depend on this foundation
+
+---
+
+## Implementation Log
+
+*Will be updated during implementation*
+
+---
+
+## Final Verification
+
+**Human Tester**: [Name]  
+**Date Completed**: [YYYY-MM-DD]  
+**Verification Result**: [Pass/Fail]  
+**Notes**: [Any issues found or additional observations]
\ No newline at end of file
docs/todo/task_1.2.md
@@ -0,0 +1,99 @@
+---
+task_id: "1.2"
+title: "Basic Web Application Structure"
+status: "pending"
+priority: "high"
+estimated_effort: "small"
+created: "2025-07-20"
+assigned_to: "pair"
+related_rfds: "RFD 004"
+---
+
+# Task 1.2: Basic Web Application Structure
+
+## Summary
+
+Implement the three essential web application components: handler, router, and web server with proper Go conventions.
+
+## Motivation
+
+Following Let's Go Chapter 2.2, we need to establish the foundational web application architecture that will support all buylater.email functionality. This creates the proper separation between handlers, routing, and server management.
+
+## Acceptance Criteria
+
+- [ ] Handler function with proper `(w http.ResponseWriter, r *http.Request)` signature
+- [ ] ServeMux router initialized with `http.NewServeMux()`
+- [ ] Web server listening on port 4000 using `http.ListenAndServe()`
+- [ ] Basic logging added to show server startup message
+- [ ] Clean separation between handler logic and server setup
+
+## Technical Requirements
+
+### Implementation Details
+- Create dedicated handler function following Go conventions
+- Use `http.NewServeMux()` for explicit router creation
+- Add proper error handling for `http.ListenAndServe()`
+- Include startup logging with port information
+
+### Dependencies
+- [ ] Task 1.1 completed (basic project setup)
+
+## Testing Strategy
+
+### Unit Tests
+- [ ] Handler function returns expected response
+- [ ] Handler writes correct HTTP status codes
+
+### Integration Tests  
+- [ ] Router correctly maps requests to handlers
+
+### Manual Testing
+- [ ] Server starts and displays startup log message
+- [ ] Home page responds with simple HTML content
+- [ ] Browser developer tools show correct HTTP headers
+
+## Definition of Done
+
+- [ ] All acceptance criteria met
+- [ ] All specified tests pass
+- [ ] Code follows project conventions (go fmt, go vet)
+- [ ] No new console errors or warnings
+- [ ] Relevant documentation updated
+- [ ] Human verification completed successfully
+
+## Implementation Notes
+
+### Approach
+Build on Task 1.1 by refactoring the simple HTTP server into properly separated components that follow Go web development best practices.
+
+### Key Files to Modify
+- `main.go` - Refactor to use proper handler functions and ServeMux
+
+### Potential Risks
+- Breaking existing functionality from Task 1.1
+- Handler signature errors causing compilation issues
+
+## Success Metrics
+
+Web server starts cleanly, logs startup message, and serves requests through proper handler/router architecture.
+
+## Related Tasks
+
+- **Blocks**: Task 1.3 (multiple routes depend on proper router setup)
+- **Blocked by**: Task 1.1 (needs basic project structure)
+- **Related**: Foundation for all HTTP handling in the application
+
+---
+
+## Implementation Log
+
+*Will be updated during implementation*
+
+---
+
+## Final Verification
+
+**Human Tester**: [Name]  
+**Date Completed**: [YYYY-MM-DD]  
+**Verification Result**: [Pass/Fail]  
+**Notes**: [Any issues found or additional observations]
\ No newline at end of file
docs/todo/task_1.3.md
@@ -0,0 +1,101 @@
+---
+task_id: "1.3"
+title: "Multiple Route Implementation"
+status: "pending"
+priority: "high"
+estimated_effort: "medium"
+created: "2025-07-20"
+assigned_to: "pair"
+related_rfds: "RFD 003"
+---
+
+# Task 1.3: Multiple Route Implementation
+
+## Summary
+
+Add multiple routes for buylater.email core functionality with proper routing patterns and 404 handling.
+
+## Motivation
+
+Following Let's Go Chapter 2.3, we need to implement the core user-facing routes that will support the buylater.email service. This establishes the URL structure and navigation patterns for email subscription management.
+
+## Acceptance Criteria
+
+- [ ] Home route `GET /{$}` displays landing page
+- [ ] Subscribe route `GET /subscribe` shows subscription form placeholder
+- [ ] Manage route `GET /manage` shows management page placeholder  
+- [ ] Unsubscribe route `GET /unsubscribe` shows unsubscribe form placeholder
+- [ ] 404 responses for undefined routes work correctly
+- [ ] Each route returns unique, identifiable content
+
+## Technical Requirements
+
+### Implementation Details
+- Use `{$}` syntax for exact home route matching
+- Create separate handler functions for each route
+- Implement proper 404 handling for undefined routes
+- Return simple HTML content that clearly identifies each page
+
+### Dependencies
+- [ ] Task 1.2 completed (basic web application structure)
+
+## Testing Strategy
+
+### Unit Tests
+- [ ] Each handler function returns expected content
+- [ ] Route registration works correctly
+
+### Integration Tests  
+- [ ] Router correctly maps URLs to appropriate handlers
+
+### Manual Testing
+- [ ] Each route returns unique, identifiable content
+- [ ] Undefined routes return 404 status
+- [ ] All routes accessible via browser navigation
+- [ ] Home page accessible at both `/` and exact root
+
+## Definition of Done
+
+- [ ] All acceptance criteria met
+- [ ] All specified tests pass
+- [ ] Code follows project conventions (go fmt, go vet)
+- [ ] No new console errors or warnings
+- [ ] Relevant documentation updated
+- [ ] Human verification completed successfully
+
+## Implementation Notes
+
+### Approach
+Create the basic URL structure that matches the buylater.email user flow: landing page → subscription → management → unsubscription.
+
+### Key Files to Modify
+- `main.go` - Add multiple route handlers and registrations
+
+### Potential Risks
+- Route conflicts or overlapping patterns
+- Incorrect use of exact vs subtree matching
+
+## Success Metrics
+
+All core user paths are accessible via clean URLs that will support the full buylater.email workflow.
+
+## Related Tasks
+
+- **Blocks**: Task 1.4 (wildcard routes build on basic routing)
+- **Blocked by**: Task 1.2 (needs proper router setup)
+- **Related**: Task 1.5 (method-based routing extends these routes)
+
+---
+
+## Implementation Log
+
+*Will be updated during implementation*
+
+---
+
+## Final Verification
+
+**Human Tester**: [Name]  
+**Date Completed**: [YYYY-MM-DD]  
+**Verification Result**: [Pass/Fail]  
+**Notes**: [Any issues found or additional observations]
\ No newline at end of file
docs/todo/task_1.4.md
@@ -0,0 +1,104 @@
+---
+task_id: "1.4"
+title: "Wildcard Routes and Token Management"
+status: "pending"
+priority: "high"
+estimated_effort: "medium"
+created: "2025-07-20"
+assigned_to: "pair"
+related_rfds: "RFD 003"
+---
+
+# Task 1.4: Wildcard Routes and Token Management
+
+## Summary
+
+Implement wildcard routing for subscription management tokens and basic token validation to support secure subscription management.
+
+## Motivation
+
+Following Let's Go Chapter 2.4, we need to implement the core security mechanism for buylater.email: token-based subscription management. This allows users to manage their subscriptions without passwords through secure, unique URLs.
+
+## Acceptance Criteria
+
+- [ ] Route pattern `GET /manage/{token}` accepts token parameter
+- [ ] Token extraction using `r.PathValue("token")` works correctly
+- [ ] Basic token validation (length, format) implemented
+- [ ] Invalid tokens return 404 with helpful error message
+- [ ] Valid tokens show management interface placeholder
+- [ ] Tokens must be at least 32 characters alphanumeric
+
+## Technical Requirements
+
+### Implementation Details
+- Use wildcard route pattern `/manage/{token}` 
+- Extract token with `r.PathValue("token")`
+- Validate token format: alphanumeric, minimum 32 characters
+- Return structured error responses for invalid tokens
+- Create placeholder management interface for valid tokens
+
+### Dependencies
+- [ ] Task 1.3 completed (multiple route implementation)
+
+## Testing Strategy
+
+### Unit Tests
+- [ ] Token validation function works correctly
+- [ ] Valid tokens return success response
+- [ ] Invalid tokens return appropriate errors
+
+### Integration Tests  
+- [ ] Wildcard route correctly extracts token values
+
+### Manual Testing
+- [ ] Valid token URLs (32+ chars) show management page
+- [ ] Invalid token URLs return 404
+- [ ] Empty or malformed tokens handled gracefully
+- [ ] URL patterns like `/manage/abc123...` work correctly
+
+## Definition of Done
+
+- [ ] All acceptance criteria met
+- [ ] All specified tests pass
+- [ ] Code follows project conventions (go fmt, go vet)
+- [ ] No new console errors or warnings
+- [ ] Relevant documentation updated
+- [ ] Human verification completed successfully
+
+## Implementation Notes
+
+### Approach
+Implement the token-based security model that will be core to buylater.email's password-free design. Focus on validation and error handling.
+
+### Key Files to Modify
+- `main.go` - Add wildcard route handler and token validation function
+
+### Potential Risks
+- Token validation too strict or too loose
+- Security issues with token format
+- Route conflicts with existing patterns
+
+## Success Metrics
+
+Users can access subscription management through secure token URLs, with clear error messages for invalid tokens.
+
+## Related Tasks
+
+- **Blocks**: Task 1.5 (method-based routing for token management)
+- **Blocked by**: Task 1.3 (needs basic routing structure)
+- **Related**: Future authentication and security tasks
+
+---
+
+## Implementation Log
+
+*Will be updated during implementation*
+
+---
+
+## Final Verification
+
+**Human Tester**: [Name]  
+**Date Completed**: [YYYY-MM-DD]  
+**Verification Result**: [Pass/Fail]  
+**Notes**: [Any issues found or additional observations]
\ No newline at end of file
docs/todo/task_1.5.md
@@ -0,0 +1,105 @@
+---
+task_id: "1.5"
+title: "HTTP Method-Based Routing"
+status: "pending"
+priority: "high"
+estimated_effort: "medium"
+created: "2025-07-20"
+assigned_to: "pair"
+related_rfds: "RFD 003"
+---
+
+# Task 1.5: HTTP Method-Based Routing
+
+## Summary
+
+Implement proper HTTP method routing for form display and submission handling across all buylater.email user flows.
+
+## Motivation
+
+Following Let's Go Chapter 2.5, we need to implement proper HTTP semantics for the buylater.email service. This establishes the foundation for form handling and follows REST principles for a professional web service.
+
+## Acceptance Criteria
+
+- [ ] `GET /subscribe` displays subscription form
+- [ ] `POST /subscribe` processes subscription (placeholder)
+- [ ] `GET /unsubscribe` displays unsubscribe form  
+- [ ] `POST /unsubscribe` processes unsubscription (placeholder)
+- [ ] `POST /manage/{token}` updates subscription settings (placeholder)
+- [ ] Automatic 405 Method Not Allowed for unsupported methods
+- [ ] Forms have proper action attributes and method settings
+
+## Technical Requirements
+
+### Implementation Details
+- Use method prefixes in route patterns: `"GET /subscribe"`, `"POST /subscribe"`
+- Create separate handlers for GET (display) and POST (process) operations
+- Include basic HTML forms in GET responses
+- Add placeholder processing logic for POST handlers
+- Ensure proper HTTP status codes and responses
+
+### Dependencies
+- [ ] Task 1.4 completed (wildcard routes and token management)
+
+## Testing Strategy
+
+### Unit Tests
+- [ ] Each method handler returns appropriate content type
+- [ ] POST handlers accept form data correctly
+
+### Integration Tests  
+- [ ] Method routing works correctly for all endpoints
+
+### Manual Testing
+- [ ] GET routes display appropriate forms
+- [ ] POST routes accept form submissions
+- [ ] Wrong HTTP methods return 405 status
+- [ ] Forms have proper action attributes and method settings
+- [ ] Browser developer tools show correct request methods
+
+## Definition of Done
+
+- [ ] All acceptance criteria met
+- [ ] All specified tests pass
+- [ ] Code follows project conventions (go fmt, go vet)
+- [ ] No new console errors or warnings
+- [ ] Relevant documentation updated
+- [ ] Human verification completed successfully
+
+## Implementation Notes
+
+### Approach
+Complete the foundational web architecture by implementing proper HTTP method handling that will support form-based user interactions in buylater.email.
+
+### Key Files to Modify
+- `main.go` - Add method-specific route handlers and basic HTML forms
+
+### Potential Risks
+- Form handling complexity
+- Incorrect HTTP method semantics
+- Missing CSRF protection (future task)
+
+## Success Metrics
+
+All user flows support proper form display and submission with correct HTTP methods and automatic error handling for unsupported methods.
+
+## Related Tasks
+
+- **Blocks**: Future form processing and validation tasks
+- **Blocked by**: Task 1.4 (needs wildcard token routes)
+- **Related**: Foundation for all user interaction in buylater.email
+
+---
+
+## Implementation Log
+
+*Will be updated during implementation*
+
+---
+
+## Final Verification
+
+**Human Tester**: [Name]  
+**Date Completed**: [YYYY-MM-DD]  
+**Verification Result**: [Pass/Fail]  
+**Notes**: [Any issues found or additional observations]
\ No newline at end of file
docs/todo/template.md
@@ -0,0 +1,101 @@
+---
+task_id: "[X.Y]"
+title: "[Brief descriptive title]"
+status: "pending"
+priority: "medium"
+estimated_effort: "[small|medium|large]"
+created: "[YYYY-MM-DD]"
+assigned_to: "[person|pair]"
+related_rfds: "[RFD numbers if applicable]"
+---
+
+# Task [X.Y]: [Title]
+
+## Summary
+
+[One sentence description of what this task accomplishes]
+
+## Motivation
+
+[Why is this task necessary? What problem does it solve?]
+
+## Acceptance Criteria
+
+- [ ] [Specific, testable requirement 1]
+- [ ] [Specific, testable requirement 2]
+- [ ] [Specific, testable requirement 3]
+
+## Technical Requirements
+
+### Implementation Details
+- [Key technical constraint or requirement 1]
+- [Key technical constraint or requirement 2]
+
+### Dependencies
+- [ ] [Other task that must be completed first]
+- [ ] [External dependency or setup requirement]
+
+## Testing Strategy
+
+### Unit Tests
+- [ ] [Specific unit test requirement]
+
+### Integration Tests  
+- [ ] [Specific integration test requirement]
+
+### Manual Testing
+- [ ] [Manual verification steps]
+- [ ] [User experience validation]
+
+## Definition of Done
+
+- [ ] All acceptance criteria met
+- [ ] All specified tests pass
+- [ ] Code follows project conventions (go fmt, go vet)
+- [ ] No new console errors or warnings
+- [ ] Relevant documentation updated
+- [ ] Human verification completed successfully
+
+## Implementation Notes
+
+### Approach
+[High-level implementation approach or strategy]
+
+### Key Files to Modify
+- `[file1.go]` - [what changes]
+- `[file2.go]` - [what changes]
+
+### Potential Risks
+- [Risk 1 and mitigation strategy]
+- [Risk 2 and mitigation strategy]
+
+## Success Metrics
+
+[How will we know this task was successful? What should be observable?]
+
+## Related Tasks
+
+- **Blocks**: [Tasks that depend on this one]
+- **Blocked by**: [Tasks this one depends on]
+- **Related**: [Tasks that are related but not blocking]
+
+---
+
+## Implementation Log
+
+### [Date] - [Status Update]
+- [Progress note]
+- [Issue encountered and resolution]
+
+### [Date] - [Status Update]  
+- [Progress note]
+- [Decision made]
+
+---
+
+## Final Verification
+
+**Human Tester**: [Name]  
+**Date Completed**: [YYYY-MM-DD]  
+**Verification Result**: [Pass/Fail]  
+**Notes**: [Any issues found or additional observations]
\ No newline at end of file
docs/CLAUDE.md
@@ -98,7 +98,7 @@ This project follows a formal RFD process for documenting and discussing technic
 
 ## Development Notes
 
-- Module name: `github.com/bryfry/buylater.email`
+- Module name: `github.com/bryfry/buylater`
 - Go version: 1.24.2
 - No external dependencies currently defined in go.mod
 - The codebase is minimal and appears to be in the initial setup phase
docs/project_plan.md
@@ -0,0 +1,45 @@
+# `buylater.email` - Phase 1 Project Plan
+
+## Overview
+
+Phase 1 lays the groundwork by methodically working through the Let’s Go book, chapter by chapter. The focus is on slow, deliberate development—building core features with clarity, clean code, and solid architectural foundations. This phase is not about polish, but about deeply understanding Go and setting up the project for future expansion and professional refinement.
+
+## Task Status Legend
+
+ - Pending - Not started
+ - In Progress - Currently being worked on
+ - Completed - Implemented and verified
+ - Testing - Implementation complete, awaiting verification
+
+## Tasks
+
+### Task 1.1: Project Setup and Module Configuration
+**Status**: Pending  
+**Effort**: Small  
+**Chapter**: Let's Go 2.1  
+**Details**: [docs/todo/task_1.1.md](todo/task_1.1.md)
+
+### Task 1.2: Basic Web Application Structure  
+**Status**: Pending  
+**Effort**: Small  
+**Chapter**: Let's Go 2.2  
+**Details**: [docs/todo/task_1.2.md](todo/task_1.2.md)
+
+### Task 1.3: Multiple Route Implementation
+**Status**: Pending  
+**Effort**: Medium  
+**Chapter**: Let's Go 2.3  
+**Details**: [docs/todo/task_1.3.md](todo/task_1.3.md)
+
+### Task 1.4: Wildcard Routes and Token Management
+**Status**: Pending  
+**Effort**: Medium  
+**Chapter**: Let's Go 2.4  
+**Details**: [docs/todo/task_1.4.md](todo/task_1.4.md)
+
+### Task 1.5: HTTP Method-Based Routing
+**Status**: Pending  
+**Effort**: Medium  
+**Chapter**: Let's Go 2.5  
+**Details**: [docs/todo/task_1.5.md](todo/task_1.5.md)
+