Commit graph

293 commits

Author SHA1 Message Date
Wuesteon
9e771c9ae2 🔧 chore(auth): improve migration safety and docker setup
- Add safe-db-push.mjs script for safer database migrations
- Update docker-entrypoint.sh with db:push fallback when migrations fail
- Add validate-migrations.mjs script for CI migration validation
- Update CI workflow to use migration validation
- Update drizzle.config.ts with improved configuration
2025-12-19 02:18:31 +01:00
Wuesteon
4d15d9e764 🔒 security(auth): migrate to EdDSA JWT and add automated monitoring
BREAKING: JWT keys are now auto-managed by Better Auth (EdDSA/Ed25519)
- Remove all JWT_PRIVATE_KEY, JWT_PUBLIC_KEY, JWT_SECRET references
- Keys stored in auth.jwks database table (auto-generated on first run)
- Delete obsolete generate-keys.sh and generate-staging-secrets.sh scripts
- Clean up legacy AUTH_*.md analysis files from root

Security Improvements:
- Add security_events table for audit logging
- Add SecurityEventsService for tracking auth events
- Enhanced security headers (HSTS, CSP, X-Frame-Options)
- Rate limiting configuration

Monitoring Setup:
- Add auth-health-check.sh for automated testing
- Add generate-dashboard.sh for HTML status dashboard
- Tests: health endpoint, JWKS (EdDSA), security headers, response time
- Ready for Hetzner cron deployment

Documentation:
- Update deployment docs with Better Auth notes
- Update environment variable references
- Add security improvements documentation

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 21:42:47 +01:00
Wuesteon
aab8c73a9c feat: add multi-layered runtime config protection system
Add comprehensive defense system to prevent runtime config bugs across all projects:

## 1. Enhanced ESLint Rules
- Added @typescript-eslint/no-floating-promises (error)
  Catches: fetch(`${getAuthUrl()}/api`) without await
- Added @typescript-eslint/no-misused-promises (error)
  Catches: Promises in conditionals and logical expressions
- Added @typescript-eslint/require-await (warn)
  Ensures async functions actually use await

## 2. Validation Script (scripts/validate-runtime-config.mjs)
Automated checker that scans all web apps for:
-  Required files (runtime.ts, docker-entrypoint.sh, Dockerfile)
-  Window injection patterns (window.__PUBLIC_*)
-  Build-time env usage in stores/api (import.meta.env.PUBLIC_*)
-  Missing await on async config functions
- ⚠️  Docker entrypoint best practices

Usage: pnpm validate:runtime-config

## 3. Comprehensive Documentation (docs/RUNTIME_CONFIG.md)
Complete implementation guide covering:
- Why runtime configuration is needed
- Step-by-step implementation guide
- Common patterns (API clients, auth stores)
- Anti-patterns to avoid
- Migration checklist
- ESLint protection details

## Benefits
- Prevents "[object Promise]" in API URLs (staging bug)
- Catches missing await at lint time
- Validates all apps automatically
- Clear documentation for new projects
- Can run in CI/CD

## Future Work
- Add to pre-push hook (optional)
- Create project generator/template
- Shared runtime config package

This prevents the class of bugs we just fixed in manacore-web where
getAuthUrl() was called without await, causing ERR_CONNECTION_REFUSED
on staging.
2025-12-16 00:28:57 +01:00
Wuesteon
2c30867251 🔧 refactor: implement 12-factor runtime config for all web apps
Replace window injection and build-time env vars with runtime config
loaded from /config.json (generated by Docker entrypoint). This fixes
the staging deployment issue where apps were requesting localhost URLs
instead of production URLs.

Changes:
- Add runtime.ts config loader with Zod validation (fail-hard in prod)
- Disable SSR via +layout.ts (apps are client-only SPAs)
- Update API clients and auth stores to use async config getters
- Add docker-entrypoint.sh scripts to generate config.json at startup
- Update Dockerfiles with ENTRYPOINT for config generation
- Simplify docker-compose.staging.yml env vars (12-factor pattern)
- Add static/config.json as dev fallback (localhost defaults)
- Fix onMount return type (Svelte 5 compatibility)
- Add zod dependency to Picture app
- Add backward compat exports for Contacts app

Apps updated:
- Clock (port 3017)
- Chat (port 3002)
- Picture (port 3006)
- Contacts (port 3015)
- Calendar (port 3016)
- Manacore (multi-app platform)

