webtyp/user is the stable, lightweight identity contract for the WebTyp
ecosystem. It contains only value types needed to pass an authenticated identity
across transport boundaries. Authentication, sessions, OAuth providers, and
authorization live in sibling libraries.
flowchart TD
U[webtyp.com/user<br/>stable Subject values only] --> A[webtyp.com/auth<br/>authentication + sessions]
U --> R[webtyp.com/rbac<br/>roles + permissions]
A --> C[application composition root]
R --> C
One-way rules:
userdepends only on the minimal shared WebTyp value packages required to transportSubject. It imports neitherauth,rbac,orm,fetch,jwt, nor any concrete provider.authimportsuserand may depend on its own persistence/runtime dependencies. It never importsrbac.rbacimportsuserand may depend on its own persistence/runtime dependencies. It never importsauth.- Only the application composition root imports both
authandrbac. It wires the narrow ports between them. - No compatibility packages remain at
webtyp.com/user/{authority,oauth2,email_password,trusted_ip,session}.
The root package exports exactly two domain values. It is not a service or adapter package:
type SubjectID string
type Subject struct {
ID SubjectID
Email string
Name string
Avatar string
}SubjectID is the only cross-library reference to a signed-in person.
auth owns resolving and creating Subject; rbac stores and evaluates
assignments by SubjectID; applications display a Subject returned by auth.
The root may contain value-only encoding helpers required to pass Subject
across the WebTyp typed transport. It contains no router route,
authentication interface, session interface, OAuth type, persistence port, error
value, model definition, CRUD presenter, event topic, or policy.
- WASM-safe: no Go standard-library dependency in code reachable from
WASM/TinyGo. Uses
webtyp.com/fmtwhere needed. - Typed and explicit: subject identity has one representation.
- Narrow ports: sibling libraries receive interfaces they need, never a concrete sibling module or database handle merely to reach another service.
- Every repeated string is a package constant in the owning module. The root defines none.