mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 21:09:10 +01:00
Major changes: - AI streaming: Add unified client for OpenRouter SSE and local (Ollama) providers - Local AI detection: Auto-detect and configure local model providers - Rate limiting: Canonical adapters with X-RateLimit-* headers across APIs - SSE: Add lib/sse.ts for consistent event-stream parsing Cleanup: - Remove /demo, /donate, /fund-us, /funding, /fundraising pages - Simplify ModelSelector component (288 → 80 lines) - Consolidate timeline queries New features: - Voice input component and hook - Query provider for React Query - Model registry with status badges - HTTP headers config Tests & Docs: - E2E tests for project creation wizard - Unit tests for auth, streaming, components - CHANGELOG.md for version tracking - Deployment checklist and PR summary docs Bug fixes: - Timeline schema and functions migration fixes - Messaging RLS recursion fix - Auth callback improvements - Bitcoin formatting precision - Lint fixes for unused variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3.4 KiB
3.4 KiB
Best Practices
This guide captures practical applications of our core engineering principles across development, deployment, and operations. See also: ../standards/engineering_principles.md
Core Principles (Applied)
- Start simple and add complexity only when needed
- Focus on core functionality first
- Use built-in tools before adding external services
- Document decisions and their rationale
- Privacy/local-first by default
- SSOT/DRY/SoC across modules
- Accessibility and testability are non-negotiable
Initial Deployment Checklist
- Basic Vercel analytics enabled
- Core routes tested
- Environment variables configured
- Domain setup verified
- SSL certificates confirmed
When to Add Additional Tools
Only add error tracking and advanced monitoring when:
- You have actual users experiencing issues
- The basic analytics show problems
- You need more detailed insights than Vercel provides
Vercel's Built-in Tools
-
Analytics Dashboard
- Page views
- Performance metrics
- Error rates
- Deployment history
-
Logs
- Build logs
- Runtime logs
- Error logs
-
Performance Monitoring
- Page load times
- API response times
- Build times
Adding External Tools
Only consider external tools when:
- Vercel's built-in tools are insufficient
- You have specific needs not covered by Vercel
- You have the capacity to maintain additional services
Documentation
- Keep deployment documentation up to date
- Document any issues and their solutions
- Maintain a changelog
- Update environment variables documentation
Security
- Use environment variables for sensitive data; never commit secrets
- Enable HTTPS and HSTS
- Set appropriate security headers (CSP, COOP/COEP where needed)
- Regular dependency updates and scans (SCA)
- Encrypt user API keys at rest (AES-256-GCM); consider client-only encryption when feasible
- No logging of sensitive content (chat text, PII)
Environment Hygiene
.env.localmust not be committed. Use.env.exampleas SSOT for keys and add placeholders only.- If an
.env.localwas tracked historically, scrub contents and remove from git history; rely on local, untracked copies going forward.
Performance
- Optimize images
- Use proper caching
- Minimize JavaScript bundles
- Implement lazy loading
- Prefer streaming responses for incremental UX (AI outputs)
Maintenance
- Regular dependency updates
- Monitor for deprecated features
- Keep documentation current
- Regular security audits
- Maintain ADRs for significant decisions
AI/Voice Features (Applied Best Practices)
- Private by default: do not persist private chat content server-side
- Local-first: support local model runtimes; browser-to-localhost paths only
- Key handling: encrypt keys at rest; avoid storing unless required; provide client-only mode where practical
- Rate limiting: per-user where possible; never rely solely on IP in authenticated contexts
- A11y: clear mic state, aria-labels, visible focus; keyboard and mobile-friendly
- Testing: mock SpeechRecognition; integration tests for prefill flows; E2E happy paths
- Feature flags: guard non-critical voices features for gradual rollout
When to Scale
Add more sophisticated tools only when:
- You have actual scaling needs
- Basic tools are insufficient
- You have the resources to maintain them
- The benefits outweigh the costs