Benefits:
- Build once, deploy anywhere (same Docker image for all envs)
- Configuration in environment, not code (12-factor compliance)
- Fail-hard on missing/invalid config in production
- No accidental SSR localhost fallbacks
- Schema validation ensures all required URLs are present
2025-12-15 21:33:50 +01:00
Wuesteon
14806386ce 🔧 chore: add pre-push build validation for changed apps
- Create build-changed-apps.sh script that:
  - Detects which web apps have changes vs remote branch
  - Builds only affected apps (not all apps)
  - For shared packages, builds main apps that depend on them
- Enable pre-push hook to run build validation

This catches npm package incompatibilities and build failures
before pushing to remote, preventing CI/CD failures.

Skip with: git push --no-verify
2025-12-15 19:49:30 +01:00
Wuesteon
42e5e97390 ️ fix: resolve all svelte-check a11y warnings across web apps
- Fix 121 accessibility warnings across 9 web apps (manacore, clock, chat,
  manadeck, calendar, zitare, contacts, picture, todo)
- Add proper ARIA attributes (role, tabindex, aria-label) to interactive elements
- Add onkeydown handlers alongside onclick for keyboard accessibility
- Add svelte-ignore comments for intentional patterns (modals, dropdowns)
- Update svelte-check threshold from error to warning in pre-commit hook
- Fix script compatibility for bash 3.x (remove associative arrays)
- Add comprehensive documentation for svelte-check patterns and fixes

All web apps now pass svelte-check with 0 errors and 0 warnings.
Pre-commit hooks will block any future commits with warnings.
2025-12-15 19:09:01 +01:00
Wuesteon
b949037fa5 🔧 chore: add svelte-check to pre-commit hooks
Add automatic svelte-check validation for staged Svelte files:
- Create svelte-check-staged.sh that runs on affected web apps only
- Create build-check-staged.sh for production build validation
- Integrate svelte-check into pre-commit hook
- Add optional pre-push hook for full build checks
- Update lint-staged config to handle Svelte files separately
2025-12-15 17:53:52 +01:00
Wuesteon
660cbd654f Merge branch 'dev' into till-dev 2025-12-15 14:10:34 +01:00
Till-JS
cdc3cd3ec8 feat(calendar): add birthday integration from contacts service
- Add birthdaysStore to fetch and manage birthdays from contacts API
- Add BirthdayPopover component with contact details and link to contacts app
- Integrate birthdays into WeekView, MonthView, and DayView as all-day events
- Add settings for showBirthdays and showBirthdayAge toggles
- Add reactive $effect in layout to load birthdays when setting is enabled
- Add /contacts/birthdays endpoint to contacts backend
- Configure PUBLIC_CONTACTS_API_URL env variable for calendar app

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 20:49:08 +01:00
Wuesteon
612f6a10ef 🔧 chore: switch chat backend to OpenRouter API
- Replace Azure OpenAI and Google Gemini with OpenRouter API
- Update generate-env.mjs to use OPENROUTER_API_KEY
- Remove temporary doc_nils.md file

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-12 20:50:03 +01:00
Till-JS
a898160423 refactor(todo): rename Labels to Tags for consistency across apps
- Rename route /labels to /tags and /label/[id] to /tag/[id]
- Rename LabelSelector component to TagSelector
- Update all UI texts from "Labels" to "Tags"
- Update navigation items and references
- Align terminology with Calendar and Contacts apps

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 21:12:08 +01:00
Wuesteon
6f74e1d9a6 feat(chat,picture): add OpenRouter integration and credit system
Chat:
- Add OpenRouter as primary AI provider with multiple models
- Update chat service with new model configurations
- Add model seed data for Llama, DeepSeek, Mistral, Claude, GPT-4o

Picture:
- Integrate @mana-core/nestjs-integration for credit system
- Implement freemium model (3 free generations, then 10 credits)
- Migrate storage to @manacore/shared-storage
- Add comprehensive project documentation
2025-12-10 20:46:33 +01:00
Till-JS
ee42b6cc76 feat: major update with network graphs, themes, todo extensions, and more
## New Features

### Network Graph Visualization (Contacts, Calendar, Todo)
- D3.js force simulation for physics-based layout
- Zoom & pan with mouse/touchpad
- Keyboard shortcuts: +/- zoom, 0 reset, Esc deselect, / search, F focus
- Filtering by tags, company/location/project, connection strength
- Shared components in @manacore/shared-ui

