Skip to main content

Crate architect_sdk

Crate architect_sdk 

Source
Expand description

foundry-rs — configuration-driven REST backend library for Rust with PostgreSQL.

Define your schemas, tables, columns, and API entities in JSON. Get a fully working, production-grade REST API with multi-tenancy, validation, and OpenAPI docs — no entity-specific business logic required.

§Quick Start

Add to your Cargo.toml:

[dependencies]
foundry-rs = "0.1"

See the repository for full examples.

Re-exports§

pub use config::load_from_pool;
pub use config::resolve;
pub use config::FullConfig;
pub use config::ResolvedEntity;
pub use config::ResolvedModel;
pub use error::AppError;
pub use error::ConfigError;
pub use migration::apply_migrations;
pub use migration::compute_migration_plan;
pub use migration::execute_migration_plan;
pub use migration::MigrationOperation;
pub use migration::MigrationPlan;
pub use migration::MigrationRisk;
pub use migration::MigrationSafety;
pub use migration::MigrationStep;
pub use migration::MigrationSummary;
pub use response::error_body;
pub use response::success_many;
pub use response::success_one;
pub use routes::common_routes;
pub use routes::common_routes_with_ready;
pub use routes::config_routes;
pub use routes::entity_routes;
pub use service::CrudService;
pub use service::TenantExecutor;
pub use state::AppState;
pub use storage::init_storage_provider;
pub use storage::StorageProvider;
pub use store::create_pool;
pub use store::ensure_database_exists;
pub use store::ensure_sys_tables;
pub use store::DEFAULT_PACKAGE_ID;
pub use tenant::load_registry_from_pool;
pub use tenant::TenantEntry;
pub use tenant::TenantRegistry;
pub use tenant::TenantStrategy;

Modules§

authrs
Authrs permission-check client. Active only when AUTHRS_URL and SERVICE_NAME env vars are set.
case
Case conversion for API: request keys camelCase -> snake_case (for DB), response keys snake_case -> camelCase (for client).
config
db
Database dialect abstraction for architect-sdk.
error
Typed errors and HTTP mapping.
events
Decision-hub event publishing. Active only when DECISION_HUB_URL env var is set.
extensible_fields
Per-tenant extensible fields for extensible JSON/JSONB columns.
extractors
handlers
HTTP handlers for entity CRUD, config ingestion, package install, KV store data, and asset signing.
migration
Apply config to the database: DDL for schemas, enums, tables, indexes, and foreign keys. Order follows PostgreSQL dependencies (see docs/postgres-config-schema.md § 3.5).
openapi
Build OpenAPI spec from architect.sys* tables. Exposed at GET /spec. APIs and paths come from _sys_api_entities per package; parameters and request/response body schemas are built from _sys_columns (column names, types, nullable, default). Entity and KV paths are generated dynamically by listing _sys_packages and loading each package’s config.
response
Standard response envelope helpers.
routes
Route registration: common, config, entity.
service
CrudService: generic CRUD using safe SQL builder.
sql
Safe SQL builder: identifiers from config only, values as parameters.
state
Shared application state for all routes. Model is reloadable after package install.
storage
Storage provider abstraction: upload, presign, delete.
store
sys* table DDL and config persistence. All sys* tables live in a schema named from ARCHITECT_SCHEMA env (default architect).
tenant
Multi-tenant registry: strategy and config per tenant, loaded from central DB.