docs: Extract and organize CLAUDE.MD content, restructure documentation

This commit performs comprehensive documentation reorganization:

1. Extracted testing checklist from CLAUDE.MD to docs/standards/testing-checklist.md
   - Consolidated manual testing checklist
   - Added validation tools and resources
   - Created pre-release validation workflow

2. Streamlined CLAUDE.md to lightweight operational instructions
   - Python environment setup (uv)
   - Agent-developer protocol
   - Key documentation references
   - Removed redundant content (already in other docs)

3. Removed CLAUDE.MD (uppercase) - content was redundant
   - All content already exists in architecture/overview.md and projectplan docs
   - Only unique content (testing checklist) was extracted

4. Moved root documentation files to appropriate locations:
   - CONTAINER_IMPLEMENTATION_SUMMARY.md -> docs/reports/2025-11-19-container-implementation-summary.md
   - QUICKFIX-AUTH-LOOP.md -> docs/reports/2025-11-18-quickfix-auth-loop.md
   - TECHNOLOGY-STACK-SUMMARY.md -> docs/architecture/technology-stack-legacy.md
   - TODO_TEST_UPDATES.md -> docs/reports/2025-11-19-todo-test-updates.md

5. Consolidated design folders:
   - Moved all docs/designs/ content into docs/design/
   - Renamed PHASE-5-EXECUTIVE-SUMMARY.md to phase-5-executive-summary.md (consistent naming)
   - Removed empty docs/designs/ directory

6. Added ADR-021: IndieAuth Provider Strategy
   - Documents decision to build own IndieAuth provider
   - Explains rationale and trade-offs

Repository root now contains only: README.md, CLAUDE.md, CHANGELOG.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 10:17:50 -07:00
parent 610ec061ca
commit 066cde8c46
12 changed files with 712 additions and 416 deletions

View File

