The plan application's server as a mountable library: connect to the plan's own database, apply the auth and plan schemas, and serve the rows, the checks, the sources, the renders and the exported page as JSON and SVG behind a session, with the staff-ui bundle as the fallback.
| Tier | platform |
| Role | adapter |
| Path | crates/platform/subdivision-plan-api |
| Edition | 2021 |
| Targets | platform_subdivision_plan_api |
| Public items | 23 across 0 modules |
| Tests | 1 |
What it is for
The plan application's server, as a library a host mounts.
What a host keeps for itself is the process: tracing, the connection, the listener. What lives here is everything the browser talks to: login and sessions from application-auth, the plan's rows as JSON, the renders as SVG, the exported page as HTML, and the staff-ui bundle as the fallback for every other path.
Capabilities
crate root
The plan application's server, as a library a host mounts.
| Item |
|---|
async fn connect(var : & str) -> PgPool |
async fn ensure_schema(pool : & PgPool, url : & str) -> Result <(), String> |
async fn app(pool : PgPool, spa_dist : & std::path::Path) -> Router |
ApiError
The plan application's server, as a library a host mounts.
| Item |
|---|
ApiError :: fn into_response(self) -> Response |
ApiError :: fn from(e : sqlx::Error) -> Self |
AppState
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct AppState |
fn plan_router() -> Router <AppState> |
CheckDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct CheckDto |
LayerDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct LayerDto |
LotDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct LotDto |
MeasurementDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct MeasurementDto |
NormDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct NormDto |
OriginDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct OriginDto |
PartDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct PartDto |
PgPool
The plan application's server, as a library a host mounts.
| Item |
|---|
PgPool :: fn from_ref(s : & AppState) -> PgPool |
ProvenanceDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct ProvenanceDto |
RenderDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct RenderDto |
RenderListDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct RenderListDto |
SectionDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct SectionDto |
SourceDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct SourceDto |
Summary
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct Summary |
Tally
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct Tally |
TestDto
The plan application's server, as a library a host mounts.
| Item |
|---|
pub struct TestDto |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct AppState | — |
PgPool :: fn from_ref(s : & AppState) -> PgPool | — |
async fn connect(var : & str) -> PgPool | Connect to the database named by an environment variable, or refuse to guess one. |
async fn ensure_schema(pool : & PgPool, url : & str) -> Result <(), String> | Apply the auth schema and the plan schema; seed the admin named by PLAN_KM3_ADMIN_EMAIL and PLAN_KM3_ADMIN_PASSWORD when both are set. |
ApiError :: fn into_response(self) -> Response | — |
ApiError :: fn from(e : sqlx::Error) -> Self | — |
pub struct Tally | — |
pub struct Summary | — |
pub struct LayerDto | — |
pub struct LotDto | — |
pub struct PartDto | — |
pub struct SectionDto | — |
pub struct CheckDto | — |
pub struct MeasurementDto | — |
pub struct SourceDto | — |
pub struct NormDto | — |
pub struct RenderListDto | — |
pub struct RenderDto | — |
pub struct OriginDto | — |
pub struct TestDto | — |
pub struct ProvenanceDto | — |
fn plan_router() -> Router <AppState> | The plan's routes, every one behind a session. |
async fn app(pool : PgPool, spa_dist : & std::path::Path) -> Router | Everything the application serves, as one router: login and sessions, the plan API, and the staff-ui bundle at spa_dist for every other path |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into application, domain.
Shares tier platform with 11 other crates: platform-api, platform-corpus-console, platform-customer-ui, platform-disclosure-lab, platform-dto, platform-html-components, platform-leptos-components, platform-privacy-scan-api, … (11 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | platform |
| Architectural role (taxonomy) | adapter |
| Location | crates/platform/subdivision-plan-api |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_platform["platform"] --> n_application["application"] n_platform["platform"] --> n_domain["domain"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-auth` | application | no | always |
| `application-core` | application | no | always |
| `application-engine` | application | no | always |
| `application-parties` | application | no | always |
| `domain-subdivision-plan` | domain | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
axum | ^0.7 | multipart | no | always |
rust_decimal | ^1 | serde | no | always |
serde | ^1 | derive, derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
tokio | ^1 | full | no | always |
tower | ^0.5 | — | no | always |
tower-http | ^0.6 | fs, trace, cors, request-id, fs, set-header | no | always |
tower-sessions | ^0.13 | — | no | always |
tower-sessions-sqlx-store | ^0.14 | postgres | no | always |
tracing | ^0.1 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development. None.
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["platform-subdivision-plan-api"] SELF -->|runtime| n_application_auth["application-auth"] SELF -->|runtime| n_application_core["application-core"] SELF -->|runtime| n_application_engine["application-engine"] SELF -->|runtime| n_application_parties["application-parties"] SELF -->|runtime| n_domain_subdivision_plan["domain-subdivision-plan"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | platform_subdivision_plan_api | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | yes |
| database access | yes |
| network I/O | yes |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
PLAN_KM3_ADMIN_EMAIL | src/lib.rs |
PLAN_KM3_ADMIN_PASSWORD | src/lib.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 1 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 20 | 0 | 0 |
What the tests establish, by name:
every_plan_route_is_listed_once—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 4 | 23 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 4
"No rustdoc detected" : 19
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 650 |
| Code lines | 579 |
| Public API items | 23 |
| Public modules | 0 |
| Tests | 1 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 17 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"function" : 4
"method" : 3
"struct" : 16
pie showData
title Rust source composition
"Code" : 579
"Blank or comment" : 71
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.