
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
create-sqlalchemy-app
Advanced tools
Create SQLAlchemy applications with a single command - like Create React App for Python backends
Create SQLAlchemy applications with a single command - like Create React App, but for Python backends.
pip install create-sqlalchemy-app
csa my-project
pip install create-sqlalchemy-app
brew install pipx
pipx install create-sqlalchemy-app
pip install create-sqlalchemy-app
# or with pipx:
pipx install create-sqlalchemy-app
After installation, both create-sqlalchemy-app and csa commands are available.
pip install create-sqlalchemy-app
Interactive mode (recommended):
create-sqlalchemy-app my-project
# or use the short alias:
csa my-project
Non-interactive with all options:
csa my-project \
--framework fastapi \
--database postgresql \
--db-name mydb \
--db-user postgres \
--db-password secret \
-y
my-project/
├── .venv/ # Virtual environment
├── models/ # SQLAlchemy models
│ ├── __init__.py
│ └── base.py # Base class with documentation
├── migrations/ # Alembic migrations
│ ├── versions/
│ ├── env.py
│ └── script.py.mako
├── scripts/
│ ├── generate_erd.py # ERD diagram generator
│ └── data_import.py # CSV data importer
├── tests/
│ ├── conftest.py # Test fixtures
│ └── integration_tests/
├── data/
│ └── db.py # Database configuration
├── docs/
│ └── CSV_IMPORT.md # CSV import guide
├── .env # Environment variables
├── .gitignore
├── alembic.ini
├── requirements.txt
└── docker-compose.yml # (if Docker selected)
Framework-specific files:
main.py, api/routes/app/, run.pymain.py (just database operations)Usage: create-sqlalchemy-app [OPTIONS] [PROJECT_NAME]
Options:
-d, --directory PATH Parent directory for the project
-f, --framework Framework: fastapi, flask, minimal
-db, --database Database: postgresql, sqlite, mysql
--db-name TEXT Database name
--db-user TEXT Database user
--db-password TEXT Database password
--db-host TEXT Database host (default: localhost)
--db-port TEXT Database port
--no-docker Skip Docker setup
--no-tests Skip test suite
--no-git Skip Git initialization
--no-erd Skip ERD generator
--no-csv-import Skip CSV import module
-s, --starter Starter kit: auth, blog, ecommerce
-y, --yes Skip prompts (requires --framework and --database)
--version Show version and exit
--help Show this message and exit
Navigate to your project:
cd my-project
Start the database (if using Docker):
docker-compose up -d
Activate the virtual environment:
# Unix/macOS
source .venv/bin/activate
# Windows
.\.venv\Scripts\activate
Create your models in models/ directory (see models/base.py for examples)
Create and apply migrations:
alembic revision --autogenerate -m "Initial migration"
alembic upgrade head
Run your application:
# FastAPI
uvicorn main:app --reload
# Flask
python run.py
# Minimal
python main.py
Run tests:
pytest -xvs
The generated models/base.py includes comprehensive documentation. Here's a quick example:
# models/user.py
from sqlalchemy import Column, String, Boolean, DateTime
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.sql import func
import uuid
from .base import Base
class User(Base):
__tablename__ = "user"
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
email = Column(String(255), nullable=False, unique=True)
username = Column(String(100), nullable=False)
is_active = Column(Boolean, default=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
Don't forget to add it to models/__init__.py:
from .base import Base
from .user import User
__all__ = ["Base", "User"]
The generated scripts/data_import.py provides a framework for importing CSV data. Important: You must create models and configure the script before importing.
See docs/CSV_IMPORT.md for detailed instructions.
Generate database diagrams:
python scripts/generate_erd.py
The ERD is only regenerated when the schema changes (hash-based detection). Use --force to regenerate anyway.
| Database | Best For |
|---|---|
| PostgreSQL | Production, full-featured, recommended |
| SQLite | Development, prototyping, simple projects |
| MySQL | Legacy systems, shared hosting |
| Framework | Best For
|
|-------------|-----------------------------------------|
| FastAPI | Modern APIs, async, auto-documentation |
| Flask | Traditional web apps, flexibility |
| Minimal | ETL, scripts, data processing, learning |
Tests use the same database type as production (not SQLite for everything). This ensures tests accurately reflect production behavior.
A separate test database ({db_name}_test) is created automatically.
Clone and install in development mode:
git clone https://github.com/ShawnaRStaff/create-sqlalchemy-app.git
cd create-sqlalchemy-app
pip install -e ".[dev]"
Run package tests:
pytest tests/
MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
Create SQLAlchemy applications with a single command - like Create React App for Python backends
We found that create-sqlalchemy-app demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.