Advanced Configuration
Testing Feature Flags
Section titled “Testing Feature Flags”When using feature flags extensively, configure Reccy to test new features with older sessions.
How It Works
Section titled “How It Works”Sessions recorded before a feature flag existed can still test that feature by:
- Reccy detects which feature flags affect the session’s code path
- During replay, Reccy can inject different flag values
- The same session exercises new code paths without re-recording
Configuration
Section titled “Configuration”In your project settings, navigate to Feature Flags and:
- Define your feature flag source (LaunchDarkly, Split, custom)
- Map flag names to their possible values
- Reccy will automatically test sessions with different flag combinations
Network Stubbing
Section titled “Network Stubbing”By default, Reccy stubs all XHR, Fetch, and WebSocket requests with recorded responses. You can customize this behavior.
Passing Through Requests
Section titled “Passing Through Requests”To test your backend code alongside frontend changes:
- Go to Project Settings > Network Stubbing
- Select which request patterns to pass through
- These requests will hit your actual backend during replay
Next.js App Router
Section titled “Next.js App Router”For Next.js apps using the App Router, Reccy automatically passes through React Server Component requests while stubbing other API calls. This is enabled by default for detected Next.js projects.
Source Maps for Coverage
Section titled “Source Maps for Coverage”Enable detailed per-file coverage by providing source maps.
- Ensure your build generates source maps
- In Project Settings > Coverage, enable source map upload
- Configure your CI workflow to upload maps:
- uses: reccy/report-diffs-action/upload-assets@v1 with: api-token: ${{ secrets.RECCY_API_TOKEN }} app-directory: "dist" source-maps: trueWith source maps, you can:
- View coverage percentages per file and folder
- Identify untested code paths
- Prioritize which user flows to record
Cross-Environment Recording
Section titled “Cross-Environment Recording”Record sessions in one environment (production) and replay against another (staging/preview).
Requirements
Section titled “Requirements”For cross-environment replay to work:
| Aspect | Must Match |
|---|---|
| Routes | Same URL patterns |
| Auth | Compatible token format |
| APIs | Same endpoint paths |
| Assets | Use relative URLs |
Common Issues
Section titled “Common Issues”Assets loading from wrong environment:
<!-- Won't work cross-environment --><script src="https://prod.example.com/app.js"></script>
<!-- Works everywhere --><script src="/app.js"></script>Auth tokens rejected:
- Ensure test environments accept tokens from the recording environment
- Or configure token refresh for the target environment
Monorepo Configuration
Section titled “Monorepo Configuration”For monorepos with multiple apps:
Separate Projects
Section titled “Separate Projects”Create a Reccy project per app, each with its own:
- Recording token
- Session pool
- CI workflow
Shared Sessions
Section titled “Shared Sessions”If apps share components, you can:
- Record sessions from the consumer app
- Configure Reccy to test both consumer and component library changes
- Set up path-based workflow triggers:
on: push: paths: - "apps/web/**" - "packages/ui/**"Controlling Recording
Section titled “Controlling Recording”Start/Stop Programmatically
Section titled “Start/Stop Programmatically”For single-page apps or complex initialization:
import { startRecording, stopRecording } from "@reccyai/recorder";
// Start after specific conditionsawait authenticateUser();startRecording();
// Stop before sensitive operationsstopRecording();await processPayment();startRecording();Buffering Mode
Section titled “Buffering Mode”Record to memory first, then decide whether to send:
import { initRecorder, flush, discard } from "@reccyai/recorder";
initRecorder({ recordingToken: "<<TOKEN>>", bufferMode: true,});
// Later, based on conditions:if (userOptedIn) { await flush(); // Send buffered data} else { discard(); // Clear buffer without sending}