Public
Like
MolstarViewer
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v584View latest version
All notable changes to the Molstar Viewer project will be documented in this file.
Complete restructure of the project to use Val Town best practices with proper routing, TSX components, and JSR imports.
-
New Project Structure
backend/- Hono-based routing and server logicfrontend/apps/- TSX components for each Molstar applicationshared/- Shared TypeScript types and utilities
-
Four Molstar Applications
/viewer- Standard Mol* viewer (fully ported)/docking-viewer- Docking viewer (scaffolded)/mesoscale-explorer- Mesoscale explorer (scaffolded)/mvs-stories- MVS Stories viewer (scaffolded)
-
Viewer App Features (fully ported from
viewer/)- Complete URL parameter support for configuration
- Load structures by PDB ID, EMDB ID, AlphaFold DB ID
- Load structures from custom URLs
- Snapshot loading (local and remote)
- MolViewSpec (MVS) support
- Custom rendering options (pixel scale, transparency, illumination)
- Provider selection (PDBe or RCSB)
- Debug and timing modes
- Error handling with user-friendly messages
-
JSR Integration
- All Molstar imports use JSR protocol:
jsr:@zachcp/molstar@5.3.4 - Client-side module imports work directly in browser
- All Molstar imports use JSR protocol:
-
Documentation
- Comprehensive README files in each directory
- URL parameter documentation for viewer app
- Architecture and development guides
- Example usage patterns
-
Import System
- Migrated from
import * as Molstar from 'jsr:@zachcp/molstar'to proper named imports - Changed from
https://jsr.io/URLs tojsr:protocol - Now using:
import { Viewer } from "jsr:@zachcp/molstar@5.3.4"
- Migrated from
-
Application Entry Point
index.tsxnow imports and exports the Hono app frombackend/index.tsx- Centralized routing through Hono instead of individual endpoints
-
Component Architecture
- Each app is now a standalone TSX component returning full HTML
- Server-side rendering with
renderToString - Client-side hydration with module scripts
import { Hono } from "https://esm.sh/hono@4";
import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
const app = new Hono();
app.get("/viewer", (c) => {
const html = renderToString(ViewerApp());
return c.html(html);
});
/** @jsxImportSource https://esm.sh/react@18.2.0 */
export default function ViewerApp() {
return (
<html lang="en">
<head>...</head>
<body>
<div id="app"></div>
<script type="module" dangerouslySetInnerHTML={{ __html: `
import { Viewer } from "jsr:@zachcp/molstar@5.3.4";
// Initialize viewer
`}} />
</body>
</html>
);
}
export interface MolstarAppConfig {
layoutIsExpanded?: boolean;
layoutShowControls?: boolean;
pdbProvider?: "pdbe" | "rcsb";
// ... more options
}
- Original Source Code
- All original app directories preserved as reference:
viewer/- Original viewer implementationdocking-viewer/- Original docking viewermesoscale-explorer/- Original mesoscale explorermvs-stories/- Original MVS stories
- All original app directories preserved as reference:
-
β Viewer App - Fully ported with all features
- URL parameter parsing
- Multiple data loading methods
- Configuration options
- Error handling
-
β³ Docking Viewer - Scaffolded (pending port)
-
β³ Mesoscale Explorer - Scaffolded (pending port)
-
β³ MVS Stories - Scaffolded (pending port)
- URL Structure: Apps now accessed via routes (
/viewer,/docking-viewer, etc.) instead of individual vals - Import Paths: JSR imports changed from
https://jsr.io/tojsr:protocol - Component Structure: Apps are now TSX components instead of standalone HTML files
- Port docking-viewer functionality to
frontend/apps/docking-viewer.tsx - Port mesoscale-explorer functionality to
frontend/apps/mesoscale-explorer.tsx - Port mvs-stories functionality to
frontend/apps/mvs-stories.tsx - Add CSS styling from original apps
- Test all URL parameters and loading methods
- Add example data and demos for each app
- Single
index.tsxwith embedded HTML - Direct Molstar imports
- Basic 1FAP structure viewer
- React-based component structure