Files
2025-10-10 20:21:15 -05:00

2.5 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

BackSafe is a cross-platform desktop application for backing up data from mobile phones (primarily Android, with photos/videos support on iOS/iPadOS) using a user-provided API key. Built with Avalonia UI and .NET 8, targeting Windows, macOS, and Linux.

Development Commands

Build and Run

dotnet build                    # Build the project
dotnet run                      # Run the application
dotnet build -c Release         # Build for release

Debugging

  • Avalonia diagnostics are enabled in Debug builds only (BackSafe.csproj:22-25)
  • Use F12 or Ctrl+F12 within the running application to access DevTools in Debug mode

Architecture

UI Framework: Avalonia UI

  • Uses AXAML (Avalonia XAML) for UI definitions
  • Fluent theme is the default (App.axaml:13)
  • Compiled bindings enabled by default (BackSafe.csproj:8)

MVVM Pattern

  • ViewModels: Inherit from ViewModelBase (extends ObservableObject from CommunityToolkit.Mvvm)
  • Views: Located in Views/ directory, defined with .axaml files and code-behind .axaml.cs
  • ViewLocator: Automatically maps ViewModels to Views by naming convention (ViewModel → View)
    • Example: MainWindowViewModel → MainWindow
    • Implementation in ViewLocator.cs:16

Application Entry Point

  • Program.cs: Standard .NET entry point
    • Configures Avalonia with platform detection, Inter font, and trace logging
  • App.axaml.cs: Avalonia initialization
    • Disables Avalonia's DataAnnotation validation to avoid conflicts with CommunityToolkit (App.axaml.cs:35-46)
    • Sets MainWindow with MainWindowViewModel as DataContext

Key Dependencies

  • Avalonia 11.3.6: Cross-platform UI framework
  • CommunityToolkit.Mvvm 8.2.1: MVVM helpers (ObservableObject, commands, etc.)
  • Avalonia.Fonts.Inter: Default font package

Project Structure

  • ViewModels/: Contains all ViewModel classes
  • Views/: Contains AXAML view definitions and code-behind
  • Models/: Placeholder directory for data models
  • Assets/: Application resources (icons, etc.)
  • app.manifest: Windows application manifest

MVVM Conventions

  • ViewModels use partial classes to support MVVM Toolkit source generators
  • Properties in ViewModels should use [ObservableProperty] attribute for automatic INotifyPropertyChanged implementation
  • Views use x:DataType for compiled bindings (see MainWindow.axaml:8)