A production-ready Vite-based application that embeds the Ketcher chemical structure editor with full iframe communication support. Demo at ketcher.mireklzicar.com
- ⚛️ React 19 + TypeScript + Vite
- 🧪 Ketcher 3.2.0 chemical structure editor
- 🔌 Full iframe communication via postMessage API
- 🏗️ Standalone mode (no backend required)
- 📱 Responsive design
- 🚀 Production-ready build
- 📱 Fixed touch screen keyboard trigger on mobile devices
This project embeds and redistributes Ketcher — an open-source, web-based chemical structure editor developed and maintained by EPAM Life Sciences.
-
GitHub Repository: github.com/epam/ketcher
-
Documentation & Website: lifescience.opensource.epam.com/ketcher
-
License: Apache License 2.0
-
Acknowledgments and attributions: NOTICE
This project is not affiliated with or endorsed by EPAM Systems. It is an independent deployment and integration of Ketcher (version 3.2.0) with a custom iframe communication layer and self-hosted enhancements.
If you use this project in your research or work, please cite both this repository and the original Ketcher project:
The app will be available at http://localhost:5173
The Ketcher iframe communicates via postMessage. All communication is bidirectional and asynchronous.
- setMolecule / set-molecule: Set molecule from SMILES
- getSmiles / get-smiles: Request current SMILES
- clear: Clear the editor
- init: Ketcher initialized and ready
- smiles: Response to getSmiles request
- smiles-update: Automatic SMILES updates when structure changes
- moleculeSet: Confirmation that molecule was set
- cleared: Confirmation that editor was cleared
- error: Error occurred during operation
- VITE_API_PATH: Custom API endpoint (fallback for remote mode)
- PUBLIC_URL: Base URL for static resources
The application is configured to allow iframe embedding from any origin. For production, consider restricting origins in vite.config.ts:
The application is designed to be deployed as a static site. It includes:
- Standalone Ketcher service (no backend required)
- Optimized production build
- Proper CORS headers for iframe embedding
- Error handling and fallbacks
This project includes a complete Docker setup for production deployment with proper iframe support and CORS configuration.
The Docker setup includes:
- Multi-stage build: Uses Node.js Alpine for building and Nginx Alpine for serving
- Optimized nginx configuration: Custom nginx.conf with SPA routing support
- Iframe-friendly: Removes X-Frame-Options to allow cross-origin iframe embedding
- CORS enabled: Configured for cross-origin access
- Asset optimization: Gzip compression and caching for static files
- Proper permissions: Handles file ownership and permissions correctly
- Dockerfile - Multi-stage build configuration
- nginx.conf - Production nginx configuration with iframe support
- .dockerignore - Excludes development files and handles macOS compatibility
- Iframe Support: Full cross-origin iframe embedding capability
- SPA Routing: Proper handling of React Router routes
- Security Headers: Optimized security headers (except X-Frame-Options for iframe support)
- Performance: Gzip compression, asset caching, and optimized delivery
🚀 Live Demo: https://ketcher-docker-e78uoiplu-miroslav-lzicars-projects.vercel.app
The application has been successfully deployed to Vercel with optimized configuration for iframe embedding and CORS support.
The project includes a vercel.json configuration file with:
- Framework Detection: Automatically detected as Vite
- Build Command: pnpm build
- Output Directory: dist
- CORS Headers: Configured for cross-origin iframe embedding
- SPA Routing: Proper handling of React Router routes
Or deploy the static build directly:
The built application in dist/ can be deployed to any static hosting service (Vercel, Netlify, AWS S3, etc.). For iframe embedding, ensure your hosting platform allows:
- Custom headers configuration
- Cross-origin resource sharing (CORS)
- Removal of X-Frame-Options header
- App.tsx: Contains all iframe communication logic and Ketcher initialization
- utils.ts: Handles Ketcher standalone service provider setup
- vite.config.ts: Build configuration with CORS headers
.png)

![Why the PSF Withdrew a $1.5M US Government Grant Proposal [video]](https://www.youtube.com/img/desktop/supported_browsers/firefox.png)

