SurfSense/surfsense_backend/app
Claude 2a2a909ef4
Implement dynamic site appearance configuration system
This commit implements a comprehensive database-driven site configuration
system that allows administrators to control the visibility and behavior
of homepage elements, navigation links, footer sections, and route
availability without code changes.

Backend Changes:
- Added SiteConfiguration model with singleton pattern (id=1)
- Created migration 38_add_site_configuration_table.py
- Implemented site_configuration_routes.py with public + admin endpoints
- Added Pydantic schemas for validation (Base, Update, Read, Public)
- Registered routes in main app

Frontend Changes:
- Created SiteConfigContext.tsx for global state management
- Updated app/layout.tsx to wrap app in SiteConfigProvider
- Implemented RouteGuard component for disabled routes
- Updated navbar with conditional rendering (pricing, docs, github, signin)
- Updated hero-section with conditional buttons (get started, talk to us)
- Updated footer with conditional sections and custom copyright
- Applied route guards to pricing, contact, terms, privacy pages

Admin Panel:
- Created /dashboard/site-settings page with full UI
- Visual toggle switches for all configuration options
- Real-time updates via API with toast notifications
- Organized by section (Header, Homepage, Footer, Routes, Text)
- Dark mode support and responsive design

Configuration Options:
Header: show_pricing_link, show_docs_link, show_github_link, show_sign_in
Homepage: show_get_started_button, show_talk_to_us_button
Footer: show_pages_section, show_legal_section, show_register_section
Routes: disable_pricing/docs/contact/terms/privacy_route
Custom: custom_copyright text (max 200 chars)

Security:
- Superuser-only admin endpoints with JWT validation
- Public read-only endpoint for frontend consumption
- Input validation via Pydantic schemas
- Singleton pattern with database constraints
- Client-side route guards for disabled routes

Documentation:
- Added comprehensive section to claude.md
- Includes API docs, migration guide, testing checklist
- Example code snippets and configuration tables
- Security considerations and future enhancements

All configuration defaults to minimal/privacy-focused state (most
features disabled by default). Administrators can enable features
as needed via the admin panel.

Files Changed: 16 files (6 backend, 10 frontend, 1 documentation)
2025-11-18 10:58:31 +00:00
..
agents feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
config Remove Google Analytics and Anthropic Claude from default configs 2025-11-17 21:42:57 +02:00
connectors chore: linting 2025-11-03 16:00:58 -08:00
prompts Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
retriver recurse fix 2025-08-20 10:21:59 -07:00
routes Implement dynamic site appearance configuration system 2025-11-18 10:58:31 +00:00
schemas Implement dynamic site appearance configuration system 2025-11-18 10:58:31 +00:00
services Update streaming service and database connection handling 2025-11-17 20:34:56 +02:00
tasks Update streaming service and database connection handling 2025-11-17 20:34:56 +02:00
utils feat: Implement local-first European AI architecture with Mistral NeMo and TildeOpen 2025-11-17 19:58:20 +02:00
__init__.py feat: SurfSense v0.0.6 init 2025-03-14 18:53:14 -07:00
app.py Update streaming service and database connection handling 2025-11-17 20:34:56 +02:00
celery_app.py refactor: added batch commits and Increased task time limits in celery_app.py 2025-11-03 15:57:19 -08:00
db.py Implement dynamic site appearance configuration system 2025-11-18 10:58:31 +00:00
users.py Update streaming service and database connection handling 2025-11-17 20:34:56 +02:00