https://github.com/andgineer/fastapi-playground
A sandbox environment for experimenting with FastAPI, SQLModel, and Pydantic.
https://github.com/andgineer/fastapi-playground
fastapi pydantic python
Last synced: about 1 month ago
JSON representation
A sandbox environment for experimenting with FastAPI, SQLModel, and Pydantic.
- Host: GitHub
- URL: https://github.com/andgineer/fastapi-playground
- Owner: andgineer
- Created: 2021-08-06T07:08:59.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-05T13:46:15.000Z (over 1 year ago)
- Last Synced: 2025-01-13T01:36:35.920Z (over 1 year ago)
- Topics: fastapi, pydantic, python
- Language: Python
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI Playground
A sandbox environment for experimenting with FastAPI, SQLModel, and Pydantic.
Perfect for testing ideas, prototyping features, and learning the stack.
## Quick Start
### Local Development
. ./activate.sh
# FastAPI: Swagger UI at http://localhost:8000
make run
# SQLMoldel: Swagger UI at http://localhost:8000/docs
make sqlmodel
### Docker Setup
docker-compose up -d --build
docker-compose exec sqlmodel alembic upgrade head # Initialize database tables
#### Docker Compose Services
- **SQLModel Service**: Runs on port 8004
- **FastAPI Service**: Runs on port 8000
Test the SQLModel Service health with:
curl http://localhost:8004/ping
Expected response: {"ping":"pong!"}
## Database Setup
### PostgreSQL Client Installation
**macOS:**
brew doctor
brew update
brew install libpq
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
**Configure PostgreSQL password file:**
cp .pgpass ~/.pgpass
chmod 600 ~/.pgpass
### Database Management
**Connect to PostgreSQL:**
scripts/psql.sh
**View User table structure:**
\d+ User
## 🔄 Database Migrations (Alembic)
### Common Commands
**View migration history:**
docker-compose exec sqlmodel alembic history -v
**Generate new migration:**
docker-compose exec sqlmodel alembic revision --autogenerate -m "description"