How jiffy-events/share works
Purpose and Entry Points
Jiffy Share is a self-hostable, temporary resource-sharing service for talks: speakers create a page, present a QR stage view, and audiences open a live public resource page. The Python application entry point is jiffy_share/app.py; deployment is container-oriented via Dockerfile, docker-compose.dev.yml, and Caddy reverse-proxy configuration in Caddyfile.
Application Composition
The app is organized as a Python backend with feature-focused route and service modules. Application setup, environment-derived settings, database initialization, static serving, and top-level concerns reside in:
• jiffy_share/app.py
• jiffy_share/config.py
• jiffy_share/database.py
Authentication, authorization, and rate limits are separate cross-cutting boundaries:
• jiffy_share/auth.py
• jiffy_share/auth_routes.py
• jiffy_share/rate_limit.py
Share Lifecycle and Ownership
The share domain owns creation, editing, expiry, and administrative control of temporary pages. Lifecycle logic is isolated from HTTP endpoints, while route modules expose the speaker/editor workflow:
• jiffy_share/share/lifecycle.py
• jiffy_share/share/routes.py
• jiffy_share/share/edit_routes.py
User ownership and organization-oriented access extend this model through user and admin routes plus speaker invitation flows:
• jiffy_share/user_routes.py
• jiffy_share/share/admin.py
• jiffy_share/share/speaker_invites.py
Public, Stage, and Real-Time Delivery
A created share is published through a link-based public route (/s/{slug} per README) and a separate stage-oriented QR experience. Public users need no account; protected deployment modes primarily gate creation and ordinary editing.
• jiffy_share/share/public_routes.py
• jiffy_share/share/stream_routes.py
• jiffy_share/share/sse.py
Server-Sent Events provide the live-update boundary between speaker mutations and open audience/stage clients. Rendering is backend-owned for page responses, with dedicated rendering modules:
• jiffy_share/share/rendering.py
• jiffy_share/share/admin_rendering.py
Resources, Files, and Offline Access
Shares contain ordered resource payloads such as links, notes, and uploaded files. Resource persistence/mutation and binary storage are separated:
• jiffy_share/share/payloads.py
• jiffy_share/share/save_resources.py
• jiffy_share/share/storage.py
Uploads and file-serving endpoints enforce the file-access boundary:
• jiffy_share/share/uploads.py
• jiffy_share/share/file_routes.py
The backend also supports a download queue, while browser clients can cache or retain audience resources for offline use:
• jiffy_share/share/download_queue.py
• jiffy_share/share/download_queue_routes.py
• static/src/share/public/offline/
Browser Clients
Static JavaScript implements distinct experiences rather than a generic SPA: speaker editor, public audience page, stage QR view, and speaker-invite flow. They communicate with backend APIs and react to real-time updates.
• static/src/share/editor.js
• static/src/share/public.js
• static/src/share/stage.js
The public client’s offline subsystem manages cache state, local copies, queue state, and service-worker communication:
• static/src/share/public/offline/cache.js
• static/src/share/public/offline/downloadQueueController.js
• static/share-offline-worker.js
Persistence and Operations
Relational schema evolution is managed with Alembic, covering shares, users/ownership, invitations, and download queues:
• alembic/env.py
• alembic/versions/0001_initial_share_schema.py
• alembic/versions/0004_share_download_queue.py
Runtime infrastructure is Python plus a Node 20+ JavaScript test environment. Docker/Caddy is the supported integrated deployment path; environment setup is driven by .env conventions and the guided setup script. Production and self-hosting operational boundaries are documented in docs/SELF_HOSTING.md.
Main entry points: app.py Application setup · public_routes.py Public and stage routes · lifecycle.py Share lifecycle · routes.py Speaker editing routes
Components 20
Python backend
HTTP application, share domain, and cross-cutting controls.
- Application setup · Initializes settings, database, static serving, and route composition.
jiffy_share/app.py - Settings
jiffy_share/config.py - Database layer
jiffy_share/database.py - Auth & rate limits · Authentication, authorization, and request limits.
jiffy_share/auth.py - Authentication routes
jiffy_share/auth_routes.py - Speaker editing routes · Creation and ordinary editor workflow.
jiffy_share/share/routes.py - Share lifecycle · Owns share creation, editing, expiry, and control.
jiffy_share/share/lifecycle.py - Ownership & invites · User, admin, organization access, and speaker invitations.
jiffy_share/share/speaker_invites.py - Public and stage routes · Serves public /s/{slug} and stage experiences.
jiffy_share/share/public_routes.py - Live update stream · Pushes speaker mutations to open clients.
jiffy_share/share/sse.py - Page rendering · Renders public, stage, and administrative responses.
jiffy_share/share/rendering.py - Resource persistence · Stores ordered links, notes, and resource payloads.
jiffy_share/share/save_resources.py - File storage & serving · Separates uploads and protected file delivery.
jiffy_share/share/storage.py - Download queue · Backend queue and endpoints for retained audience files.
jiffy_share/share/download_queue.py
Browser clients
Dedicated speaker, audience, and stage experiences.
- Speaker editor
static/src/share/editor.js - Audience client · Displays live resources and coordinates offline retention.
static/src/share/public.js - Stage QR client
static/src/share/stage.js - Offline cache & worker · Caches resources and manages browser download state.
static/share-offline-worker.js
Persistence & operations
Database schema and container deployment.
- Alembic migrations · Defines shares, users, invitations, and download queue schema.
alembic/env.py - Container deployment · Docker/Caddy self-hosted deployment boundary.
Dockerfile
Connections 26
- Settings → Application setup: configures
- Application setup → Database layer: initializes
- Application setup → Authentication routes: mounts
- Application setup → Speaker editing routes: mounts
- Application setup → Public and stage routes: mounts
- Authentication routes → Auth & rate limits: uses
- Speaker editing routes → Auth & rate limits: enforces
- Speaker editing routes → Share lifecycle: drives
- Share lifecycle → Ownership & invites: checks access
- Share lifecycle → Resource persistence: updates resources
- Share lifecycle → Live update stream: publishes changes
- Resource persistence → Database layer: persists
- Resource persistence → File storage & serving: stores files
- Public and stage routes → Page rendering: renders
- Public and stage routes → Live update stream: opens stream
- Public and stage routes → Download queue: serves queue APIs
- Download queue → Database layer: persists queue
- Speaker editor → Speaker editing routes: edits shares
- Audience client → Public and stage routes: loads /s/{slug}
- Audience client → Live update stream: receives updates
- Stage QR client → Public and stage routes: loads stage
- Stage QR client → Live update stream: receives updates
- Audience client → Offline cache & worker: manages offline copies
- Offline cache & worker → Download queue: uses queue APIs
- Alembic migrations → Database layer: evolves schema
- Container deployment → Application setup: runs