# Nostr for Science – Single page app (SPA) Publishing Platform Specification ## Problem - most of science papers can be and ar presented as interactive single page apps but there is no platform ( like substack ) for hosting SPAs .. which means researchers end up creating their own websites on GitHub which lack features like zaps or comments or social discovery. ## 1. Overview “Nostr for Science” is a decentralized platform for publishing **interactive single-page applications (SPAs)** as research papers. It leverages **Nostr** for identity, discovery, and commenting, and **Blossom** for hosting SPA bundles. The platform hides technical complexity from creators while ensuring all papers are discoverable across the Nostr ecosystem. --- ## 2. Goals - Provide a simple SPA publishing workflow for creators with no knowledge of protocols. - Offer a discovery hub with tile-based layout organized by research categories. - Enable readers to save/pin papers and interact via comments and zaps. - Ensure interoperability: all publications are visible on any Nostr client with a link to the platform. --- ## 3. User Roles & Features ### 3.1 Creators - **Identity**: Generate a Nostr ID in-app (public/private keypair). - **SPA Upload**: Drag-and-drop SPA bundle (`index.html`, `.js`, `.css`, assets). - **Metadata Form**: Title, abstract, authors (optionally ORCID), category, keywords, PDF/DOI link. - **Publishing**: Click “Publish” → client uploads to Blossom → publishes a signed Nostr event linking the SPA. - **Preview**: Optionally preview SPA inline before publishing. ### 3.2 Readers - **Discovery Hub**: Tile-based feed displaying papers with preview image, title, abstract, author. - **Categories**: - Physics - Mathematics - Computer Science / AI - Biology & Medicine - Social Sciences - Economics & Finance - Engineering - Interdisciplinary / Other - **Dashboard / Personal Space**: - Pinned papers (bookmarks saved by Nostr key). - Commenting via Nostr events (`kind: 1`). - Zapping via LNURL / NIP-57. - **Profile**: Shows user comments, zaps, pinned papers. ### 3.3 Nostr Ecosystem Interoperability - Published SPA metadata is a standard Nostr event (`kind: 30100`) with Blossom link. - Papers appear on all Nostr clients as a clickable link. - Client footer: “Open this interactive paper in Nostr for Science → [link]”. --- ## 4. Workflows ### 4.1 Publishing Flow 1. Click **New Publication**. 2. Fill metadata form. 3. Drag-and-drop SPA bundle. 4. Client uploads SPA to Blossom node (gets hash). 5. Create signed Nostr event with metadata + Blossom link. 6. Publish event to relays. 7. Paper appears in Discovery feed. ### 4.2 Discovery Flow 1. Open client → grid of latest papers. 2. Filter by category/keywords. 3. Click tile → SPA loads inline (iframe) or new tab. 4. Interact: comment, zap, pin. ### 4.3 Reader Dashboard Flow 1. Login with Nostr key. 2. View pinned papers, comments, and zaps. 3. Organize reading list; optionally share as Nostr event. --- ## 5. MVP Feature Set - [x] Nostr ID creation & login. - [x] SPA upload & Blossom storage (abstracted). - [x] Metadata form + publishing as Nostr event. - [x] Discovery hub with categories & search. - [x] Personal dashboard with pinned papers. - [x] Commenting & zapping. - [x] SPA embedding inline. - [x] Papers visible on all Nostr clients with platform link. --- ## 6. Stretch / Future Features - Advanced semantic search by abstract/content. - Academic integrations: ORCID, DOIs, BibTeX export. - Author analytics: views, zaps, shares. - Institutional / lab hubs. - Private / preprint sharing with access control. - Multi-node Blossom mirroring for resilience. --- ## 7. Technical Stack - **Frontend**: React / Next.js + Tailwind CSS. - **State / Nostr**: nostr-tools, nostr-react. - **Storage**: Blossom nodes + gateway abstraction. - **Payments**: LNURL / NIP-57 for zaps. - **Identity**: Browser key management, optional import from extensions (Alby/NostrSigner). --- ## 8. Blossom Nodes (Initial Setup) | Node | Role | Strengths | Limitations | |------|------|-----------|-------------| | `blossom.nostr.build` | Primary | Well-documented; supports BUDs; 50MB free uploads | Paid plan needed for large apps; some file types restricted | | `blossom.primal.net` | Mirror / Alternative | Integrated with Primal; metadata stripping; mirrors | Shared resources; performance/storage may vary | | `strfry.nostr.lighting` | Fallback | Basic endpoints: `GET`, `PUT /upload`, `GET /list/<pubkey>` | Unknown quotas; less documented; test before primary use | | Custom / Self-hosted | Optional | Full control; ensure SPAs reliably hosted | Requires infra and maintenance | ### 8.1 Blossom Node Specs - **Endpoints**: - `PUT /upload` (signed Nostr event required) - `GET /<hash>` - `HEAD /<hash>` - `GET /list/<pubkey>` - `PUT /mirror` (optional) - **Supported File Types**: `.html, .js, .css, .svg, .png, .jpg, .gif, .wasm, .woff, .woff2, .ttf, .otf, .zip` - **File Size Limit**: 50 MB per upload (adjustable per node) - **Mirroring**: Optional, automatic if configured - **Authentication**: Write actions require signed Nostr events; read is public - **Quotas / Rate Limiting**: Enforce per-user limits; throttle upload rates --- ## 9. Metadata Event Format (Nostr Event) ```json { "kind": 30100, "content": "An interactive visualization of quantum states.", "tags": [ ["d", "quantum-spa-2025"], ["title", "Quantum Entanglement Explorer"], ["abstract", "Live simulation accompanying my paper on entanglement."], ["app", "blossom://bafkreigh2akiscaildc6indexhtml"], ["author", "npub1..."], ["link", "doi:10.xxxx/xxxx"] ], "pubkey": "npub1...", "created_at": 1699999999, "sig": "..." }