Skip to main content

Stash AI Overhaul Backend Server

Project description

AI Overhaul Backend

Minimal FastAPI backend with SQLite + Alembic migrations.

Features

  • FastAPI application exposing /api/v1/requests CRUD (create + read/list now)
  • SQLite database stored under backend/data/app.db
  • SQLAlchemy 2.0 style models
  • Alembic migration management
  • Docker dev environment with live reload (code mounted as volume)

Directory Layout

backend/
  stash_ai_server/
    api/          # Routers
    core/         # Config
    db/           # Session + base
    models/       # SQLAlchemy models
    schemas/      # Pydantic schemas
    main.py       # FastAPI entry
  alembic/        # Migration scripts
  alembic.ini     # Alembic config
  requirements.txt
  Dockerfile

Run (Docker Compose)

docker compose up --build

Then visit http://localhost:4153/docs for the Swagger UI.

During development, source changes under backend/stash_ai_server auto-reload thanks to --reload and bind mount.

Manual Local Run (Without Docker)

python -m venv .venv
. .venv/Scripts/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -r backend/requirements.txt
uvicorn stash_ai_server.main:app --reload

Configuration file

For secrets and a few runtime overrides (data dir, plugin dir, stash API key), copy config.sample.env to backend/config.env and edit values. This file is gitignored so your secrets won't be checked in.

Example:

cp backend/config.sample.env backend/config.env
# edit backend/config.env and then start the server

When running in Docker Compose the image expects /app/data and the compose file or secrets file should mount the appropriate host paths.

Conda / pip install users

If you install the package from PyPI (or from the built wheel), the alembic folder and alembic.ini are included in the package so you can run migrations after creating backend/config.env. For local editable installs (pip install -e .) ensure you run from the repo root so alembic is present in the working tree.

Apply Migrations

The container runs with Base.metadata.create_all() for convenience right now. To use Alembic migration fully:

# Inside container or local env (with PYTHONPATH set to backend):
alembic upgrade head

Example Requests

POST /api/v1/requests
{
  "prompt": "Describe scenic imagery"
}

GET /api/v1/requests
GET /api/v1/requests/1

Next Steps

  • Add status update endpoint (PATCH)
  • Introduce background processing queue
  • Add filtering/pagination on list endpoint
  • Add CORS config if frontend fetches directly
  • Authentication (API key or session) when needed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stash_ai_server-0.1.1a18-py3-none-any.whl (106.7 kB view details)

Uploaded Python 3

File details

Details for the file stash_ai_server-0.1.1a18-py3-none-any.whl.

File metadata

File hashes

Hashes for stash_ai_server-0.1.1a18-py3-none-any.whl
Algorithm Hash digest
SHA256 5a0edb1252db0eb7bcff66bd1d15560f2e185ed2c2b10b6aafaf90ebb0245782
MD5 da6f7e0ee5b746d200139442e96ad456
BLAKE2b-256 6a8f881d73a676381a63c13ca8dfa5f56444e0e12f4ef6d753f63e2af37e96d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page