### Central Tags API (mana-core-auth)
- CRUD endpoints for tags
- Schema: tags table with userId, name, color, app
- Shared tag components in @manacore/shared-ui

### Custom Themes System
- Theme editor with live preview and color picker
- Community theme gallery
- Theme sharing (public, unlisted, private)
- Backend API in mana-core-auth

### Todo App Extensions
- Glass-pill design for task input and items
- Settings page with 20+ preferences
- Task edit modal with inline editing
- Statistics page with visualizations
- PWA support with offline capabilities
- Multiple kanban boards

### Contacts App Features
- Duplicate detection
- Photo upload
- Batch operations
- Enhanced favorites page with multiple view modes
- Alphabet view improvements
- Search modal

### Help System
- @manacore/shared-help-content
- @manacore/shared-help-ui
- @manacore/shared-help-types

### Other Features
- Themes page for all apps
- Referral system frontend
- CommandBar (global search)
- Skeleton loaders
- Settings page improvements

## Bug Fixes
- Network graph simulation initialization
- Database schema TEXT for user_id columns (Better Auth compatibility)
- Various styling fixes

## Documentation
- Daily report for 2025-12-10
- CI/CD deployment guide

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 02:37:46 +01:00
Wuesteon
3fa7b027aa feat: add email service and storage module + fix runtime env vars
## Runtime Environment Fix
- Updated all web app hooks.server.ts to use $env/dynamic/private
- This allows Docker containers to inject env vars at runtime
- Updated docker-compose.staging.yml with HTTPS staging domains
- Fixes Mixed Content errors when accessing staging via domains

## New Features
- Added email service to mana-core-auth for sending emails
- Added storage module to chat backend

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 02:22:34 +01:00
Wuesteon
c61dcb8ff9 docs: remove all Coolify references from codebase
Replace Coolify with Docker Compose throughout documentation.
The project never used Coolify - a removal script was created but
never executed, leaving incorrect documentation.

Changes:
- Delete 13 heavily Coolify-focused docs files
- Update ~30 files replacing Coolify → Docker Compose
- Remove obsolete removal script
- Fix deployment references in active and archived projects

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 01:56:38 +01:00
Wuesteon
67a15cc9ea 🧑‍💻 dx: add automatic database setup and dev:*:full commands
- Add scripts/setup-databases.sh for automatic DB creation and schema push
- Add dev:*:full commands (chat, zitare, contacts, calendar, clock, todo, picture)
- Update docker/init-db to create all databases on first startup
- Add docs/LOCAL_DEVELOPMENT.md with comprehensive local dev guide
- Update CLAUDE.md with new quick start commands

Now developers can run `pnpm dev:chat:full` to automatically:
1. Create the database if missing
2. Push the latest schema
3. Start auth, backend, and web with colored output
2025-12-08 14:38:18 +01:00
Wuesteon
d41d060bb3 Merge branch 'dev-1' into dev 2025-12-05 17:57:26 +01:00
Till-JS
34c879929b chore: add techbase to apps-archived
Integrated techbase (software comparison platform) into monorepo structure:
- Created NestJS backend with votes and comments modules
- Migrated from external Supabase to own PostgreSQL
- Set up Drizzle ORM schema for votes and comments
- Created API client replacing Supabase in Astro frontend
- Added environment configuration (port 3021)

Archived immediately as it's not yet ready for active development.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 13:47:39 +01:00
Wuesteon
9c47119535 Fix wrong type
import, make auth and chat work
2025-12-04 23:25:25 +01:00
Wuesteon
234703a130 ♻️ refactor(cd): hardcode non-sensitive config in staging workflow
Reduced GitHub Secrets requirements from 21 to 12 by hardcoding
non-sensitive configuration values directly in the workflow file.

Changes:
- Hardcoded: DB/Redis host/port, STAGING_HOST, STAGING_USER, MANA_SERVICE_URL
- Keep as secrets: passwords, API keys, JWT keys, SSH private key
- Updated generate-staging-secrets.sh to reflect reduced secret list
- Added get-ssh-key.sh helper script for SSH key extraction

