internal/

directory
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT

Directories

Path Synopsis
api
Package api provides the HTTP server and route wiring for Hardcount.
Package api provides the HTTP server and route wiring for Hardcount.
middleware
Package middleware holds the HTTP middleware of the API server.
Package middleware holds the HTTP middleware of the API server.
respond
Package respond writes the API's JSON responses: success bodies, list pages and the error envelope.
Package respond writes the API's JSON responses: success bodies, list pages and the error envelope.
timefilter
Package timefilter parses the ?from and ?to query parameters, and named variants such as ?date_from and ?date_to, for the operator-facing list and export endpoints.
Package timefilter parses the ?from and ?to query parameters, and named variants such as ?date_from and ?date_to, for the operator-facing list and export endpoints.
Package auth issues API keys and decides who may do what.
Package auth issues API keys and decides who may do what.
Package billing contains the billing cycle engine, scheduler, and invoice preview.
Package billing contains the billing cycle engine, scheduler, and invoice preview.
Package config reads Hardcount's settings from the environment and checks them at start-up.
Package config reads Hardcount's settings from the environment and checks them at start-up.
Package dashmembers is the minimal team-membership surface: invite by email, tokenized accept, list, revoke, remove.
Package dashmembers is the minimal team-membership surface: invite by email, tokenized accept, list, revoke, remove.
Package doctor is the money-invariant sweep: a read-only check of a Hardcount database for states that no legal writer can produce.
Package doctor is the money-invariant sweep: a read-only check of a Hardcount database for states that no legal writer can produce.
Package domain holds what Hardcount's packages share: the types and status words that cross a package boundary or the wire, and the pure rules two packages must apply the same way, as Go functions or as the SQL text of a condition.
Package domain holds what Hardcount's packages share: the types and status words that cross a package boundary or the wire, and the pure rules two packages must apply the same way, as Go functions or as the SQL text of a condition.
Package errs provides structured domain errors with machine-readable codes.
Package errs provides structured domain errors with machine-readable codes.
Package hostedinvoice serves the public /v1/public/invoices/* surface — Stripe's hosted_invoice_url equivalent.
Package hostedinvoice serves the public /v1/public/invoices/* surface — Stripe's hosted_invoice_url equivalent.
integrations
litellm
Package litellm adapts LiteLLM Proxy's StandardLoggingPayload to Hardcount usage events.
Package litellm adapts LiteLLM Proxy's StandardLoggingPayload to Hardcount usage events.
breaker
Package breaker provides a global circuit breaker around Stripe API calls, built on sony/gobreaker/v2.
Package breaker provides a global circuit breaker around Stripe API calls, built on sony/gobreaker/v2.
Package paymentmethods is the customer-facing view of payment methods.
Package paymentmethods is the customer-facing view of payment methods.
Package pdffonts embeds the TTF fonts that Hardcount's PDF renderers use (invoice, credit note).
Package pdffonts embeds the TTF fonts that Hardcount's PDF renderers use (invoice, credit note).
platform
activity
Package activity holds the shape of an activity line and the words that more than one activity surface shares (ADR-128).
Package activity holds the shape of an activity line and the words that more than one activity surface shares (ADR-128).
clock
Package clock gives code the current time, by one rule: a request's time is bound by the API's middleware (api.bindRequestTime), and work that outlives a request, and every job, binds one per row (EnsureEffectiveNow).
Package clock gives code the current time, by one rule: a request's time is bound by the API's middleware (api.bindRequestTime), and work that outlives a request, and every job, binds one per row (EnsureEffectiveNow).
crypto
Package crypto encrypts stored values, such as PII fields and API secrets, with AES-256-GCM.
Package crypto encrypts stored values, such as PII fields and API secrets, with AES-256-GCM.
leader
Package leader holds singleton-role leadership as a row, not as a Postgres session (ADR-114).
Package leader holds singleton-role leadership as a row, not as a Postgres session (ADR-114).
leader/leadertest
Package leadertest lets store tests call leader-only methods with a real, live lease token and no heartbeat.
Package leadertest lets store tests call leader-only methods with a real, live lease token and no heartbeat.
listorder
Package listorder is the one rule for a list's ?sort and ?dir.
Package listorder is the one rule for a list's ?sort and ?dir.
logging
Package logging holds ErrorLevel, which picks the log level for an error from work done for a request.
Package logging holds ErrorLevel, which picks the log level for an error from work done for a request.
migrate
Package migrate applies Hardcount's database migrations with goose (ADR-125).
Package migrate applies Hardcount's database migrations with goose (ADR-125).
money
Package money holds small, dependency-free helpers for integer-cents math, shared by billing, subscription proration and tax.
Package money holds small, dependency-free helpers for integer-cents math, shared by billing, subscription proration and tax.
postgres
Package postgres opens database transactions with the settings that row-level security (RLS) reads.
Package postgres opens database transactions with the settings that row-level security (RLS) reads.
request
Package request holds one HTTP request's record: what the layers of the request learn about it, readable by every layer, inner or outer.
Package request holds one HTTP request's record: what the layers of the request learn about it, readable by every layer, inner or outer.
request/requesttest
Package requesttest gives tests a request's record: request.Begin with a route that holds only the method, and no mw.TrustedClientIP in front, so the record's client address is the request's TCP peer.
Package requesttest gives tests a request's record: request.Begin with a route that holds only the method, and no mw.TrustedClientIP in front, so the record's client address is the request's TCP peer.
scheduler
Package scheduler hosts the standard tick-loop runner that every ticker-driven singleton worker in Hardcount uses.
Package scheduler hosts the standard tick-loop runner that every ticker-driven singleton worker in Hardcount uses.
telemetry
Package telemetry sets up OpenTelemetry tracing for Hardcount.
Package telemetry sets up OpenTelemetry tracing for Hardcount.
timeline
Package timeline holds the two ordering rules that every activity or timeline surface must keep:
Package timeline holds the two ordering rules that every activity or timeline surface must keep:
walk
Package walk reads a list to its end, one page at a time, in the order of the list's key.
Package walk reads a list to its end, one page at a time, in the order of the list's key.
weblink
Package weblink builds the links Hardcount sends people to, such as an emailed link or the page Stripe returns a customer to, under an address an operator set.
Package weblink builds the links Hardcount sends people to, such as an emailed link or the page Stripe returns a customer to, under an address an operator set.
Package recipe implements pricing recipes.
Package recipe implements pricing recipes.
Package session implements dashboard sessions, issued by the email and password login (ADR-011).
Package session implements dashboard sessions, issued by the email and password login (ADR-011).
subscriptiontest
Package subscriptiontest holds test-only fixtures for the subscription domain, in the same shape as platform/leader/leadertest.
Package subscriptiontest holds test-only fixtures for the subscription domain, in the same shape as platform/leader/leadertest.
Package tax defines the tenant-selectable tax calculation backend and three concrete implementations: NoneProvider (skip tax), ManualProvider (flat tenant-level rate), and StripeTaxProvider (Stripe Tax API; defers the invoice to tax_status=pending for retry on error).
Package tax defines the tenant-selectable tax calculation backend and three concrete implementations: NoneProvider (skip tax), ManualProvider (flat tenant-level rate), and StripeTaxProvider (Stripe Tax API; defers the invoice to tax_status=pending for retry on error).
Package testutil holds helpers that tests share: the integration test database (SetupTestDB, AdminPool), a database role for one test (CreateRole), a wait for a backend blocked on a lock (WaitForLockWaiter), and small readers for credit balances and the mode on a context.
Package testutil holds helpers that tests share: the integration test database (SetupTestDB, AdminPool), a database role for one test (CreateRole), a wait for a backend blocked on a lock (WaitForLockWaiter), and small readers for credit balances and the mode on a context.
pdftest
Package pdftest reads back what Hardcount's PDF renderers drew, for tests.
Package pdftest reads back what Hardcount's PDF renderers drew, for tests.
Provider cost rates + per-customer margin (ADR-079).
Provider cost rates + per-customer margin (ADR-079).
breachedpw
Package breachedpw holds the breached-password list that user.ValidatePassword checks when a password is set or reset (ADR-095, "Offline breached-password").
Package breachedpw holds the breached-password list that user.ValidatePassword checks when a password is set or reset (ADR-095, "Offline breached-password").
breachedpw/gen command
Command gen rebuilds internal/user/breachedpw/passwords.txt from a downloaded copy of the source list.
Command gen rebuilds internal/user/breachedpw/passwords.txt from a downloaded copy of the source list.
Package version carries the build-time version stamp.
Package version carries the build-time version stamp.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL