sqlx-pool

Automate PgPool setup and sharing across Axum and Leptos contexts.

Updated May 26, 2026
One-click install
npx skills add https://github.com/adelabdelgawad/rust-fullstack-agents --skill sqlx-pool
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sqlx-pool
Source: https://github.com/adelabdelgawad/rust-fullstack-agents/tree/main/plugins/rusty/skills/sqlx-pool
Command: npx skills add https://github.com/adelabdelgawad/rust-fullstack-agents --skill sqlx-pool

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates robust PgPool setup and safe sharing across Axum and Leptos contexts, reducing boilerplate and preventing misconfigurations.

Core Features & Use Cases

  • Pool construction with PgPoolOptions (max/min connections, acquire/idle/lifetime timeouts, test_before_acquire)
  • Sharing via Axum State and Leptos provide_context, including FromRef sub-state extraction
  • Lifecycle and safety guidance for Send-safety, long-running tasks, and proper pool usage across components

Quick Start

Configure PgPool at startup and wire it into Axum handlers and Leptos server functions.

Frequently Asked Questions about sqlx-pool

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share a PgPool safely across Axum and Leptos server functions?▼

PgPool sharing across Axum and Leptos uses State and provide_context to distribute the connection pool. You configure PgPoolOptions at startup and leverage FromRef for sub-state extraction, ensuring safe database access within server functions.

What PgPoolOptions can I configure for my Rust database pool?▼

You can configure PgPoolOptions including max and min connections, acquire timeouts, idle timeouts, connection lifetime timeouts, and test_before_acquire. These settings control the lifecycle and capacity of your shared PgPool.

How does FromRef work for extracting PgPool sub-state in Axum?▼

FromRef allows your Leptos server functions to extract the PgPool from Axum's application state. By implementing FromRef, you create sub-states that safely derive the shared pool, preventing direct coupling and ensuring Send-safety across components.

How do I handle Send-safety rules when sharing a PgPool in Axum and Leptos?▼

Handling Send-safety rules requires ensuring the shared PgPool works correctly across long-running tasks and async contexts. The Skill provides lifecycle guidance to maintain Send-safety, preventing runtime errors when sharing pool state across Axum handlers and Leptos components.

Can I use the same PgPool for Axum handlers and Leptos server functions?▼

Yes, you can use the same PgPool for both Axum handlers and Leptos server functions. The setup automates pool construction and lifecycle-aware sharing patterns, allowing both frameworks to safely access the shared database pool without boilerplate.