Benefits:
- Fewer secrets to manage in GitHub
- Configuration visible in code review
- Easier to update non-sensitive values (no UI navigation)
- Better separation of config vs secrets

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 17:11:36 +01:00
Till-JS
ad0051a8fc feat(finance): add complete finance app with budget tracking
- Backend (NestJS, Port 3019):
  - Account management with multi-currency support
  - Categories with income/expense types and seed functionality
  - Transaction tracking with comprehensive filters
  - Monthly budgets with spending tracking
  - Transfers between accounts
  - Reports (dashboard, trends, category breakdown)
  - User settings (currency, locale, date format)
  - Exchange rates with ECB API integration
  - Bank sync architecture prepared (connected_accounts)

- Frontend (SvelteKit, Port 5189):
  - Dashboard with totals, budget progress, recent transactions
  - Transaction list with filters
  - Account management
  - Category management
  - Budget tracking per month
  - Reports & trends
  - Settings page
  - Auth pages (login, register, forgot-password)

- Shared package with types, constants, utilities
- Environment configuration for backend, web, mobile

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 16:41:43 +01:00
Wuesteon
e9caa4a217 fix lint 2025-12-04 00:32:13 +01:00
Till-JS
2ef457ea23 feat(clock): add complete Clock app with backend, web, and landing
Features:
- World clock with timezone support and drag & drop sorting
- Alarms with repeat days, snooze, and custom sounds
- Multiple timers with start/pause/reset controls
- Stopwatch with lap times (local only)
- Pomodoro timer with customizable intervals
- Analog and digital clock widgets
- i18n support (DE, EN, FR, ES, IT)

