Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
moth
command
Command moth is the single-binary auth server for mobile apps.
|
Command moth is the single-binary auth server for mobile apps. |
|
gen
|
|
|
internal
|
|
|
acme
Package acme wires golang.org/x/crypto/acme/autocert so a bare VPS can get a Let's Encrypt certificate straight from the single moth binary via --acme-domain, with no reverse proxy in front.
|
Package acme wires golang.org/x/crypto/acme/autocert so a bare VPS can get a Let's Encrypt certificate straight from the single moth binary via --acme-domain, with no reverse proxy in front. |
|
analytics
Package analytics runs the milestone-07 aggregate-and-prune job: it rolls the raw event stream up into per-project daily_stats rows (bucketed in each project's rollup timezone) and prunes events older than the project's retention window.
|
Package analytics runs the milestone-07 aggregate-and-prune job: it rolls the raw event stream up into per-project daily_stats rows (bucketed in each project's rollup timezone) and prunes events older than the project's retention window. |
|
audit
Package audit records the append-only admin/security audit log.
|
Package audit records the append-only admin/security audit log. |
|
backup
Package backup produces and restores a single-file archive of a moth data directory: an online-consistent snapshot of the SQLite database plus the uploads and key material.
|
Package backup produces and restores a single-file archive of a moth data directory: an online-consistent snapshot of the SQLite database plus the uploads and key material. |
|
billing
Package billing validates App Store and Google Play subscription receipts and parses the two stores' server notifications, mapping both into one normalized model.
|
Package billing validates App Store and Google Play subscription receipts and parses the two stores' server notifications, mapping both into one normalized model. |
|
cli
Package cli implements the moth binary's remote-client mode: named contexts (server URL + personal access token) stored in ~/.config/moth/config.toml, connect clients for the moth.admin.v1 services authenticated by that token, and the declarative dump/apply logic built on ProjectSpec.
|
Package cli implements the moth binary's remote-client mode: named contexts (server URL + personal access token) stored in ~/.config/moth/config.toml, connect clients for the moth.admin.v1 services authenticated by that token, and the declarative dump/apply logic built on ProjectSpec. |
|
config
Package config resolves the moth server configuration.
|
Package config resolves the moth server configuration. |
|
docs
Package docs embeds the moth documentation and serves it, rendered to self-contained HTML, at /docs inside the binary.
|
Package docs embeds the moth documentation and serves it, rendered to self-contained HTML, at /docs inside the binary. |
|
entitlements
Package entitlements holds the pure entitlement-derivation engine: given a user's subscription rows and grants, it computes the set of entitlement identifiers the user currently holds.
|
Package entitlements holds the pure entitlement-derivation engine: given a user's subscription rows and grants, it computes the set of entitlement identifiers the user currently holds. |
|
events
Package events captures the server-emitted analytics events of milestone 07.
|
Package events captures the server-emitted analytics events of milestone 07. |
|
fonts
Package fonts ships the curated set of open-license typefaces a project theme can pick from (plan/06).
|
Package fonts ships the curated set of open-license typefaces a project theme can pick from (plan/06). |
|
httpsec
Package httpsec is the security-header middleware for moth's HTML and JSON surfaces: a strict Content-Security-Policy, HSTS (https only), X-Content-Type-Options, Referrer-Policy and frame options.
|
Package httpsec is the security-header middleware for moth's HTML and JSON surfaces: a strict Content-Security-Policy, HSTS (https only), X-Content-Type-Options, Referrer-Policy and frame options. |
|
i18n
Package i18n is moth's self-contained message catalog and locale negotiation.
|
Package i18n is moth's self-contained message catalog and locale negotiation. |
|
jwt
Package jwt signs and verifies moth access tokens: compact JWS with ES256, a kid header, and the fixed claim set moth mints.
|
Package jwt signs and verifies moth access tokens: compact JWS with ES256, a kid header, and the fixed claim set moth mints. |
|
keys
Package keys manages the instance master key and per-project ES256 signing keypairs.
|
Package keys manages the instance master key and per-project ES256 signing keypairs. |
|
mail
Package mail delivers moth's transactional emails.
|
Package mail delivers moth's transactional emails. |
|
metrics
Package metrics is moth's lightweight instrumentation: a small in-process registry of counters and latency histograms and an http.Handler that renders them in Prometheus text exposition format (version 0.0.4).
|
Package metrics is moth's lightweight instrumentation: a small in-process registry of counters and latency histograms and an http.Handler that renders them in Prometheus text exposition format (version 0.0.4). |
|
netutil
Package netutil derives the real client IP behind an optional set of trusted reverse proxies.
|
Package netutil derives the real client IP behind an optional set of trusted reverse proxies. |
|
oidc
Package oidc verifies Google and Apple ID tokens for social sign-in and talks to the providers' OAuth token endpoints.
|
Package oidc verifies Google and Apple ID tokens for social sign-in and talks to the providers' OAuth token endpoints. |
|
password
Package password hashes and verifies passwords with argon2id.
|
Package password hashes and verifies passwords with argon2id. |
|
paywall
Package paywall defines the per-project paywall configuration: the copy and layout knobs that the SDK's batteries-included paywall screen renders from (milestone 13).
|
Package paywall defines the per-project paywall configuration: the copy and layout knobs that the SDK's batteries-included paywall screen renders from (milestone 13). |
|
profile
Package profile defines the per-project setup profile (milestone 22): the creation wizard's answers — platforms, sign-in intent, monetization and push intent, plus the checklist-dismissed flag.
|
Package profile defines the per-project setup profile (milestone 22): the creation wizard's answers — platforms, sign-in intent, monetization and push intent, plus the checklist-dismissed flag. |
|
push
Package push defines the per-project push settings: the enabled switch for the push-device registry (milestone 20) and the Web Push VAPID public key browser clients subscribe with.
|
Package push defines the per-project push settings: the enabled switch for the push-device registry (milestone 20) and the Web Push VAPID public key browser clients subscribe with. |
|
pwimport
Package pwimport verifies foreign password hashes so users migrated from another auth system (Firebase, Auth0, Supabase, a home-grown backend) can sign in with their existing password without a reset.
|
Package pwimport verifies foreign password hashes so users migrated from another auth system (Firebase, Auth0, Supabase, a home-grown backend) can sign in with their existing password without a reset. |
|
ratelimit
Package ratelimit is moth's shared, SQLite-backed rate limiter for the credential-facing surfaces.
|
Package ratelimit is moth's shared, SQLite-backed rate limiter for the credential-facing surfaces. |
|
server
Package server assembles the moth HTTP handler: connect (gRPC / gRPC-Web) services and the plain-HTTP surfaces, multiplexed on one port.
|
Package server assembles the moth HTTP handler: connect (gRPC / gRPC-Web) services and the plain-HTTP surfaces, multiplexed on one port. |
|
server/rpc/admin
Package adminrpc implements the moth.admin.v1 connect services.
|
Package adminrpc implements the moth.admin.v1 connect services. |
|
server/rpc/auth
Package authrpc implements moth.auth.v1.AuthService — the public end-user authentication API.
|
Package authrpc implements moth.auth.v1.AuthService — the public end-user authentication API. |
|
server/rpc/billing
Package billingrpc implements moth.billing.v1.BillingService — the publishable-key + Bearer client API for subscriptions and entitlements — and hosts the shared store-validation plumbing the webhook and reconciliation sweep reuse.
|
Package billingrpc implements moth.billing.v1.BillingService — the publishable-key + Bearer client API for subscriptions and entitlements — and hosts the shared store-validation plumbing the webhook and reconciliation sweep reuse. |
|
server/rpc/push
Package pushrpc implements moth.push.v1.PushService — the publishable-key + Bearer client API for the push-device registry (milestone 20).
|
Package pushrpc implements moth.push.v1.PushService — the publishable-key + Bearer client API for the push-device registry (milestone 20). |
|
server/rpc/serverapi
Package serverapi implements moth.server.v1 — the services the developer's own backend calls with the project secret key (`x-moth-key: sk_...`): online token introspection and programmatic user management.
|
Package serverapi implements moth.server.v1 — the services the developer's own backend calls with the project secret key (`x-moth-key: sk_...`): online token introspection and programmatic user management. |
|
setup
Package setup implements the provider-console orchestration behind `moth setup google`, `moth setup apple` and `moth doctor`: guided or partially automated configuration of the Google/Apple sign-in consoles for one moth project, always followed by verification.
|
Package setup implements the provider-console orchestration behind `moth setup google`, `moth setup apple` and `moth doctor`: guided or partially automated configuration of the Google/Apple sign-in consoles for one moth project, always followed by verification. |
|
skill
Package skill renders the embedded moth agent skill: a SKILL.md + references/ directory (the Agent Skills format) teaching a coding agent both halves of moth — integrating the Flutter SDK into an app and administering an instance through the CLI.
|
Package skill renders the embedded moth agent skill: a SKILL.md + references/ directory (the Agent Skills format) teaching a coding agent both halves of moth — integrating the Flutter SDK into an app and administering an instance through the CLI. |
|
store
Package store is the SQLite persistence layer: connection setup, embedded migrations, and hand-written queries behind small per-domain interfaces (no ORM).
|
Package store is the SQLite persistence layer: connection setup, embedded migrations, and hand-written queries behind small per-domain interfaces (no ORM). |
|
theme
Package theme defines the per-project design system: a small, versioned set of tokens (colors, typography, spacing, corner radius, logo, legal links) that every end-user surface — the Flutter login screen, hosted web pages, emails — renders from.
|
Package theme defines the per-project design system: a small, versioned set of tokens (colors, typography, spacing, corner radius, logo, legal links) that every end-user surface — the Flutter login screen, hosted web pages, emails — renders from. |
|
token
Package token generates and hashes the random secrets moth hands out: publishable/secret API keys, admin session tokens, setup tokens.
|
Package token generates and hashes the random secrets moth hands out: publishable/secret API keys, admin session tokens, setup tokens. |
|
version
Package version exposes the build version of the moth binary.
|
Package version exposes the build version of the moth binary. |
|
Package proto embeds the .proto sources so the server can offer them for download from the admin setup-instructions page (developers generate their own moth.server.v1 clients from these).
|
Package proto embeds the .proto sources so the server can offer them for download from the admin setup-instructions page (developers generate their own moth.server.v1 clients from these). |
|
scripts
|
|
|
example_backend
command
Command example_backend is the "your own API" half of the moth loop: a tiny HTTP server that authenticates requests by verifying the moth access token (an ES256 JWT) against the project's public JWKS — exactly what any real backend does, in ~200 lines of standard library.
|
Command example_backend is the "your own API" half of the moth loop: a tiny HTTP server that authenticates requests by verifying the moth access token (an ES256 JWT) against the project's public JWKS — exactly what any real backend does, in ~200 lines of standard library. |
|
Package sdk embeds the moth_auth, moth_billing and moth_push Flutter package sources and the built @moth/react npm package so the server can serve them as a pub hosted repository under /pub and an npm registry under /npm.
|
Package sdk embeds the moth_auth, moth_billing and moth_push Flutter package sources and the built @moth/react npm package so the server can serve them as a pub hosted repository under /pub and an npm registry under /npm. |
Click to show internal directories.
Click to hide internal directories.