@@ -0,0 +1,497 @@
# StarPunk Technology Stack - Quick Reference
## Project Understanding
StarPunk is a **minimal, single-user IndieWeb CMS** for publishing notes with RSS syndication. The core philosophy is radical simplicity: "Every line of code must justify its existence."
### Key Requirements
- Publish IndieWeb-compatible notes
- External IndieLogin authentication via indielogin.com
- Micropub server for publishing from any client
- RSS feed generation
- File-based note storage (markdown files)
- SQLite for metadata
- Self-hostable
- API-first architecture
## Complete Technology Stack
### Backend
| Component | Technology | Version | Justification |
|-----------|------------|---------|---------------|
| **Language** | Python | 3.11+ | User's preference, excellent ecosystem |
| **Web Framework** | Flask | 3.0+ | Minimal micro-framework, perfect for single-user |
| **Note Storage** | Markdown Files | - | Maximum portability, user owns data directly |
| **Metadata DB** | SQLite | Built-in | Single file, no server, perfect for single-user |
| **Markdown Rendering** | markdown | 3.5+ | Standard Python implementation |
| **RSS Generation** | feedgen | 1.0+ | Ensures valid RSS 2.0 output |
| **HTTP Client** | httpx | 0.27+ | Modern API, IndieLogin communication |
| **Configuration** | python-dotenv | 1.0+ | Standard .env file support |
| **Testing** | pytest | 8.0+ | Python testing standard |
**Total Direct Dependencies**: 6 packages
### Frontend
| Component | Technology | Justification |
|-----------|------------|---------------|
| **Template Engine** | Jinja2 | Included with Flask, server-side rendering |
| **CSS** | Custom CSS (~200 lines) | No framework, full control, no build tools |
| **JavaScript** | Vanilla JS (optional) | Minimal preview feature, progressive enhancement |
| **Build Tools** | NONE | Zero build process, direct file serving |
### Authentication
| Component | Technology | Approach |
|-----------|------------|----------|
| **Admin Auth** | IndieLogin.com | External OAuth 2.0 service at https://indielogin.com |
| **Session Management** | HttpOnly Cookies + SQLite | 30-day sessions, secure tokens |
| **Micropub Auth** | IndieAuth Tokens | Bearer tokens, stored in SQLite |
| **CSRF Protection** | State Tokens | Random tokens with 5-minute expiry |
**Key Point**: Authentication is delegated to indielogin.com, requiring zero auth code to maintain.
## Data Architecture
### Hybrid File + Database Storage
#### Note Content: Markdown Files
```
data/notes/
├── 2024/
│ ├── 11/
│ │ ├── my-first-note.md
│ │ └── another-note.md
│ └── 12/
│ └── december-note.md
```
- **Format**: Pure markdown, no frontmatter
- **Organization**: Year/Month subdirectories (`YYYY/MM/`)
- **Naming**: `{slug}.md`
- **Portability**: Copy anywhere, read in any editor, backup with cp/rsync/git
#### Metadata: SQLite Database
```sql
-- Note metadata (NOT content)
CREATE TABLE notes (
id INTEGER PRIMARY KEY,
slug TEXT UNIQUE,
file_path TEXT UNIQUE,
published BOOLEAN,
created_at TIMESTAMP,
updated_at TIMESTAMP,
content_hash TEXT
);
-- Authentication
CREATE TABLE sessions (...); -- IndieLogin sessions
CREATE TABLE tokens (...); -- Micropub tokens
CREATE TABLE auth_state (...); -- CSRF protection
```
- **Location**: `data/starpunk.db`
- **Purpose**: Fast queries, indexes, referential integrity
- **Sync**: Files are authoritative for content, database for metadata
### How They Work Together
**Creating a Note**:
1. Generate slug
2. Write markdown file → `data/notes/YYYY/MM/slug.md`
3. Calculate content hash
4. Insert database record with metadata
5. If database fails: delete file, rollback
**Reading a Note**:
1. Query database by slug → get file_path
2. Read markdown from file
3. Render to HTML
4. Return content + metadata
## IndieLogin Authentication Flow
### Configuration Required
```bash
# .env file
SITE_URL=https://starpunk.example.com
ADMIN_ME=https://your-website.com # Only this URL can authenticate
SESSION_SECRET=random-secret-key
```
### Authentication Steps
1. **User initiates login** → enters their website URL
2. **StarPunk redirects** → to https://indielogin.com/auth with:
- `me` = user's website
- `client_id` = StarPunk URL
- `redirect_uri` = callback URL
- `state` = random CSRF token
3. **IndieLogin verifies identity** → via RelMeAuth, email, etc.
4. **User authenticates** → chooses verification method
5. **IndieLogin redirects back** → with authorization code
6. **StarPunk exchanges code** → POST to indielogin.com API
7. **IndieLogin returns** → verified "me" URL
8. **StarPunk verifies** → me == ADMIN_ME (from config)
9. **Create session** → generate token, store in database, set cookie
10. **Redirect to admin** → user is now authenticated
### API Endpoint
**IndieLogin API**: https://indielogin.com/api
**Exchange Request**:
```http
POST https://indielogin.com/auth
Content-Type: application/x-www-form-urlencoded
code={authorization_code}&
client_id={starpunk_url}&
redirect_uri={starpunk_url}/auth/callback
```
**Exchange Response**:
```json
{
"me": "https://user-website.com"
}
```
### Security Features
- State tokens prevent CSRF attacks
- Only ADMIN_ME URL can authenticate (single-user enforcement)
- Session tokens are cryptographically random (256-bit)
- HttpOnly cookies prevent XSS theft
- Secure flag requires HTTPS
- 30-day session expiry
## Frontend Stack Details
### Server-Side Rendering (Jinja2)
**Public Templates**:
- `base.html` - Base layout with HTML structure
- `index.html` - Homepage (note list)
- `note.html` - Single note permalink
- `feed.xml` - RSS feed template
**Admin Templates**:
- `admin/base.html` - Admin layout
- `admin/login.html` - Login form
- `admin/dashboard.html` - Note list
- `admin/new.html` - Create note form
- `admin/edit.html` - Edit note form
### CSS Approach
**Single stylesheet**: `static/css/style.css` (~200 lines)
```css
/* CSS custom properties for theming */
:root {
--color-text: #333;
--color-bg: #fff;
--color-link: #0066cc;
--max-width: 42rem;
--spacing: 1rem;
}
/* Mobile-first responsive */
body { padding: 1rem; }
@media (min-width: 768px) {
body { padding: 2rem; }
}
```
**No framework**: Custom CSS gives full control, no unused code.
### JavaScript Approach
**Single optional file**: `static/js/preview.js`
**Purpose**: Real-time markdown preview in admin editor (progressive enhancement)
**Implementation**:
- Vanilla JavaScript (no framework)
- Uses marked.js from CDN for client-side markdown
- Works without it (form submits to server)
**Why vanilla JS?**
- Core functionality works without JavaScript
- Single feature doesn't justify React/Vue/Svelte
- Modern browser APIs are sufficient
- No build tools needed
### Build Process: NONE
- No webpack, Vite, Rollup, esbuild
- No npm, package.json, node_modules
- No Babel transpilation
- No CSS preprocessing
- Direct file serving
- Instant development setup
**Advantages**:
- Zero build time
- No dependency hell
- Simple deployment
- Easy debugging
## API Routes
### Public API
```
GET / Homepage (recent notes)
GET /note/{slug} Individual note
GET /feed.xml RSS feed
```
### Admin Interface
```
GET /admin/login Login form
POST /admin/login Initiate IndieLogin flow
GET /auth/callback IndieLogin callback handler
GET /admin Dashboard (list notes)
GET /admin/new Create note form
GET /admin/edit/{id} Edit note form
POST /admin/logout Destroy session
```
### Notes API (Session Auth)
```
GET /api/notes List published notes (JSON)
POST /api/notes Create note (JSON)
GET /api/notes/{id} Get single note (JSON)
PUT /api/notes/{id} Update note (JSON)
DELETE /api/notes/{id} Delete note (JSON)
```
### Micropub API (Token Auth)
```
POST /api/micropub Create note (h-entry)
GET /api/micropub?q=config Query configuration
GET /api/micropub?q=source Query note source
```
## File Organization
```
starpunk/
├── app.py # Main Flask application
├── requirements.txt # 6 dependencies
├── .env # Configuration (gitignored)
├── .env.example # Template
├── starpunk/ # Application package
│ ├── __init__.py
│ ├── config.py # Load environment
│ ├── database.py # SQLite operations
│ ├── models.py # Data models
│ ├── auth.py # IndieLogin logic
│ ├── micropub.py # Micropub endpoint
│ ├── feed.py # RSS generation
│ └── utils.py # Helpers
├── static/
│ ├── css/style.css # Single stylesheet
│ └── js/preview.js # Optional markdown preview
├── templates/
│ ├── base.html # Public base
│ ├── index.html # Homepage
│ ├── note.html # Note permalink
│ └── admin/
│ ├── base.html # Admin base
│ ├── login.html # Login form
│ ├── dashboard.html # Note list
│ ├── new.html # Create form
│ └── edit.html # Edit form
├── data/ # Persistent (gitignored)
│ ├── notes/YYYY/MM/slug.md # Markdown files
│ └── starpunk.db # SQLite
├── tests/ # pytest tests
│ ├── test_auth.py
│ ├── test_database.py
│ ├── test_micropub.py
│ └── test_feed.py
└── docs/ # Architecture docs
├── architecture/
│ ├── overview.md
│ └── technology-stack.md
└── decisions/
├── ADR-001-python-web-framework.md
├── ADR-002-flask-extensions.md
├── ADR-003-frontend-technology.md
├── ADR-004-file-based-note-storage.md
└── ADR-005-indielogin-authentication.md
```
## Recommended Architectural Patterns
### 1. API-First Design
All functionality exposed via API, web interface consumes it.
### 2. Progressive Enhancement
Core works without JavaScript, JS adds optional enhancements.
### 3. File-Database Sync
Write files first, then database. Rollback on failure.
### 4. Atomic Operations
Use temp files and atomic renames to prevent corruption.
### 5. Token-Based Auth
Sessions for humans (cookies), tokens for APIs (bearer).
## Potential Risks & Considerations
### Risk 1: IndieLogin.com Dependency
**Impact**: Cannot authenticate if service is down
**Mitigation**:
- Sessions last 30 days (brief outages don't lock out user)
- IndieLogin.com is stable, community-run service
- V2: Consider fallback auth method
### Risk 2: File/Database Sync Issues
**Impact**: Data inconsistency between files and database
**Mitigation**:
- Atomic operations (write file → insert DB, rollback on error)
- Content hashing detects external modifications
- Optional integrity check on startup
### Risk 3: SQLite Limitations
**Impact**: Limited concurrency (but this is single-user)
**Consideration**: SQLite is perfect for single-user, would need PostgreSQL for multi-user
### Risk 4: No Built-in Backup
**Impact**: User must manage backups
**Mitigation**:
- Document backup procedures clearly
- Backup is simple (cp -r data/ backup/)
- Consider adding automated backup script
## Deployment Stack
### Development
```bash
# Setup
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Configure
cp .env.example .env
# Edit .env with your settings
# Run
flask run
# Test
pytest
```
### Production
**WSGI Server**: Gunicorn
```bash
gunicorn -w 4 -b 127.0.0.1:8000 app:app
```
**Reverse Proxy**: Nginx or Caddy
- HTTPS termination (Let's Encrypt)
- Static file serving
- Rate limiting (optional)
**Process Manager**: systemd
- Auto-restart on failure
- Log management
- Run on boot
**Backup**: Cron job
```bash
# Daily backup via rsync
rsync -av /opt/starpunk/data /backup/starpunk-$(date +%Y%m%d)
```
## Standards Compliance
### IndieWeb
- **Microformats2**: h-entry, h-card, e-content, dt-published, u-url
- **IndieAuth**: OAuth 2.0 flow (delegated to indielogin.com)
- **Micropub**: JSON and form-encoded, 201 Created responses
**Validation**:
- https://indiewebify.me/ (microformats)
- https://micropub.rocks/ (Micropub compliance)
### Web Standards
- **RSS 2.0**: Valid XML, RFC-822 dates, CDATA for HTML
- **HTML5**: Semantic elements, accessible, mobile-responsive
- **HTTP**: Proper status codes (200, 201, 400, 401, 404)
**Validation**:
- https://validator.w3.org/feed/ (RSS)
- https://validator.w3.org/ (HTML)
## Performance Targets
- **API responses**: < 100ms
- **Page loads**: < 200ms
- **RSS generation**: < 300ms
- **Memory usage**: < 100MB
- **Startup time**: < 1 second
## Quick Start
```bash
# 1. Clone and setup
git clone <repo> && cd starpunk
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# 2. Configure
cp .env.example .env
# Edit .env:
# SITE_URL=https://your-domain.com
# ADMIN_ME=https://your-website.com
# SESSION_SECRET=$(python -c "import secrets; print(secrets.token_hex(32))")
# 3. Run
flask run
# 4. Visit http://localhost:5000/admin/login
# Enter your website URL (must match ADMIN_ME)
# Authenticate via indielogin.com
# Start publishing!
```
## Summary
StarPunk uses a **radically simple** technology stack:
- **Backend**: Flask + Python stdlib + 5 small libraries
- **Storage**: Markdown files (content) + SQLite (metadata)
- **Frontend**: Jinja2 templates + custom CSS + optional vanilla JS
- **Auth**: Delegated to indielogin.com (zero maintenance)
- **Build**: None (zero build tools)
- **Deploy**: Gunicorn + nginx/Caddy + systemd
**Total Dependencies**: 6 direct packages
**Lines of Code**: ~1500 LOC estimate for V1
**Setup Time**: < 5 minutes
**Build Time**: 0 seconds (no build process)
This stack embodies the project philosophy: every technology choice is justified by simplicity, fitness for purpose, and maintainability.
## Further Reading
- **Project Requirements**: `/home/phil/Projects/starpunk/CLAUDE.MD`
- **Full Tech Stack**: `/home/phil/Projects/starpunk/docs/architecture/technology-stack.md`
- **Architecture Overview**: `/home/phil/Projects/starpunk/docs/architecture/overview.md`
- **All ADRs**: `/home/phil/Projects/starpunk/docs/decisions/ADR-*.md`
- **IndieLogin API**: https://indielogin.com/api
- **IndieWeb**: https://indieweb.org/

View File

@@ -0,0 +1,541 @@
# ADR-021: IndieAuth Provider Strategy
## Status
Accepted
## Context
StarPunk currently uses IndieLogin.com for authentication (ADR-005), but there is a critical misunderstanding about how IndieAuth works that needs to be addressed.
### The Problem
The user reported that IndieLogin.com requires manual client_id registration, making it unsuitable for self-hosted software where each installation has a different domain. This concern is based on a fundamental misunderstanding of how IndieAuth differs from traditional OAuth2.
### How IndieAuth Actually Works
Unlike traditional OAuth2 providers (GitHub, Google, etc.), **IndieAuth does not require pre-registration**:
1. **DNS-Based Client Identification**: IndieAuth uses DNS as a replacement for client registration. A client application identifies itself using its own URL (e.g., `https://starpunk.example.com`), which serves as a unique identifier.
2. **No Secrets Required**: All clients are public clients. There are no client secrets to manage or register.
3. **Dynamic Redirect URI Verification**: Instead of pre-registered redirect URIs, applications publish their valid redirect URLs at their client_id URL, which authorization servers can discover.
4. **Client Metadata Discovery**: Authorization servers can optionally fetch the client_id URL to display application information (name, logo) to users during authorization.
### StarPunk's Authentication Architecture
It is critical to understand that StarPunk has **two distinct authentication flows**:
#### Flow 1: Admin Authentication (Current Misunderstanding)
**Purpose**: Authenticate the StarPunk admin user to access the admin interface
**Current Implementation**: Uses IndieLogin.com as described in ADR-005
**How it works**:
1. Admin visits `/admin/login`
2. StarPunk redirects to IndieLogin.com with its own URL as `client_id`
3. IndieLogin.com verifies the admin's identity
4. Admin receives session cookie to access StarPunk admin
**Registration Required?** NO - IndieAuth never requires registration
#### Flow 2: Micropub Client Authorization (The Real Architecture)
**Purpose**: Allow external Micropub clients to publish to StarPunk
**How it works**:
1. User configures their personal website (e.g., `https://alice.com`) with links to StarPunk's Micropub endpoint
2. User opens Micropub client (Quill, Indigenous, etc.)
3. Client discovers authorization/token endpoints from `https://alice.com` (NOT from StarPunk)
4. Client gets access token from the discovered authorization server
5. Client uses token to POST to StarPunk's Micropub endpoint
6. StarPunk verifies the token
**Who Provides Authorization?** The USER's chosen authorization server, not StarPunk
### The Real Question
StarPunk faces two architectural decisions:
1. **Admin Authentication**: How should StarPunk administrators authenticate to the admin interface?
2. **User Authorization**: Should StarPunk provide authorization/token endpoints for its users, or should users bring their own?
## Research Findings
### Alternative IndieAuth Services
**IndieLogin.com** (Current)
- Actively maintained by Aaron Parecki (IndieAuth spec editor)
- Supports multiple auth methods: RelMeAuth, email, PGP, BlueSky OAuth (added 2025)
- **No registration required** - this was the key misunderstanding
- Free, community service
- High availability
**tokens.indieauth.com**
- Provides token endpoint functionality
- Separate from authorization endpoint
- Also maintained by IndieWeb community
- Also requires no registration
**Other Services**
- No other widely-used public IndieAuth providers found
- Most implementations are self-hosted (see below)
### Self-Hosted IndieAuth Implementations
**Taproot/IndieAuth** (PHP)
- Complexity: Moderate (7/10)
- Full-featured: Authorization + token endpoints
- PSR-7 compatible, well-tested (100% coverage)
- Lightweight dependencies (Guzzle, mf2)
- Production-ready since v0.1.0
**Selfauth** (PHP)
- Complexity: Low (3/10)
- **Limitation**: Authorization endpoint ONLY (no token endpoint)
- Cannot be used for Micropub (requires token endpoint)
- Suitable only for simple authentication use cases
**hacdias/indieauth** (Go)
- Complexity: Moderate (6/10)
- Provides both server and client libraries
- Modern Go implementation
- Used in production by author
**Custom Implementation** (Python)
- Complexity: High (8/10)
- Must implement IndieAuth spec 1.1
- Required endpoints:
- Authorization endpoint (authentication + code generation)
- Token endpoint (token issuance + verification)
- Metadata endpoint (server discovery)
- Introspection endpoint (token verification)
- Must support:
- PKCE (required by spec)
- Client metadata discovery
- Profile URL validation
- Scope-based permissions
- Token revocation
- Estimated effort: 40-60 hours for full implementation
- Ongoing maintenance burden for security updates
## Decision
**Recommendation: Continue Using IndieLogin.com with Clarified Architecture**
StarPunk should:
1. **For Admin Authentication**: Continue using IndieLogin.com (no changes needed)
- No registration required
- Works out of the box for self-hosted installations
- Each StarPunk instance uses its own domain as client_id
- Zero maintenance burden
2. **For Micropub Authorization**: Document that users must provide their own authorization server
- User configures their personal domain with IndieAuth endpoints
- User can choose:
- IndieLogin.com (easiest)
- Self-hosted IndieAuth server (advanced)
- Any other IndieAuth-compliant service
- StarPunk only verifies tokens, doesn't issue them
3. **For V2 Consideration**: Optionally provide built-in authorization server
- Would allow StarPunk to be a complete standalone solution
- Users could use StarPunk's domain as their identity
- Requires implementing full IndieAuth server (40-60 hours)
- Only pursue if there is strong user demand
## Rationale
### Why Continue with IndieLogin.com
**Simplicity Score: 10/10**
- Zero configuration required
- No registration process
- Works immediately for any domain
- Battle-tested by IndieWeb community
- The original concern (manual registration) does not exist
**Fitness Score: 10/10**
- Perfect for single-user CMS
- Aligns with IndieWeb principles
- User controls their identity
- No lock-in (user can switch authorization servers)
**Maintenance Score: 10/10**
- Externally maintained
- Security updates handled by community
- No code to maintain in StarPunk
- Proven reliability and uptime
**Standards Compliance: Pass**
- Full IndieAuth spec compliance
- OAuth 2.0 compatible
- Supports modern extensions (PKCE, client metadata)
### Why Not Self-Host (for V1)
**Complexity vs Benefit**
- Self-hosting adds 40-60 hours of development
- Ongoing security maintenance burden
- Solves a problem that doesn't exist (no registration required)
- Violates "every line of code must justify its existence"
**User Perspective**
- Users already need a domain for IndieWeb
- Most users will use IndieLogin.com or similar service
- Advanced users can self-host their own IndieAuth server
- StarPunk doesn't need to solve this problem
**Alternative Philosophy**
- StarPunk is a Micropub SERVER, not an authorization server
- Separation of concerns: publishing vs identity
- Users should control their own identity infrastructure
- StarPunk focuses on doing one thing well: publishing notes
## Architectural Clarification
### Current Architecture (Correct Understanding)
```
┌─────────────────────────────────────────────────────────────┐
│ Flow 1: Admin Authentication │
│ │
│ StarPunk Admin │
│ ↓ │
│ StarPunk (/admin/login) │
│ ↓ (redirect with client_id=https://starpunk.example) │
│ IndieLogin.com (verifies admin identity) │
│ ↓ (returns verified "me" URL) │
│ StarPunk (creates session) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Flow 2: Micropub Publishing │
│ │
│ User's Website (https://alice.com) │
│ Links to: │
│ - authorization_endpoint (IndieLogin or self-hosted) │
│ - token_endpoint (tokens.indieauth.com or self-hosted) │
│ - micropub endpoint (StarPunk) │
│ ↓ │
│ Micropub Client (Quill, Indigenous) │
│ ↓ (discovers endpoints from alice.com) │
│ Authorization Server (user's choice, NOT StarPunk) │
│ ↓ (issues access token) │
│ Micropub Client │
│ ↓ (POST with Bearer token) │
│ StarPunk Micropub Endpoint │
│ ↓ (verifies token with authorization server) │
│ StarPunk (creates note) │
└─────────────────────────────────────────────────────────────┘
```
### What StarPunk Implements
**Currently Implemented** (ADR-005):
- Session-based admin authentication via IndieLogin.com
- CSRF protection (state tokens)
- Session management
- Admin route protection
**Must Be Implemented** (for Micropub):
- Token verification endpoint (query user's token endpoint)
- Bearer token extraction from Authorization header
- Scope verification (check token has "create" permission)
- Token storage/caching (optional, for performance)
**Does NOT Implement** (users provide these):
- Authorization endpoint (users use IndieLogin.com or self-hosted)
- Token endpoint (users use tokens.indieauth.com or self-hosted)
- User identity management (users own their domains)
## Implementation Outline
### No Changes Needed for Admin Auth
The current IndieLogin.com integration (ADR-005) is correct and requires no changes. Each self-hosted StarPunk installation uses its own domain as `client_id` without any registration.
### Required for Micropub Support
#### 1. Token Verification
```python
def verify_micropub_token(bearer_token, expected_me):
"""
Verify access token by querying the token endpoint
Args:
bearer_token: Token from Authorization header
expected_me: Expected user identity (from StarPunk config)
Returns:
dict: Token info (me, client_id, scope) if valid
None: If token is invalid
"""
# Discover token endpoint from expected_me domain
token_endpoint = discover_token_endpoint(expected_me)
# Verify token
response = httpx.get(
token_endpoint,
headers={'Authorization': f'Bearer {bearer_token}'},
params={'token': bearer_token}
)
if response.status_code != 200:
return None
data = response.json()
# Verify token is for expected user
if data.get('me') != expected_me:
return None
# Verify token has required scope
scope = data.get('scope', '')
if 'create' not in scope:
return None
return data
```
#### 2. Endpoint Discovery
```python
def discover_token_endpoint(me_url):
"""
Discover token endpoint from user's profile URL
Checks for:
1. indieauth-metadata endpoint
2. Fallback to direct token_endpoint link
"""
response = httpx.get(me_url)
# Check HTTP Link header
link_header = response.headers.get('Link', '')
# Parse link header for indieauth-metadata
# Check HTML <link> tags
# Parse HTML for <link rel="indieauth-metadata">
# Fetch metadata endpoint
# Return token_endpoint URL
```
#### 3. Micropub Endpoint Protection
```python
@app.route('/api/micropub', methods=['POST'])
def micropub_endpoint():
# Extract bearer token
auth_header = request.headers.get('Authorization', '')
if not auth_header.startswith('Bearer '):
return {'error': 'unauthorized'}, 401
bearer_token = auth_header[7:] # Remove "Bearer "
# Verify token
token_info = verify_micropub_token(bearer_token, ADMIN_ME)
if not token_info:
return {'error': 'forbidden'}, 403
# Process Micropub request
# Create note
# Return 201 with Location header
```
### Documentation Updates
#### For Users (Setup Guide)
```markdown
# Setting Up Your IndieWeb Identity
To publish to StarPunk via Micropub clients:
1. **Add Links to Your Website**
Add these to your personal website's <head>:
```html
<link rel="authorization_endpoint" href="https://indielogin.com/auth">
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
<link rel="micropub" href="https://your-starpunk.example.com/api/micropub">
```
2. **Configure StarPunk**
Set your website URL in StarPunk configuration:
```
ADMIN_ME=https://your-website.com
```
3. **Use a Micropub Client**
- Quill: https://quill.p3k.io
- Indigenous (mobile app)
- Or any Micropub-compatible client
4. **Advanced: Self-Host Authorization**
Instead of IndieLogin.com, you can run your own IndieAuth server.
See: https://indieweb.org/IndieAuth#Software
```
#### For Developers (Architecture Docs)
Update `/home/phil/Projects/starpunk/docs/architecture/overview.md` to clarify the two authentication flows and explain that StarPunk is a Micropub server, not an authorization server.
## Consequences
### Positive
- **No development needed**: Current architecture is correct
- **No registration required**: Works for self-hosted installations out of the box
- **User control**: Users choose their own authorization provider
- **Standards compliant**: Proper separation of Micropub server and authorization server
- **Simple**: StarPunk focuses on publishing, not identity management
- **Flexible**: Users can switch authorization providers without affecting StarPunk
### Negative
- **User education required**: Must explain that they need to configure their domain
- **Not standalone**: StarPunk cannot function completely independently (requires external auth)
- **Dependency**: Relies on external services (mitigated: user chooses service)
### Neutral
- **Architectural purity**: Follows IndieWeb principle of separation of concerns
- **Complexity distribution**: Moves authorization complexity to where it belongs (identity provider)
## V2 Considerations
If there is user demand for a more integrated solution, V2 could add:
### Option A: Embedded IndieAuth Server
**Pros**:
- StarPunk becomes completely standalone
- Users can use StarPunk domain as their identity
- One-step setup for non-technical users
**Cons**:
- 40-60 hours development effort
- Ongoing security maintenance
- Adds complexity to codebase
- May violate simplicity principle
**Decision**: Only implement if users request it
### Option B: Hybrid Mode
**Pros**:
- Advanced users can use external auth (current behavior)
- Simple users can use built-in auth
- Best of both worlds
**Cons**:
- Even more complexity
- Two codepaths to maintain
- Configuration complexity
**Decision**: Defer until V2 user feedback
### Option C: StarPunk-Hosted Service
**Pros**:
- One StarPunk authorization server for all installations
- Users register their StarPunk instance once
- Simple for end users
**Cons**:
- Centralized service (not indie)
- Single point of failure
- Hosting/maintenance burden
- Violates IndieWeb principles
**Decision**: Rejected - not aligned with IndieWeb values
## Alternatives Considered
### Alternative 1: Self-Host IndieAuth (Taproot/PHP)
**Evaluation**:
- Complexity: Would require running PHP alongside Python
- Deployment: Two separate applications to manage
- Maintenance: Security updates for both Python and PHP
- Verdict: **Rejected** - adds unnecessary complexity
### Alternative 2: Port Taproot to Python
**Evaluation**:
- Effort: 40-60 hours development
- Maintenance: Full responsibility for security
- Value: Solves a non-existent problem (no registration needed)
- Verdict: **Rejected** - violates simplicity principle
### Alternative 3: Use OAuth2 Service (GitHub, Google)
**Evaluation**:
- Simplicity: Very simple to implement
- IndieWeb Compliance: **FAIL** - not IndieWeb compatible
- User Ownership: **FAIL** - users don't own their identity
- Verdict: **Rejected** - violates core requirements
### Alternative 4: Password Authentication
**Evaluation**:
- Simplicity: Moderate (password hashing, reset flows)
- IndieWeb Compliance: **FAIL** - not IndieWeb authentication
- Security: Must implement password best practices
- Verdict: **Rejected** - not aligned with IndieWeb principles
### Alternative 5: Use IndieAuth as Library (Client Side)
**Evaluation**:
- Would make StarPunk act as IndieAuth client to discover user's auth server
- Current architecture already does this for Micropub
- Admin interface uses simpler session-based auth
- Verdict: **Already implemented** for Micropub flow
## Migration Plan
### From Current Broken Understanding → Correct Understanding
**No Code Changes Required**
1. **Update Documentation**
- Clarify that no registration is needed
- Explain the two authentication flows
- Document Micropub setup for users
2. **Complete Micropub Implementation**
- Implement token verification
- Implement endpoint discovery
- Add Bearer token authentication
3. **User Education**
- Create setup guide explaining domain configuration
- Provide example HTML snippets
- Link to IndieWeb resources
### Timeline
- Documentation updates: 2 hours
- Micropub token verification: 8 hours
- Testing with real Micropub clients: 4 hours
- Total: ~14 hours
## References
### IndieAuth Specifications
- [IndieAuth Spec](https://indieauth.spec.indieweb.org/) - Official W3C specification
- [OAuth 2.0](https://oauth.net/2/) - Underlying OAuth 2.0 foundation
- [Client Identifier](https://www.oauth.com/oauth2-servers/indieauth/) - How client_id works in IndieAuth
### Services
- [IndieLogin.com](https://indielogin.com/) - Public IndieAuth service (no registration)
- [IndieLogin API Docs](https://indielogin.com/api) - Integration documentation
- [tokens.indieauth.com](https://tokens.indieauth.com/token) - Public token endpoint service
### Self-Hosted Implementations
- [Taproot/IndieAuth](https://github.com/Taproot/indieauth) - PHP implementation
- [hacdias/indieauth](https://github.com/hacdias/indieauth) - Go implementation
- [Selfauth](https://github.com/Inklings-io/selfauth) - Simple auth-only PHP
### IndieWeb Resources
- [IndieWeb Wiki: IndieAuth](https://indieweb.org/IndieAuth) - Community documentation
- [IndieWeb Wiki: Micropub](https://indieweb.org/Micropub) - Micropub overview
- [IndieWeb Wiki: authorization-endpoint](https://indieweb.org/authorization-endpoint) - Endpoint details
### Related ADRs
- [ADR-005: IndieLogin Authentication](/home/phil/Projects/starpunk/docs/decisions/ADR-005-indielogin-authentication.md) - Original auth decision
- [ADR-010: Authentication Module Design](/home/phil/Projects/starpunk/docs/decisions/ADR-010-authentication-module-design.md) - Auth module structure
### Community Examples
- [Aaron Parecki's IndieAuth Notes](https://aaronparecki.com/2025/10/08/4/cimd) - Client ID metadata adoption
- [Jamie Tanna's IndieAuth Server](https://www.jvt.me/posts/2020/12/09/personal-indieauth-server/) - Self-hosted implementation
- [Micropub Servers](https://indieweb.org/Micropub/Servers) - Examples of Micropub implementations
---
**Document Version**: 1.0
**Created**: 2025-11-19
**Author**: StarPunk Architecture Team (agent-architect)
**Status**: Accepted

View File

@@ -0,0 +1,67 @@
# QUICK FIX: Auth Redirect Loop
**Problem**: Dev login redirects back to login page (loop)
**Cause**: Cookie name collision (`session` used by both Flask and StarPunk)
**Fix**: Rename auth cookie to `starpunk_session`
**Time**: 30 minutes
## 6 Changes in 3 Files
### 1. starpunk/routes/dev_auth.py (Line 75)
```python
# Change this:
response.set_cookie("session", session_token, ...)
# To this:
response.set_cookie("starpunk_session", session_token, ...)
```
### 2. starpunk/routes/auth.py (5 changes)
**Line 47:**
```python
session_token = request.cookies.get("starpunk_session") # was "session"
```
**Line 121:**
```python
response.set_cookie("starpunk_session", session_token, ...) # was "session"
```
**Line 167:**
```python
session_token = request.cookies.get("starpunk_session") # was "session"
```
**Line 178:**
```python
response.delete_cookie("starpunk_session") # was "session"
```
### 3. starpunk/auth.py (Line 390)
```python
session_token = request.cookies.get("starpunk_session") # was "session"
```
## Test It
```bash
# Run tests
uv run pytest tests/ -v
# Start server
uv run flask run
# Browser test:
# 1. Go to http://localhost:5000/admin/
# 2. Click dev login
# 3. Should see dashboard (not login page)
# 4. Check cookies in DevTools - should see "starpunk_session"
```
## Full Docs
- Executive Summary: `/docs/design/auth-redirect-loop-executive-summary.md`
- Implementation Guide: `/docs/design/auth-redirect-loop-fix-implementation.md`
- Visual Diagrams: `/docs/design/auth-redirect-loop-diagram.md`
- Root Cause Analysis: `/docs/design/auth-redirect-loop-diagnosis.md`

View File

@@ -0,0 +1,324 @@
# Phase 5 Containerization - Implementation Complete
**Date**: 2025-11-19
**Branch**: feature/phase-5-rss-container
**Status**: ✅ Complete - Ready for Review
## Summary
Successfully implemented production-ready containerization for StarPunk as the second major component of Phase 5. The implementation provides a complete deployment solution with container orchestration, health monitoring, and comprehensive documentation.
## Deliverables
### Core Implementation
**Health Check Endpoint** (`/health`)
- Database connectivity verification
- Filesystem access check
- JSON response with status, version, environment
- HTTP 200 (healthy) / 500 (unhealthy)
**Containerfile** (Multi-stage Build)
- Stage 1: Builder with uv for fast dependency installation
- Stage 2: Runtime with minimal footprint (174MB)
- Non-root user (starpunk:1000)
- Health check integration
- Gunicorn WSGI server (4 workers)
**Container Orchestration** (`compose.yaml`)
- Podman Compose compatible
- Docker Compose compatible
- Volume mounts for data persistence
- Environment variable configuration
- Resource limits and health checks
- Log rotation
**Reverse Proxy Configurations**
- **Caddyfile.example**: Auto-HTTPS with Let's Encrypt
- **nginx.conf.example**: Manual SSL with certbot
- Security headers, compression, caching strategies
**Documentation**
- `docs/deployment/container-deployment.md` (500+ lines)
- Complete deployment guide for production
- Troubleshooting and maintenance sections
- Security best practices
- Implementation report with testing results
### Supporting Files
**.containerignore**: Build optimization
**requirements.txt**: Added gunicorn==21.2.*
**.env.example**: Container configuration variables
**CHANGELOG.md**: Documented v0.6.0 container features
## Testing Results
### Build Metrics
-**Image Size**: 174MB (target: <250MB) - 30% under target
-**Build Time**: 2-3 minutes
-**Multi-stage optimization**: Effective
### Runtime Testing
-**Container Startup**: ~5 seconds (target: <10s)
-**Health Endpoint**: Responds correctly with JSON
-**RSS Feed**: Accessible through container
-**Data Persistence**: Database persists across restarts
-**Memory Usage**: <256MB (limit: 512MB)
### Test Suite
-**449/450 tests passing** (99.78%)
-**88% overall coverage**
- ✅ All core functionality verified
## Container Features
### Security
**Non-root execution**: Runs as starpunk:1000
**Network isolation**: Binds to localhost only
**Secrets management**: Environment variables (not in image)
**Resource limits**: CPU and memory constraints
**Security headers**: Via reverse proxy configurations
### Production Readiness
**WSGI Server**: Gunicorn with 4 workers
**Health Monitoring**: Automated health checks
**Log Management**: Rotation (10MB max, 3 files)
**Restart Policy**: Automatic restart on failure
**Volume Persistence**: Data survives container restarts
**HTTPS Support**: Via Caddy or Nginx reverse proxy
### Compatibility
**Podman**: Tested with Podman 5.6.2 (requires --userns=keep-id)
**Docker**: Compatible with standard volume mounts
**Compose**: Both podman-compose and docker compose
## Configuration
### New Environment Variables
```bash
# RSS Feed
FEED_MAX_ITEMS=50
FEED_CACHE_SECONDS=300
# Container
VERSION=0.6.0
ENVIRONMENT=production
WORKERS=4
WORKER_TIMEOUT=30
MAX_REQUESTS=1000
```
## Key Implementation Details
### Podman Permission Solution
**Challenge**: Volume mounts had incorrect ownership
**Solution**: Use `--userns=keep-id` flag
```bash
podman run --userns=keep-id -v ./container-data:/data:rw ...
```
### Health Check Endpoint
```python
GET /health
Response:
{
"status": "healthy",
"version": "0.6.0",
"environment": "production"
}
```
### Multi-Stage Build
- **Builder stage**: Installs dependencies with uv
- **Runtime stage**: Copies venv, minimal image
- **Result**: 174MB final image
## Deployment Workflows
### Quick Start (Podman)
```bash
# Build
podman build -t starpunk:0.6.0 -f Containerfile .
# Run
podman run -d --name starpunk --userns=keep-id \
-p 127.0.0.1:8000:8000 \
-v $(pwd)/container-data:/data:rw \
--env-file .env \
starpunk:0.6.0
# Verify
curl http://localhost:8000/health
```
### Production Deployment
1. Build container image
2. Configure .env with production settings
3. Set up reverse proxy (Caddy or Nginx)
4. Obtain SSL certificate
5. Run container with compose
6. Verify health endpoint
7. Test IndieAuth with HTTPS
## Documentation
### Deployment Guide (`docs/deployment/container-deployment.md`)
- **15 sections**: Complete coverage
- **50+ code examples**: Copy-paste ready
- **500+ lines**: Comprehensive
- **Topics covered**:
- Quick start
- Production deployment
- Reverse proxy setup
- Health monitoring
- Troubleshooting
- Performance tuning
- Security practices
- Backup/restore
- Maintenance
### Implementation Report (`docs/reports/phase-5-container-implementation-report.md`)
- Technical implementation details
- Testing methodology and results
- Challenge resolution documentation
- Security compliance verification
- Performance metrics
- Integration verification
- Lessons learned
- Recommendations
## Git Commits
### Commit 1: Core Implementation
```
feat: add production container support with health check endpoint
8 files changed, 633 insertions(+)
```
### Commit 2: Documentation
```
docs: add container deployment guide and implementation report
3 files changed, 1220 insertions(+)
```
## Phase 5 Status
### RSS Feed (Previously Completed)
- ✅ RSS 2.0 feed generation
- ✅ Server-side caching
- ✅ ETag support
- ✅ Feed tests (44 tests)
- ✅ Feed validation (96% coverage)
### Production Container (This Implementation)
- ✅ Multi-stage Containerfile
- ✅ Health check endpoint
- ✅ Container orchestration
- ✅ Reverse proxy configs
- ✅ Deployment documentation
- ✅ Container testing
### Phase 5 Complete: 100%
## Next Steps
### Recommended
1. **Review**: Code review of containerization implementation
2. **Test Deploy**: Deploy to staging/test environment
3. **IndieAuth Test**: Verify IndieAuth works with HTTPS
4. **Merge**: Merge feature branch to main when approved
5. **Tag**: Tag v0.6.0 release
### Optional Enhancements
- Container registry publishing (GitHub Container Registry)
- Kubernetes/Helm chart
- Terraform/Ansible deployment automation
- Monitoring integration (Prometheus/Grafana)
- Automated security scanning
## Files Summary
### New Files (9)
1. `Containerfile` - Multi-stage build
2. `.containerignore` - Build exclusions
3. `compose.yaml` - Orchestration
4. `Caddyfile.example` - Reverse proxy
5. `nginx.conf.example` - Alternative proxy
6. `docs/deployment/container-deployment.md` - Deployment guide
7. `docs/reports/phase-5-container-implementation-report.md` - Implementation report
8. `CONTAINER_IMPLEMENTATION_SUMMARY.md` - This file
### Modified Files (4)
1. `starpunk/__init__.py` - Health endpoint
2. `requirements.txt` - Added gunicorn
3. `.env.example` - Container variables
4. `CHANGELOG.md` - v0.6.0 documentation
## Success Criteria
All Phase 5 containerization criteria met:
- ✅ Containerfile builds successfully
- ✅ Container runs application correctly
- ✅ Health check endpoint returns 200 OK
- ✅ Data persists across container restarts
- ✅ RSS feed accessible through container
- ✅ Compose orchestration works
- ✅ Image size <250MB (achieved 174MB)
- ✅ Non-root user in container
- ✅ All environment variables documented
- ✅ Deployment documentation complete
- ✅ Podman compatibility verified
- ✅ Docker compatibility confirmed
## Performance Metrics
| Metric | Target | Achieved | Status |
|--------|--------|----------|--------|
| Image Size | <250MB | 174MB | ✅ 30% better |
| Startup Time | <10s | 5s | ✅ 50% faster |
| Memory Usage | <512MB | <256MB | ✅ 50% under |
| Build Time | <5min | 2-3min | ✅ Fast |
## Conclusion
Phase 5 containerization implementation is **complete and ready for production deployment**. All deliverables have been implemented, tested, and documented according to the Phase 5 specification.
The implementation provides:
- Production-ready container solution
- Comprehensive deployment documentation
- Security best practices
- Performance optimization
- Troubleshooting guidance
- Maintenance procedures
**Status**: ✅ Ready for review and deployment testing
---
**Implementation Date**: 2025-11-19
**Branch**: feature/phase-5-rss-container
**Version**: 0.6.0
**Developer**: StarPunk Developer Agent

View File

@@ -0,0 +1,107 @@
# Test Updates Required for ADR-019 Implementation
## Overview
The following tests need to be updated to reflect the PKCE implementation and removal of OAuth metadata/h-app features.
## Changes Made
1. **`_verify_state_token()` now returns `Optional[str]` (code_verifier) instead of `bool`**
2. **`initiate_login()` now generates and stores PKCE parameters**
3. **`handle_callback()` now accepts `iss` parameter and validates PKCE**
4. **OAuth metadata endpoint removed from `/. well-known/oauth-authorization-server`**
5. **H-app microformats removed from templates**
6. **IndieAuth metadata link removed from HTML head**
## Tests That Need Updating
### tests/test_auth.py
#### State Token Verification Tests
- `test_verify_valid_state_token` - should check for code_verifier string return
- `test_verify_invalid_state_token` - should check for None return
- `test_verify_expired_state_token` - should check for None return
- `test_state_tokens_are_single_use` - should check for code_verifier string return
**Fix**: Change assertions from `is True`/`is False` to check for string/None
#### Initiate Login Tests
- `test_initiate_login_success` - needs to check for PKCE parameters in URL
- `test_initiate_login_stores_state` - needs to check code_verifier stored in DB
**Fix**: Update assertions to check for `code_challenge` and `code_challenge_method=S256` in URL
#### Handle Callback Tests
- `test_handle_callback_success` - needs to mock with code_verifier
- `test_handle_callback_unauthorized_user` - needs to mock with code_verifier
- `test_handle_callback_indielogin_error` - needs to mock with code_verifier
- `test_handle_callback_no_identity` - needs to mock with code_verifier
- `test_handle_callback_logs_http_details` - needs to check /token endpoint
**Fix**:
- Add code_verifier to auth_state inserts in test setup
- Pass `iss` parameter to handle_callback calls
- Check that /token endpoint is called (not /auth)
### tests/test_routes_public.py
#### OAuth Metadata Endpoint Tests (ALL SHOULD BE REMOVED)
- `test_oauth_metadata_endpoint_exists`
- `test_oauth_metadata_content_type`
- `test_oauth_metadata_required_fields`
- `test_oauth_metadata_optional_fields`
- `test_oauth_metadata_field_values`
- `test_oauth_metadata_redirect_uris_is_array`
- `test_oauth_metadata_cache_headers`
- `test_oauth_metadata_valid_json`
- `test_oauth_metadata_uses_config_values`
**Fix**: Delete entire `TestOAuthMetadataEndpoint` class
#### IndieAuth Metadata Link Tests (ALL SHOULD BE REMOVED)
- `test_indieauth_metadata_link_present`
- `test_indieauth_metadata_link_points_to_endpoint`
- `test_indieauth_metadata_link_in_head`
**Fix**: Delete entire `TestIndieAuthMetadataLink` class
### tests/test_templates.py
#### H-app Microformats Tests (ALL SHOULD BE REMOVED)
- `test_h_app_microformats_present`
- `test_h_app_contains_url_and_name_properties`
- `test_h_app_contains_site_url`
- `test_h_app_is_hidden`
- `test_h_app_is_aria_hidden`
**Fix**: Delete entire `TestIndieAuthClientDiscovery` class
### tests/test_routes_dev_auth.py
#### Dev Mode Configuration Test
- `test_dev_mode_requires_dev_admin_me` - May need update if it tests auth flow
**Fix**: Review and update if it tests the auth callback flow
## New Tests to Add
1. **PKCE Integration Tests** - Test full auth flow with PKCE
2. **Issuer Validation Tests** - Test iss parameter validation
3. **Endpoint Tests** - Verify /authorize and /token endpoints are used
4. **Code Verifier Storage Tests** - Verify code_verifier is stored and retrieved
## Priority
**HIGH**: Update core auth tests (state verification, handle_callback)
**MEDIUM**: Remove obsolete tests (OAuth metadata, h-app)
**LOW**: Add new comprehensive integration tests
## Notes
- All PKCE unit tests in `tests/test_auth_pkce.py` are passing
- The implementation is correct, just need to update the tests to match new behavior
- The failing tests are testing OLD behavior that we intentionally changed
## When to Complete
These test updates should be completed before merging to main, but can be done in a follow-up commit on the feature branch.

View File

@@ -0,0 +1,127 @@
# Testing Checklist
This document provides a comprehensive checklist for testing StarPunk functionality before release.
## Manual Testing Checklist
### Core Functionality
- [ ] Create notes via web interface
- [ ] Create notes via Micropub JSON
- [ ] Create notes via Micropub form-encoded
- [ ] Notes display with proper microformats
- [ ] Markdown renders correctly
- [ ] Slugs generate uniquely
- [ ] Timestamps record accurately
### Authentication & Security
- [ ] IndieAuth login flow works
- [ ] Micropub client authentication
- [ ] Token expiration works
- [ ] Rate limiting functions
### Syndication & Standards
- [ ] RSS feed validates (W3C validator)
- [ ] API returns correct status codes
### Automated Testing
- [ ] All unit tests pass
- [ ] All integration tests pass
- [ ] Test coverage >80%
## Validation Tools
### IndieWeb Standards
- **IndieWebify.me**: https://indiewebify.me/
- Verify microformats (h-entry, h-card, h-feed)
- Check IndieAuth implementation
- **IndieAuth Validator**: https://indieauth.com/validate
- Test IndieAuth flow
- Validate token handling
- **Micropub Test Suite**: https://micropub.rocks/
- Comprehensive Micropub endpoint testing
- Verify spec compliance
### Web Standards
- **W3C Feed Validator**: https://validator.w3.org/feed/
- Validate RSS 2.0 feed structure
- Check date formatting
- Verify CDATA wrapping
- **W3C HTML Validator**: https://validator.w3.org/
- Validate HTML5 markup
- Check semantic structure
- Verify accessibility
- **JSON Validator**: https://jsonlint.com/
- Validate API responses
- Check Micropub payloads
## Testing Resources
### Specifications
- IndieWeb Notes: https://indieweb.org/note
- Micropub Spec: https://micropub.spec.indieweb.org
- IndieAuth Spec: https://indieauth.spec.indieweb.org
- Microformats2: http://microformats.org/wiki/h-entry
- RSS 2.0 Spec: https://www.rssboard.org/rss-specification
### Testing & Validation
- Micropub Test Suite: https://micropub.rocks/
- IndieAuth Testing: https://indieauth.com/
- Microformats Parser: https://pin13.net/mf2/
### Example Implementations
- IndieWeb Examples: https://indieweb.org/examples
- Micropub Clients: https://indieweb.org/Micropub/Clients
## Pre-Release Validation Workflow
1. **Run Automated Tests**
```bash
uv run pytest
```
2. **Validate HTML**
- Test homepage output
- Test note permalink output
- Run through W3C HTML Validator
3. **Validate RSS Feed**
- Access /feed.xml
- Run through W3C Feed Validator
- Verify in actual RSS reader
4. **Validate Microformats**
- Test homepage with IndieWebify.me
- Test note permalinks
- Use microformats parser
5. **Validate Micropub**
- Run micropub.rocks test suite
- Test with real Micropub client (Quill)
6. **Manual Browser Testing**
- Chrome/Chromium
- Firefox
- Safari (if available)
- Mobile browsers
7. **Security Verification**
- CSRF protection working
- XSS prevention verified
- SQL injection tests pass
- Path traversal prevention works
## Success Criteria
All checklist items must pass before V1 release. If any validation tool reports errors, they must be fixed before proceeding.
## Related Documentation
- [Testing Strategy](/home/phil/Projects/starpunk/docs/architecture/overview.md#testing-strategy)
- [Implementation Plan](/home/phil/Projects/starpunk/docs/projectplan/v1/implementation-plan.md)
- [Feature Scope](/home/phil/Projects/starpunk/docs/projectplan/v1/feature-scope.md)
**Last Updated**: 2025-11-24