Stack:
- Backend: NestJS 10, Drizzle ORM, PostgreSQL (port 3017)
- Web: SvelteKit 2.x, Svelte 5 runes, Tailwind CSS 4 (port 5186)
- Landing: Astro 5.x with animated clock hero (port 4323)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 15:37:51 +01:00
Till-JS
19500e8467 feat(storage): add Storage app scaffolding and root config
- Add storage app directory structure
- Add storage dev scripts to root package.json
- Add storage backend and web env generation in generate-env.mjs
- Update COMMANDS.md with calendar app reference

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 14:41:15 +01:00
Till-JS
45d70150f4 feat(contacts): add complete contacts app with backend, web, and landing
- Add NestJS backend with CRUD endpoints for contacts, groups, tags, notes, and activities
- Add SvelteKit web app with auth pages (login, register, forgot-password)
- Add Astro landing page
- Add ContactsLogo to shared-branding package
- Add contacts to MANA_APPS configuration
- Update shared-storage with contacts bucket support
- Update environment scripts and Docker configuration for contacts database
- Integrate mana-core-auth for JWT authentication
- Follow existing app architecture patterns (route groups, PillNavigation)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 13:17:42 +01:00
Wuesteon
5b0b3095ff 🔒️ feat(auth): centralize JWT validation and add deployment docs
- Migrate Chat, Picture, Presi, Zitare backends to shared auth guards
- Remove duplicate local JWT guards and decorators
- Add CD staging workflow for tagged releases
- Add comprehensive auth architecture documentation
- Add Hetzner deployment and Docker setup guides
- Add environment configuration audit docs
- Update env generation scripts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:44:45 +01:00
Till-JS
1d5f49a6d0 Merge branch 'main' of https://github.com/Memo-2023/manacore-monorepo 2025-12-01 15:41:06 +01:00
Till-JS
64c82a1d30 🐛 fix(presi): resolve auth token mismatch and add feedback navigation
- Align API client storage keys with @manacore/shared-auth (@auth/appToken)
- Update auth endpoints to use /api/v1/auth/* paths
- Add JWT_PUBLIC_KEY to backend env configuration
- Add Feedback link to PillNavigation
2025-12-01 15:35:56 +01:00
Wuesteon
8a43bbfc25 🔀 merge: auth/complete branch with Better Auth implementation
Merged auth/complete into main with resolved conflicts:
- Kept Better Auth system (EdDSA JWT via JWKS)
- Removed all Coolify references
- Added dev:auth and dev:chat:full scripts for auth development
- Combined zitare scripts from main with auth scripts
- Exported both feedback.schema and organizations.schema

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:25:38 +01:00
Till-JS
51edd52241 refactor(picture): remove Supabase dependency, migrate to NestJS backend
- Backend: Replace Supabase storage with S3/local hybrid StorageService
- Backend: Add rate-limits endpoint to ProfileController
- Mobile: Update RateLimitIndicator to use backend API
- Mobile: Remove @supabase/supabase-js dependency
- Shared: Remove queue.ts and supabase.ts (no longer needed)
- Update environment configuration for S3 storage

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 14:22:49 +01:00
Wuesteon
2a002bf6be first auth impl 2025-12-01 13:30:58 +01:00
Till-JS
05fe8ca5b6 feat(chat): add auto title generation, inline renaming, and styled delete modal
- Fix missing conversationsStore import for auto title generation
- Make model ID dynamic in generateTitle() with error handling and fallback
- Add inline editing for manual conversation renaming in sidebar
- Add updateConversationTitle API endpoint and store method
- Replace browser confirm() with styled ConfirmationModal for delete
- Update Modal and ConfirmationModal with glassmorphism styling
- Add DEV_BYPASS_AUTH and GOOGLE_GENAI_API_KEY to env generation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:43:41 +01:00
Till-JS
8b61399a64 feat(nutriphi): migrate to shared auth UI components
- Add nutriphi branding to shared-branding package (types, config, logo)
- Add nutriphi icon to app-icons and MANA_APPS for AppSlider
- Replace custom login/register pages with shared LoginPage/RegisterPage
- Add forgot-password page using shared ForgotPasswordPage component
- Create AppSlider component for nutriphi web
- Update vite.config.ts with SSR config for shared packages
- Add nutriphi env variables to generate-env.mjs

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 06:04:35 +01:00
Till-JS
f1e27f3beb fix(manadeck): resolve backend startup and auth configuration issues
- Add missing env vars to generate-env script (DATABASE_URL, MANA_SERVICE_URL, APP_ID)
- Fix auth endpoints to use correct mana-core-auth paths (/api/v1/auth/login)
- Fix api.controller.ts to use getBalance() and completedAt field names
- Add SSR/optimizeDeps config for shared packages in vite.config.ts
- Remove outdated tailwind.config.js (conflicts with Tailwind CSS 4)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:31:46 +01:00
Till-JS
bc21a25295 feat(manadeck): add mana-core auth integration
- Add @mana-core/nestjs-integration dependency to backend
- Add PUBLIC_API_URL and PUBLIC_MANA_CORE_AUTH_URL to web env vars

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:03:17 +01:00
Till-JS
75a2527b60 feat(zitare): rename quote project to zitare and add global search
- Rename entire quote project to zitare (German name)
- Add global search page with quote and author search
- Add search to navigation with Cmd/Ctrl+K shortcut
- Add missing icons to PillNavigation (heart, list, compass)
- Update all package names from @quote/* to @zitare/*
- Update env variables from QUOTE_* to ZITARE_*
- Update CLAUDE.md documentation
- Fix layout with flex container structure

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 20:14:19 +01:00
Wuesteon
0ec0396238 Merge branch 'feature/cicd' into cicd/integration 2025-11-27 17:34:13 +01:00
Wuesteon
74dc6892ab first implementation 2025-11-27 17:26:18 +01:00
Till-JS
607ca19d4a feat: integrate presi and voxel-lava into monorepo structure
- Add presi web app and CLAUDE.md documentation
- Restructure voxel-lava to apps/web pattern
- Add voxel-lava scripts to root package.json
- Update generate-env.mjs for presi configuration
- Update .env.development with new project variables

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 15:33:28 +01:00
Till-JS
ea3285dcbb feat(quote): integrate Quote app into monorepo
- Add complete Quote app with mobile (Expo), web (SvelteKit), landing (Astro), and backend (NestJS)
- Create NestJS backend with Drizzle ORM for PostgreSQL
- Add API endpoints for favorites and user lists
- Add database schema for favorites and user_lists tables
- Update root package.json with quote dev scripts
- Add Quote environment variables to generate-env.mjs
- Add missing toast.ts store for web app
- Configure hybrid content strategy (static + API)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 14:44:33 +01:00
Till-JS
98efa6f6e8 Feat: Refactor postgress 2025-11-27 02:25:37 +01:00
Till-JS
046a0e3fe7 Fix: Picture App envs 2025-11-26 17:26:07 +01:00
Wuesteon
2328b8938c 🧑‍💻 chore: add centralized environment variable system
- Add .env.development as single source of truth for dev variables
- Create scripts/generate-env.mjs to generate app-specific .env files
- Add pnpm setup:env command (also runs on postinstall)
- Update turbo.json with globalEnv for cache invalidation
- Add comprehensive docs/ENVIRONMENT_VARIABLES.md
- Update CLAUDE.md with env setup instructions
2025-11-26 13:08:50 +01:00