* docs: archive point-in-time records, drop broken guide symlinks Status reports, progress trackers, audits, session summaries, completed migration plans and the 2025 roadmap move to docs/archive/ (same relative path), with a README saying they describe the day they were written. .ai-guides/ held only symlinks into a docs/guides/ai/ that no longer exists, tests/unit/docs/ held a stray copy of an old getting-started page, and docs/operations/PORT_MANAGEMENT_README.md duplicated port-management.md; all three are deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD * docs: correct drifted paths, links and versions in current docs Fix in place the reference docs agents use: point paths at where the code lives now (src/stores/auth.ts, src/lib/supabase/*, scripts/dev/*, docs/reference/api/CONVENTIONS.md, the squashed baseline migration), rewrite the development, features, operations and API index pages to list documents that exist, say plainly where something is gone (/api/metrics, the CSP report route, .envrc in the repo, Loki's `migrate` script), and correct the Next.js major. docs-truth findings: 468 -> 2 (both "Next 30/90 Days" headings in the legal overview, a checker false positive). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD --------- Co-authored-by: Claude <noreply@anthropic.com>
5.7 KiB
created_date, last_modified_date, last_modified_summary
| created_date | last_modified_date | last_modified_summary |
|---|---|---|
| 2024-03-19 | 2025-06-12 | Added documentation standards including creation and modification dates |
🏗️ Architecture Overview
Backend Technology Evolution
Previous Architecture (Flask + SQLite)
Why We Started With Flask
- Initial Benefits:
- Python's simplicity and readability
- Large ecosystem of libraries
- Good for rapid prototyping
- Familiar to many developers
Challenges We Faced
-
Database Management:
- SQLite file locking issues
- Difficult to scale
- Manual backup requirements
- Local file system dependencies
-
Deployment Complexity:
- Separate server management
- More infrastructure to maintain
- Complex scaling requirements
- Higher operational costs
-
Development Workflow:
- Context switching between frontend/backend
- Different languages (Python/JavaScript)
- Separate deployment pipelines
- More complex local development setup
Current Architecture (Next.js + Supabase)
Why We Chose Next.js API Routes
-
Unified Codebase:
- Single language (TypeScript)
- Shared types and utilities
- Consistent development experience
- Easier code maintenance
-
Serverless Benefits:
- Automatic scaling
- Pay-per-use pricing
- No server management
- Built-in CDN
-
Development Experience:
- Hot reloading
- TypeScript support
- Built-in testing
- Better error handling
Why We Chose Supabase
-
Database Features:
- PostgreSQL under the hood
- Real-time subscriptions
- Row-level security
- Automatic backups
-
Authentication:
- Built-in auth system
- Social login support
- Secure session management
- JWT support
Our application utilizes Supabase Auth for user sign-up, login, and session management. Custom user profile data, extending beyond the basic
auth.userstable, is stored in a dedicatedpublic.profilestable. Client-side state is managed by Zustand, and route protection is handled by Next.js middleware and client-side hooks. For a comprehensive guide on the authentication flow, profile management, database interactions (includingprofilestable schema and RLS), and the cascading delete setup for user profiles, please refer to the Authentication System Detailed Guide. -
Storage:
- File storage with CDN
- Image optimization
- Secure file access
- Easy integration
Technology Comparison
Backend Frameworks
Feature Flask Next.js API Routes
---
Language Python TypeScript
Deployment Server Required Serverless
Scaling Manual Automatic
Cold Start None Possible
Development Separate Integrated
Type Safety Optional Built-in
Testing External Built-in
Database Solutions
Feature SQLite Supabase
---
Scalability Limited Excellent
Backups Manual Automatic
Real-time No Yes
Security Basic Advanced
Management File-based Cloud-based
Cost Free Usage-based
Migration Process
Phase 1: Assessment
- Identify Flask endpoints
- Map to Next.js API routes
- Plan database migration
- Create migration scripts
Phase 2: Implementation
- Create Next.js API routes
- Set up Supabase project
- Migrate data
- Update frontend
Phase 3: Testing
- Unit tests
- Integration tests
- Performance testing
- Security audit
Phase 4: Deployment
- Staging environment
- Production deployment
- Monitoring setup
- Backup verification
Security Considerations
Flask Security
- File system access
- Database file permissions
- Server hardening
- Manual SSL setup
Next.js + Supabase Security
- Automatic HTTPS
- Row-level security
- JWT validation
- Built-in auth
Performance Comparison
Flask Performance
- Server-based
- Manual scaling
- File I/O dependent
- Connection pooling required
Next.js Performance
- Serverless
- Automatic scaling
- CDN caching
- Edge functions
Cost Analysis
Flask Costs
- Server hosting
- Database management
- SSL certificates
- Backup solutions
Next.js + Supabase Costs
- Usage-based pricing
- Included SSL
- Automatic backups
- Built-in CDN
Future Considerations
-
Scaling:
- Automatic with Next.js
- Global edge network
- No server management
-
Maintenance:
- Less infrastructure
- Automated updates
- Built-in monitoring
-
Development:
- Faster iterations
- Better tooling
- Improved debugging
Cleanup Script
For cleaning up the old Flask installation:
#!/bin/bash
# Stop any running Python processes
pkill -f "python.*flask"
# Wait for processes to stop
sleep 2
# Remove SQLite lock files
find flask_app -name "*.db-*" -delete
# Remove the directory
rm -rf flask_app
# Verify cleanup
if [ ! -d "flask_app" ]; then
echo "Flask app directory removed successfully"
else
echo "Warning: Flask app directory still exists"
fi
Lessons Learned
-
Start with the Right Architecture:
- Consider future scaling needs
- Evaluate maintenance costs
- Plan for team growth
- Think about security early
-
Database Choices Matter:
- File-based databases have limitations
- Cloud databases offer more features
- Consider backup requirements
- Plan for data growth
-
Development Experience:
- Unified codebase is better
- Type safety is important
- Good tooling saves time
- Documentation is crucial
Next Steps
- Complete migration to Next.js
- Set up Supabase project
- Migrate existing data
- Update documentation
- Train team members
Removed Components
- Flask App: Removed as it was not being used and we're focusing on Next.js API routes
- Screen Recorder: Planned for future implementation to enhance transparency