database-guide
OfficialPostgreSQL setup for FastAPI with Docker
System Documentation
What problem does it solve?
Set up and manage PostgreSQL databases for FastAPI projects with a Docker-based local development workflow (single-command, no docker-compose) and production-ready configurations using environment variables. It follows a no-migrations philosophy, dropping and recreating the schema on changes, and provides guidance for setup_postgres.sh scripts, environment files that must be sourced manually, pydantic-settings configuration, SQLModel connections, lifespan handlers, session management, and Pytest-based tests using in-memory SQLite.
Core Features & Use Cases
- Docker-based local PostgreSQL setup with setup_postgres.sh
- Environment-based production configuration (must source deployment/*.env)
- No migrations policy with drop-and-recreate on schema changes
- SQLModel integration, lifespan management, and session handling
- Pytest with in-memory SQLite for fast tests
- Use Case: Configure a FastAPI app to connect to PostgreSQL, handle migrations via drop/recreate, and test endpoints locally.
Quick Start
Source deployment/demo.env to load local Postgres credentials and start the FastAPI app to create tables on startup.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: database-guide Download link: https://github.com/databio/ai-sandbox/archive/main.zip#database-guide Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.