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

  1. Open the application in your browser
  2. Drag and drop a file, or click to browse
  3. View your file instantly
  4. 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:

  1. 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>;
}
  1. 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,
  },
];
  1. 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:

  1. Allow opening files from browser context menus
  2. Preview files before downloading
  3. Enhance browser's native file viewing capabilities

This will be implemented in a future version.


Built with โค๏ธ for better file viewing experience