- Rust 47%
- Swift 45%
- Python 4%
- Shell 2%
- Go 1%
- 2 more languages 1%
mvmt.social #
A multi-platform monorepo for the mvmt applications and supporting services.
Layout #
apps/web: Leptos SSR and browser hydration library.apps/android: native Android application, written in Kotlin.apps/ios: native iOS application, written in Swift.apps/homepage: independently generated static Leptos homepage.services/api: consolidated Axum application serving web pages, assets, and APIs.crates/appview: lossless response types and optional backend projection/query store.crates/domain: framework-independent activity and product domain logic.infra: deployment and infrastructure code; intentionally outside the Cargo workspace.docs: product, architecture, and roadmap research.
Rust projects belong in the root Cargo workspace. The native applications remain outside Cargo and own their platform toolchains and manifests within their app directories.
Development #
The workspace is pinned to Rust 1.98.1. Install the pinned Leptos build tool and browser target:
cargo install cargo-leptos --version 0.3.11 --locked
rustup target add wasm32-unknown-unknown
Use the root justfile to run projects and workspace checks:
just web
just homepage
just api
just check
just test
just lint
just fmt
Running just or just web starts the consolidated application with live reload. just api builds browser assets and starts the same application without watching. just homepage generates standalone HTML/CSS in apps/homepage/dist; deploy only the generated index.html and assets/main.css, not stale files from earlier builds. Additional arguments are forwarded to the respective tools; the homepage generator accepts none.
The application listens on 127.0.0.1:8080 by default. MVMT_API_ADDR overrides LEPTOS_SITE_ADDR; keep MVMT_PUBLIC_URL aligned with the browser-facing origin. Logs go to stderr at info level; set RUST_LOG (for example RUST_LOG=mvmt_api=debug) to change the filter. Sign-in failures are logged with their error chain, which can include the entered account identifier or DID, but never cookies, tokens, PKCE/DPoP material, or callback query strings. SIGINT/SIGTERM stop accepting connections and let in-flight requests finish.
In an Amp orb, amp orb services ensure starts the supervised web and homepage previews declared in .amp/services.yaml. The web portal is a UI preview: the default OAuth origin is loopback, so portal sign-in needs separately configured public HTTPS client metadata and a stable auth key. Do not weaken origin checks to enable preview sign-in.
Activity contracts and isolated PDS tests #
The implementation plan and recording contract describe the phone-first activity work. Draft authored lexicons live in lexicons/social/mvmt, shared synthetic fixtures in fixtures/activity, and validation/lossless metadata merging in crates/domain. These are local drafts, not published schemas. The Leptos migration and AppView plan explicitly prohibit schema publication, schema-discovery DNS changes, and automatic publishing workflows; publication requires separate owner approval.
On Linux with Node 26+, unshare and ip, run:
just pds-install
just activity-test
Installation downloads pinned test dependencies; the test run itself starts the real reference PDS and a local PLC directory inside a loopback-only network namespace. It uses disposable synthetic accounts, verifies blocked external connectivity, exercises record/blob writes and conditional edits/deletes, restores records in fresh processes, and removes its data. It fails closed if isolation is unavailable. There is no Docker-daemon or public-network requirement for the test run. The harness README documents exact coverage, dependency risks and limits: protocol tests are not native OAuth/device evidence, and PDS acceptance is not custom-schema/content validation. This harness is not intended to run directly on macOS.
Read-only AppView prototype #
/activities browses an explicitly enrolled author DID; /activity?uri=… shows the observed revision. The ordinary public read contracts are /xrpc/social.mvmt.getActivity and /xrpc/social.mvmt.listActivities, documented in AppView API. Leptos SSR uses the same readiness-aware query service directly. Native publishing still goes to the user's PDS; no OAuth token is needed for ingestion or public reads. Recording descriptors are displayed without fetching blobs, and handles are omitted until identity freshness is proven.
Indexing is disabled by default. To connect a separately configured private, patched Tap instance, set MVMT_TAP_URL to its HTTP(S) origin and MVMT_TAP_PASSWORD to its admin password. Plain HTTP is accepted only on loopback IPs. Administration must remain private; do not put these credentials in browser code or query strings. Use the pinned revision and both production-compatible patches in Tap harness, never its namespace-only test binary for deployment. Enrollment and the social.mvmt.activity collection filter are operator-controlled; the app does not crawl, enroll users on login, or publish lexicons.
appview.sqlite3 is separate from auth.sqlite3. The worker commits per-record revision/tombstone/rejection state before acknowledging Tap. It reconciles current account status per delivery and every 30 seconds, ignoring stale identity payloads. Source disconnects, failed reconciliation, and source-generation mismatches disable reads. /health is process liveness; /health/index reports read availability, configuration, last acknowledged event time and last account sweep time. Neither reports network completeness or measured upstream lag. An empty result may mean indexing is pending. In-flight reads may finish after readiness clears, and lifecycle visibility is eventual.
Rebuild/restore rules:
- Stop both processes and rebuild Tap's database and
appview.sqlite3together. Never attach an old projection to a fresh source or change filters/enrollment underneath it. - Back up and restore the two databases as a consistent stopped pair, including WAL state or using SQLite backup APIs. Source generation identifies lineage, not backup age; it cannot detect mixed-age restores from the same lineage.
- Never delete
auth.sqlite3,auth.key, or separately retained operator policy as part of an index rebuild. Public rollout requires durable suppression/takedown controls and rate limits; they are not implemented by this prototype. - Record deletes and invalid replacements discard the stored record body. Account deactivation/unknown status hides but retains bodies so reactivation works without replay. Permanent account-content erasure requires a coordinated purge/paired rebuild;
/info404 alone cannot distinguish deletion from administrative untracking.
Public rollout remains blocked on upstream freshness/recovery policy, PDS/key migration proof, operator controls, rate limits, and account-erasure operations. See the plans for remaining acceptance gates. This prototype does not authorize public indexing, deployment, schema publication, DNS changes, or real-account writes.
Authentication #
The web app uses Jacquard OAuth as a server-side AT Protocol OAuth client. Sign in with a handle, DID, or HTTPS PDS URL; a Bluesky account is not required. Only the atproto identity scope is requested—no repository writes, activity publishing, email, or broad transitional scopes.
Local development #
Run from the workspace root:
just web
On your local machine, open http://localhost:8080 or http://127.0.0.1:8080. On localhost, the app reads its configured OAuth callback and navigates to the matching loopback-IP origin before showing sign-in. This keeps the login and callback cookies on the same host, as required by the AT Protocol localhost-client exception. Axum serves /auth/*, /oauth-client-metadata.json, pages, and assets directly; no frontend proxy is required. To change ports, set LEPTOS_SITE_ADDR and the matching loopback-IP MVMT_PUBLIC_URL. Restart after environment configuration changes; just api also requires a restart after source changes.
| Setting | Default | Purpose |
|---|---|---|
MVMT_API_ADDR |
LEPTOS_SITE_ADDR, otherwise 127.0.0.1:8080 |
Application bind address |
MVMT_PUBLIC_URL |
http://127.0.0.1:8080 |
Browser-facing origin, callback, and client metadata |
MVMT_DATA_DIR |
.data |
Private directory containing auth.sqlite3 and optional appview.sqlite3 |
MVMT_AUTH_KEY |
Generated local key for HTTP development | Base64-encoded 32-byte encryption key; required for HTTPS |
SQLx applies versioned migrations from services/api/migrations at startup. SQLite uses WAL, foreign keys, and a busy timeout. The schema separates DID-keyed accounts, OAuth sessions, one-use authorization requests, browser-bound login flows, and browser sessions. SQLite is sufficient for identity/session storage; a future spatial activity-query workload can motivate PostgreSQL/PostGIS independently.
OAuth tokens, PKCE verifiers, and DPoP private keys are encrypted with ChaCha20-Poly1305 before entering SQLite. Browser cookies contain random opaque tokens; only their SHA-256 hashes are stored. In-flight sign-ins expire after 10 minutes; browser sessions expire after 7 days without sliding renewal. Token refresh does not extend that deadline. Starting another sign-in in the same browser replaces its pending-flow cookie. Logout invalidates that browser session and attempts provider revocation, bounded to 10 seconds, without signing out other devices.
Local HTTP development generates .data/auth.key once. On Unix, the data directory must be mode 700 and the key mode 600. Keep the key across restarts; replacing it makes existing encrypted sessions unreadable. .data is ignored by version control. Back up SQLite consistently, including WAL state or using SQLite's backup API; store the encryption key separately from production database backups.
HTTPS deployment #
Build with cargo leptos build --release and deploy target/release/mvmt-api together with target/site. Set LEPTOS_SITE_ROOT if assets are installed elsewhere. Set MVMT_PUBLIC_URL to the public HTTPS origin with no custom port or path, and supply a stable secret MVMT_AUTH_KEY (generate one with openssl rand -base64 32). Use a single application process with its local SQLite database. Forward the public origin to Axum, including:
/auth/*→ API, preserving request bodies,Origin, andSet-Cookie./oauth-client-metadata.json→ API, publicly reachable as JSON without authentication or redirects./pkg/*→ compiled JS/WASM/CSS assets.- Registered page paths → Leptos server-rendered HTML; unknown paths return 404.
The homepage deploys separately as static files and needs no authentication database. Deployment instructions are not authorization to deploy or publish lexicons.
The API acts as a public OAuth client (token_endpoint_auth_method: none); the encryption key is not an OAuth client secret. DPoP and PKCE still bind each grant. HTTPS cookies use the __Host- prefix, Secure, HttpOnly, and SameSite=Lax. Login/logout require an exact matching Origin; callbacks additionally require a one-use state bound to the initiating browser. Do not enable cross-origin credentialed access or log callback query strings/cookies at the reverse proxy.
Outbound discovery and OAuth requests require public HTTPS destinations. Private/local PDS addresses, redirects, system proxies, and oversized responses are rejected; DNS answers are validated at connection resolution to prevent rebinding. Independent publicly hosted PDSs are supported, but local/private-network PDS development is intentionally not exposed through this server.
Handle TXT records are resolved through Jacquard's Cloudflare DNS-over-HTTPS path, using the same hardened HTTPS transport. Its native dns feature is intentionally disabled: the 0.12.2 with_system_dns() initializer creates an empty nameserver configuration. DNS-only handles do not need a working HTTPS identity endpoint; TLS verification remains required for all HTTPS requests.
If DoH and HTTPS handle discovery both fail, Jacquard uses the public Bluesky com.atproto.identity.resolveHandle endpoint as a secondary interoperability fallback. The returned DID is not trusted by itself: its DID document must claim the entered handle, and OAuth must still validate the account and issuer. Direct discovery remains first and does not require this fallback.
Verification #
just test
just lint
The authentication scenarios exercise Jacquard's real OAuth flow against a controlled provider: PAR/PKCE, DPoP nonce challenges, callback/browser binding, issuer/account/scope rejection, restart persistence, refresh, and offline-provider logout. Storage tests cover encryption, expiry, atomic replay prevention, and independent device sessions. Live browser verification reached Bluesky authorization and exercised cancellation; successful live-account authorization requires an account owner to complete their provider's sign-in.