• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
zcpbx

zcpbx

MolstarViewer

Public
Like
MolstarViewer
Home
Code
13
frontend
11
routes
1
shared
2
utils
.vtignore
AGENTS.md
CHANGELOG.md
MIGRATION.md
QUICKSTART.md
README.md
deno.json
index.html
index.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
shared
/
README.md
Code
/
shared
/
README.md
Search
…
Viewing readonly version of main branch: v461
View latest version
README.md

Shared

This directory contains shared types, utilities, and constants used across both backend and frontend code.

Structure

shared/
β”œβ”€β”€ types.ts      # Shared TypeScript types and interfaces
└── README.md     # This file

Types

MolstarAppConfig

Configuration options for initializing Molstar viewer instances:

interface MolstarAppConfig { layoutIsExpanded?: boolean; layoutShowControls?: boolean; layoutShowRemoteState?: boolean; layoutShowSequence?: boolean; layoutShowLog?: boolean; layoutShowLeftPanel?: boolean; collapseLeftPanel?: boolean; collapseRightPanel?: boolean; viewportShowExpand?: boolean; viewportShowControls?: boolean; viewportShowSettings?: boolean; viewportShowSelectionMode?: boolean; viewportShowAnimation?: boolean; viewportShowTrajectoryControls?: boolean; pdbProvider?: "pdbe" | "rcsb"; emdbProvider?: "pdbe" | "rcsb"; pixelScale?: number; pickScale?: number; transparency?: string; preferWebgl1?: boolean; allowMajorPerformanceCaveat?: boolean; powerPreference?: "high-performance" | "low-power" | "default"; }

StructureLoadOptions

Options for loading molecular structures:

interface StructureLoadOptions { url: string; format: string; isBinary?: boolean; label?: string; }

VolumeLoadOptions

Options for loading volume/density data:

interface VolumeLoadOptions { url: string; format: string; isBinary?: boolean; isovalues?: Array<{ type: "relative" | "absolute"; value: number; color: number; alpha?: number; volumeIndex?: number; }>; }

AppMetadata

Metadata for each Molstar application:

interface AppMetadata { name: string; description: string; path: string; icon: string; }

MOLSTAR_APPS

Array of all available Molstar applications:

const MOLSTAR_APPS: AppMetadata[] = [ { name: "Viewer", description: "Standard Mol* viewer for visualizing molecular structures", path: "/viewer", icon: "🧬", }, { name: "Docking Viewer", description: "Specialized viewer for molecular docking results", path: "/docking-viewer", icon: "πŸ”¬", }, { name: "Mesoscale Explorer", description: "Explore mesoscale biological structures", path: "/mesoscale-explorer", icon: "πŸ”­", }, { name: "MVS Stories", description: "Interactive molecular visualization stories", path: "/mvs-stories", icon: "πŸ“–", }, ];

Usage

Import shared types in both backend and frontend code:

import type { MolstarAppConfig, StructureLoadOptions } from "../shared/types.ts"; import { MOLSTAR_APPS } from "../shared/types.ts";

Important Notes

  • Code in shared/ must work in both server (Deno) and browser environments
  • Do NOT use Deno-specific APIs (like Deno.env) in shared code
  • Use ESM imports with .ts extensions for Val Town compatibility
  • All types should be exported for use in other parts of the application
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.