Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kaleidal/raffi/llms.txt
Use this file to discover all available pages before exploring further.
Code Style Overview
Raffi maintains consistent code style across all projects to ensure readability and maintainability. All projects use TypeScript with strict type checking enabled.TypeScript Standards
Desktop App (Svelte)
The desktop app uses TypeScript with Svelte 5 and follows these configuration standards:- Target: ES2022 for modern JavaScript features
- Module: ESNext with bundler resolution
- JavaScript checking: Enabled with
checkJs: true - Strict mode: Inherited from Svelte base config
Mobile App (React Native)
The mobile app uses TypeScript with Expo and React Native:- Strict mode: Enabled for maximum type safety
- Path aliases: Use
@/*for cleaner imports - Expo base: Inherits Expo-specific configurations
Always enable strict mode when creating new TypeScript files. This catches potential bugs early and improves code quality.
Type Safety Best Practices
Use Explicit Types
Avoid implicitany types. Always define explicit types for function parameters and return values:
Define Interfaces for Complex Objects
Create interfaces for data structures used throughout the application:Use Type Guards
Implement type guards for runtime type checking:Leverage Union Types
Use union types for values that can be one of several types:Linting Configuration
Desktop and Website (Svelte)
The desktop and website projects usesvelte-check for type checking:
- Svelte component type checking
- TypeScript compilation checks
- Template syntax validation
Mobile (React Native/Expo)
The mobile app uses ESLint with Expo configuration:Always run linting before committing code. Fix all linting errors and address warnings when possible.
Code Formatting
Indentation and Spacing
- Indentation: Use 2 spaces (not tabs)
- Line length: Aim for 80-100 characters per line
- Spacing: Add spaces around operators and after commas
Naming Conventions
- Variables and functions: camelCase
- Components: PascalCase
- Constants: UPPER_SNAKE_CASE
- Interfaces/Types: PascalCase
- Private members: prefix with underscore
_privateMethod
Import Organization
Organize imports in the following order:- External libraries
- Internal modules
- Components
- Types/Interfaces
- Styles
Svelte-Specific Guidelines
Component Structure
Organize Svelte components in this order:- Script tag with TypeScript
- Template markup
- Style tag (if needed)
Svelte 5 Runes
Use Svelte 5 runes for reactive state:$state()for reactive variables$derived()for computed values$effect()for side effects$props()for component props
React Native Guidelines
Component Organization
Hooks Best Practices
- Always define hooks at the top level
- Use
useCallbackfor event handlers - Use
useMemofor expensive computations - Extract complex hooks to custom hooks
Go Server Guidelines
Code Organization
- Use Go modules for dependency management
- Follow standard Go project structure
- Use
gofmtfor formatting - Write idiomatic Go code
Error Handling
Comments and Documentation
When to Comment
- Explain complex algorithms or business logic
- Document public APIs and interfaces
- Clarify non-obvious implementation decisions
- Add TODO comments for future improvements
Avoid Obvious Comments
Git Workflow
Branch Naming
feature/description- New featuresfix/description- Bug fixesrefactor/description- Code refactoringdocs/description- Documentation changes
Commit Messages
Follow conventional commit format:feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoringtest: Adding testschore: Maintenance tasksperf: Performance improvements
Keep commit messages concise (under 72 characters) and use the imperative mood (“add feature” not “added feature”).
Testing Requirements
While Raffi currently doesn’t have extensive automated tests, follow these guidelines when adding tests:Manual Testing Checklist
Before submitting a PR, test:- Functionality: Does the feature work as expected?
- Edge cases: What happens with invalid input?
- Performance: Does it introduce lag or memory leaks?
- Platform compatibility: Does it work on all target platforms?
- Error handling: Are errors handled gracefully?
Future Testing Framework
When adding automated tests:- Use Vitest for unit tests (desktop/website)
- Use React Native Testing Library (mobile)
- Focus on critical functionality first
- Aim for meaningful tests over coverage numbers
Build and Distribution
Desktop App Builds
raffi-desktop/release/
Mobile App Builds
Code Review Checklist
Before requesting review, ensure:- Code follows TypeScript and style guidelines
- All linting errors are resolved
- Type checking passes (
npm run check) - Changes are tested on relevant platforms
- Documentation is updated
- Commit messages are clear and descriptive
- No debug code or console logs remain
- Dependencies are properly declared
- Git history is clean and logical
A thorough self-review before requesting feedback saves time and helps maintain code quality.