Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
26b07b6
feat: add constants module with theme colors and default configuration
cmcWebCode40 Apr 23, 2026
005656d
feat: add utility modules for filtering, cURL generation, and formatting
cmcWebCode40 Apr 23, 2026
dd2331a
feat: add export utilities for HAR, Postman, and JSON formats
cmcWebCode40 Apr 23, 2026
16fbe87
feat: add request replay utility with response comparison
cmcWebCode40 Apr 23, 2026
7faf8fa
feat: add sensitive data redaction utilities
cmcWebCode40 Apr 23, 2026
c9d7754
feat: add Badge and FilterChip UI components
cmcWebCode40 Apr 23, 2026
2bd118f
feat: add JsonViewer component with collapsible tree and syntax highl…
cmcWebCode40 Apr 23, 2026
cbfc2d6
feat: add ExportModal component for log export format selection
cmcWebCode40 Apr 23, 2026
933442b
feat: enhance NetworkInterceptor with configuration and request filte…
cmcWebCode40 Apr 23, 2026
3c063eb
feat: enhance overlay UI with theming, filtering, and export capabili…
cmcWebCode40 Apr 23, 2026
dd7c017
feat: export new modules from package entry point
cmcWebCode40 Apr 23, 2026
61d06f2
feat: update example app to demonstrate new features
cmcWebCode40 Apr 23, 2026
4b1944a
docs: add CLAUDE.md development guide and update package.json
cmcWebCode40 Apr 23, 2026
b0ce919
fix: resolve dark theme toggle and add delete button for individual logs
cmcWebCode40 Apr 23, 2026
7e3253d
fix: close modal before showing share sheet
cmcWebCode40 Apr 23, 2026
4c7f0d1
fix: fixed modal syc
cmcWebCode40 Apr 23, 2026
6bf67e4
docs: rewrite README with clearer structure and complete feature cove…
cmcWebCode40 Apr 23, 2026
9f5e991
chore: update demo assets with new logger and library GIFs
cmcWebCode40 Apr 23, 2026
79bda2e
chore: update demo GIF for improved visual representation
cmcWebCode40 Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# React Native API Debugger - Development Guide

## Project Overview

A comprehensive network request debugging SDK for React Native applications. Intercepts and visualizes HTTP requests with a draggable overlay interface.

## Architecture

### Directory Structure

```
src/
├── index.tsx # Public API exports
├── types.ts # TypeScript interfaces and types
├── NetworkInterceptor.ts # Core request interception engine
├── NetworkLoggerOverlay.tsx # Main overlay container component
├── NetworkLogItem.tsx # Individual log entry component
├── FloatingButton.tsx # Draggable trigger button
├── NonFloatingButton.tsx # Static trigger button fallback
├── CopyItem.tsx # Clipboard copy component
├── Icon.tsx # Emoji-based icon component
├── components/ # Reusable UI components (new)
│ ├── index.ts # Component exports
│ ├── Badge.tsx # Status badge component
│ ├── FilterChip.tsx # Filter tag component
│ ├── SearchInput.tsx # Search input component
│ └── JsonViewer.tsx # JSON tree viewer component
├── hooks/ # Custom React hooks (new)
│ ├── index.ts # Hook exports
│ ├── useNetworkLogs.ts # Log subscription hook
│ └── useFilteredLogs.ts # Log filtering hook
├── utils/ # Utility functions (new)
│ ├── index.ts # Utility exports
│ ├── formatters.ts # Data formatting utilities
│ ├── curl.ts # cURL generation
│ └── filters.ts # Filter logic
└── constants/ # Constants and config (new)
├── index.ts # Constants exports
├── colors.ts # Color palette
└── config.ts # Default configuration
```

### Component Design System

#### Design Principles

1. **Single Responsibility**: Each component handles one concern
2. **Composition over Inheritance**: Build complex UIs from simple pieces
3. **Graceful Degradation**: Features work without optional dependencies
4. **Zero Config Defaults**: Works out of the box with sensible defaults
5. **TypeScript First**: Full type safety with exported interfaces

#### Component Categories

| Category | Purpose | Examples |
|----------|---------|----------|
| **Core** | Business logic & interception | `NetworkInterceptor` |
| **Container** | State management & data flow | `NetworkLoggerOverlay` |
| **Presentational** | Pure UI rendering | `NetworkLogItem`, `Badge`, `FilterChip` |
| **Interactive** | User interaction handling | `FloatingButton`, `CopyItem` |
| **Utility** | Shared functionality | `Icon`, `JsonViewer` |

#### Reusable Component Guidelines

```typescript
// Component Template
interface ComponentProps {
// Required props first
requiredProp: string;
// Optional props with defaults
optionalProp?: boolean;
// Style overrides last
style?: StyleProp<ViewStyle>;
}

const Component: React.FC<ComponentProps> = ({
requiredProp,
optionalProp = false,
style,
}) => {
// Implementation
};
```

### State Management

- **Local State**: React `useState` for component-specific state
- **Shared State**: Pub/sub pattern via `NetworkLogger.subscribe()`
- **No External Dependencies**: No Redux/MobX required

### Styling Conventions

- Use `StyleSheet.create()` for all styles
- Define styles at bottom of component file
- Use semantic color names from `constants/colors.ts`
- Support both light and dark themes

## Configuration

### NetworkLogger Config Interface

```typescript
interface NetworkLoggerConfig {
maxLogs: number; // Default: 100
ignoredUrls: string[]; // URL patterns to ignore
ignoredDomains: string[]; // Domains to ignore
redactHeaders: string[]; // Headers to mask (e.g., 'Authorization')
enablePersistence: boolean; // Persist logs across sessions
slowRequestThreshold: number; // ms threshold for slow request warning
}
```

### Overlay Config Interface

```typescript
interface NetworkLoggerOverlayProps {
networkLogger: NetworkLogger;
// Feature flags
draggable?: boolean;
enableDeviceShake?: boolean;
useCopyToClipboard?: boolean;
// Display options
showRequestHeader?: boolean;
showResponseHeader?: boolean;
theme?: 'light' | 'dark' | 'auto';
// Filtering
defaultFilters?: FilterConfig;
}
```

## Development Workflow

### Commands

```bash
# Install dependencies
yarn install

# Run example app
yarn example start

# Type checking
yarn typecheck

# Linting
yarn lint

# Run tests
yarn test

# Build library
yarn prepare

# Release
yarn release
```

### Adding New Features

1. Create feature branch from `main`
2. Add types to `types.ts`
3. Implement in appropriate directory (components/hooks/utils)
4. Export from index files
5. Add example usage in `example/src/`
6. Update README if public API changes
7. Write tests for new functionality

### Testing Strategy

- Unit tests for utility functions
- Component tests for UI components
- Integration tests for interceptor logic
- Manual testing via example app

## Optional Peer Dependencies

| Package | Required For |
|---------|--------------|
| `react-native-gesture-handler` | Draggable floating button |
| `react-native-reanimated` | Smooth animations |
| `react-native-shake` | Device shake detection |
| `@react-native-clipboard/clipboard` | Copy to clipboard |

## Code Style

- Use TypeScript strict mode
- Prefer functional components with hooks
- Use explicit return types on functions
- Document public APIs with JSDoc
- Follow React Native community conventions

## Performance Guidelines

- Limit stored logs (default: 100)
- Use `FlatList` with optimization props
- Lazy load optional dependencies
- Avoid re-renders with `React.memo` where appropriate
- Use `useCallback` for event handlers passed as props
Loading
Loading