OmniViewer
October 30, 2025 ยท View on GitHub
A universal file viewer for the web - preview documents, images, and structured data directly in your browser
โจ Features
- ๐ผ๏ธ Image Viewing - Display all common image formats
- ๐ JSON Visualization - View JSON with syntax highlighting or as an interactive table
- ๐ Text Files - Read plain text files with proper formatting
- ๐จ Modern UI - Clean, intuitive interface with drag-and-drop support
- ๐ Extensible Architecture - Easily add new file viewers
- ๐ฏ Multi-Instance Viewers - Switch between different visualization modes for the same file type
๐ Getting Started
Prerequisites
- Node.js 18+ and npm/yarn/pnpm
Installation
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
# Lint code
pnpm lint
# Lint and fix
pnpm lint:fix
๐ Usage
- Open the application in your browser
- Drag and drop a file, or click to browse
- View your file instantly
- For files with multiple viewers (like JSON), switch between different visualization modes
๐๏ธ Architecture
Core Concepts
OmniViewer is built with extensibility in mind:
- Viewer Registry: Central registry mapping file types to available viewers
- Multi-Instance Support: Each file type can have multiple viewer implementations
- Type Detection: Automatic file type detection based on extension and MIME type
- Component-Based: Each viewer is an independent React component
Project Structure
src/
โโโ components/ # UI Components
โ โโโ file-uploader.tsx # Drag & drop file upload
โ โโโ viewer-container.tsx # Main viewer container
โ โโโ viewer-selector.tsx # Viewer mode switcher
โโโ viewers/ # Viewer Implementations
โ โโโ image-viewer.tsx # Image display
โ โโโ text-viewer.tsx # Plain text
โ โโโ json-highlight-viewer.tsx # JSON with syntax highlighting
โ โโโ json-table-viewer.tsx # JSON as table
โ โโโ index.ts # Viewer registry
โโโ types/ # TypeScript Definitions
โ โโโ viewer.ts # Core types
โโโ utils/ # Utilities
โ โโโ file-detector.ts # File type detection
โโโ app.tsx # Main application
โโโ main.tsx # Entry point
๐ง Adding New Viewers
Adding a new viewer is straightforward:
- Create a Viewer Component:
// src/viewers/my-viewer.tsx
import { ViewerProps } from "../types/viewer";
export default function MyViewer({ fileData, onError }: ViewerProps) {
// Your viewer implementation
return <div>...</div>;
}
- Register the Viewer:
// src/viewers/index.ts
import MyViewer from "./my-viewer";
export const viewers: ViewerConfig[] = [
// ... existing viewers
{
id: "my-viewer",
name: "My Viewer",
description: "Description of my viewer",
supportedTypes: ["mytype"],
component: MyViewer,
},
];
- Update File Detection (if needed):
// src/utils/file-detector.ts
// Add detection logic for your file type
๐จ Supported File Types
Currently supported:
- Images: JPG, PNG, GIF, WebP, SVG, BMP
- JSON: Syntax highlighting and table views
- Text: TXT, MD, LOG, CSV
Coming soon:
- PDF documents
- Word documents (DOCX)
- Excel spreadsheets (XLSX)
- XML files
- And more...
๐ Dark Mode
The UI is designed with dark mode support in mind. The structure is ready for theme implementation in future versions.
๐ฎ Future Enhancements
- Dark mode toggle
- PDF viewer integration
- Office document support (Word, Excel, PowerPoint)
- Browser extension integration
- URL input support
- File comparison mode
- Export/download capabilities
- Customizable themes
- Keyboard shortcuts
๐ ๏ธ Technology Stack
- React 18 - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- react-dropzone - File upload
- react-syntax-highlighter - Code highlighting
- mammoth - Word document parsing (planned)
- xlsx - Excel parsing (planned)
- pdfjs-dist - PDF rendering (planned)
๐ License
See LICENSE file for details.
๐ค Contributing
Contributions are welcome! Feel free to:
- Add new viewer implementations
- Improve existing viewers
- Enhance the UI/UX
- Report bugs or suggest features
๐ Development Notes
Browser Extension Integration
The architecture supports future browser extension integration. The plan is to:
- Allow opening files from browser context menus
- Preview files before downloading
- Enhance browser's native file viewing capabilities
This will be implemented in a future version.
Built with โค๏ธ for better file viewing experience