You are building a developer tool for JSON formatting and structural diffing.
- Prefer simple, readable code over clever abstractions.
- Keep components small and isolated.
- Avoid unnecessary global state.
- Use TypeScript strictly.
- Follow shadcn/ui patterns and Tailwind utility classes.
- Keep styling minimal and professional.
- Never trust raw JSON input.
- Always validate before formatting.
- Show clear error messages with line/column if available.
- Diff must be structural (not plain text comparison).
Each diff entry should contain:
- path: string (dot notation)
- type: "added" | "removed" | "modified"
- oldValue?: unknown
- newValue?: unknown
Frontend must:
- Group diffs by top-level path
- Render badges for change types
- Allow collapsing unchanged sections
- Functional components only
- No large files (>300 lines)
- Extract reusable UI into /components
- Keep API logic in /lib/api.ts
- Use async/await
- Proper loading states
- Developer tool
- Clean
- Focused
- No unnecessary animations
- Subtle color palette
The goal is a fast, clean, production-ready JSON diff tool.