1 # GresIQ
2
3 GresIQ is smbCloud's managed PostgreSQL bootstrap crate for small and medium businesses. It is designed around the product shape teams expect from Neon, Prisma Postgres, and similar services:
4
5 - branch-aware environments
6 - autoscaling-friendly connection defaults
7 - safe connection-string handling
8 - a small Rust API that can sit underneath CLI, desktop, web, or future bindings
9
10 This crate is the Rust source of truth for bootstrapping a GresIQ connection and validating that a managed database endpoint is reachable.
11
12 ## What the bootstrap includes
13
14 - `GresiqConfig` for loading a managed Postgres target from environment variables
15 - explicit smbCloud environment handling for `development`, `preview`, and `production`
16 - branch metadata for project, branch, and region aware workloads
17 - TLS-aware `tokio-postgres` connection setup
18 - redacted connection-string output for logs and CLI diagnostics
19 - a health-check query that returns database name, user, and server version
20
21 ## Environment variables
22
23 `GresiqConfig::from_env()` reads:
24
25 ```text
26 GRESIQ_PROJECT_SLUG
27 GRESIQ_HOST
28 GRESIQ_USERNAME
29 GRESIQ_PASSWORD
30 GRESIQ_BRANCH=main
31 GRESIQ_REGION=eu-north-1
32 GRESIQ_DATABASE=postgres
33 GRESIQ_PORT=5432
34 GRESIQ_SSL_MODE=require
35 GRESIQ_COMPUTE_TIER=autoscale
36 GRESIQ_APPLICATION_NAME=gresiq
37 GRESIQ_CONNECT_TIMEOUT_SECONDS=10
38 SMBCLOUD_ENVIRONMENT=development
39 ```
40
41 ## Example
42
43 ```rust
44 use gresiq::GresiqConfig;
45
46 #[tokio::main]
47 async fn main() -> Result<(), Box<dyn std::error::Error>> {
48 let config = GresiqConfig::from_env()?;
49 let connection = config.connect().await?;
50 let health_check = connection.health_check().await?;
51
52 println!("{}", config.redacted_connection_string());
53 println!("{}", health_check.server_version);
54
55 Ok(())
56 }
57 ```
58
59 ## CLI bootstrap
60
61 Run the crate binary directly to validate a managed endpoint:
62
63 ```bash
64 cargo run -p gresiq
65 ```
66
67 The binary prints:
68
69 - branch and region summary
70 - selected compute tier
71 - redacted endpoint URL
72 - database health-check details
73
74 ## Product direction
75
76 The current bootstrap focuses on connection modeling and operational correctness. The next logical layer for GresIQ is:
77
78 - branch lifecycle APIs for preview environments
79 - pooled or proxy-based serverless connection routing
80 - passwordless or ephemeral credentials
81 - metrics, query insights, and tenant-aware usage controls
82 - adapters for smbCloud CLI, Tauri, wasm, npm, and native SDKs
83
84 More platform context is on the [smbCloud website](https://smbcloud.xyz/).
85
86 ## License
87
88 Apache-2.0
89
90 ## Copyright
91
92 © 2026 [smbCloud](https://smbcloud.xyz) (Splitfire AB).