Metadata-Version: 2.4
Name: weirdfingers-boards
Version: 0.2.0
Summary: Backend API server for Boards - AI creative toolkit with GraphQL, auth adapters, and generation workers
Author-email: Boards Contributors <ai.overlord@weirdfingers.com>
License: MIT
Project-URL: Homepage, https://github.com/weirdfingers/boards
Project-URL: Documentation, https://docs.boards.io
Project-URL: Repository, https://github.com/weirdfingers/boards
Project-URL: Issues, https://github.com/weirdfingers/boards/issues
Project-URL: Changelog, https://github.com/weirdfingers/boards/blob/main/CHANGELOG.md
Keywords: ai,creative,toolkit,graphql,fastapi,strawberry,auth,generation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Framework :: FastAPI
Classifier: Framework :: AsyncIO
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: supabase>=2.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: strawberry-graphql[fastapi]>=0.200.0
Requires-Dist: fastapi>=0.100.0
Requires-Dist: uvicorn[standard]>=0.23.0
Requires-Dist: dramatiq[redis,watch]>=1.15.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: psycopg2-binary>=2.9.0
Requires-Dist: structlog>=23.0.0
Requires-Dist: asyncpg>=0.29.0
Requires-Dist: alembic>=1.13.2
Requires-Dist: aiofiles>=23.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: click>=8.0.0
Requires-Dist: redis>=5.0.0
Requires-Dist: pyjwt[crypto]>=2.8.0
Requires-Dist: psutil>=7.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-postgresql>=6.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: pyright>=1.1.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Requires-Dist: openai>=1.60.1; extra == "dev"
Requires-Dist: anthropic>=0.25.0; extra == "dev"
Requires-Dist: replicate>=1.0.4; extra == "dev"
Requires-Dist: together>=1.0.0; extra == "dev"
Requires-Dist: boto3>=1.34.0; extra == "dev"
Requires-Dist: aioboto3>=12.0.0; extra == "dev"
Requires-Dist: google-cloud-storage>=2.10.0; extra == "dev"
Requires-Dist: types-redis>=4.6.0; extra == "dev"
Provides-Extra: providers
Requires-Dist: openai>=1.60.1; extra == "providers"
Requires-Dist: anthropic>=0.25.0; extra == "providers"
Requires-Dist: replicate>=1.0.4; extra == "providers"
Requires-Dist: together>=1.0.0; extra == "providers"
Provides-Extra: storage-s3
Requires-Dist: boto3>=1.34.0; extra == "storage-s3"
Requires-Dist: aioboto3>=12.0.0; extra == "storage-s3"
Provides-Extra: storage-gcs
Requires-Dist: google-cloud-storage>=2.10.0; extra == "storage-gcs"

# Boards Backend

Backend for the Boards open-source creative toolkit for AI-generated content.

## Features

- 🎨 Multi-provider support (Replicate, Fal.ai, OpenAI, etc.)
- 🔌 Pluggable architecture for generators and providers
- 📊 GraphQL API with Strawberry
- 🗄️ PostgreSQL with SQLAlchemy 2.0
- 🔄 Migrations with Alembic (async) and timestamped filenames
- 👥 Multi-tenant support with tenant isolation
- 🔐 Pluggable authentication (Supabase, Clerk, Auth0, JWT)
- 📦 Flexible storage backends (Local, S3, GCS, Supabase)

## Installation

```bash
# Install from PyPI (includes core dependencies: Redis, PyJWT)
pip install boards-backend

# Or with optional provider/storage dependencies
pip install boards-backend[providers,storage-s3,storage-gcs]
```

### Development Installation

```bash
# Clone the repository and install (includes all extras for typecheck)
git clone https://github.com/weirdfingers/boards.git
cd boards/packages/backend
uv sync  # Automatically installs dev dependencies including all providers/storage
```

## Configuration

Copy `.env.example` to `.env` and configure your settings:

```bash
cp .env.example .env
```

Key configuration options:

- `BOARDS_DATABASE_URL`: PostgreSQL connection string (e.g. postgresql://user:pass@localhost:5433/db)
- `BOARDS_REDIS_URL`: Redis connection for job queue
- `BOARDS_STORAGE_PROVIDER`: Storage backend (local, s3, gcs, supabase)
- `BOARDS_AUTH_PROVIDER`: Authentication provider

## Database Setup

### 1. Create the database

```bash
createdb boards_dev
```

### 2. Apply initial schema via Alembic

```bash
# Use Alembic to create all tables
uv run alembic upgrade head
```

## Development

### Quick Start

```bash
# Start the API server (after installation and configuration)
boards-server

# Run database migrations
boards-migrate upgrade head

# Start background workers
boards-worker
```

### Development Server

```bash
# Using uvicorn directly
uvicorn boards.api.app:app --reload --port 8088

# Or using the module
python -m boards.api.app
```

### Access the GraphQL playground

Open http://localhost:8088/graphql in your browser.

### Database migrations

When you need to change the database schema, use Alembic.

```bash
# Create a new migration (autogenerate from models in boards.dbmodels)
uv run alembic revision -m "add feature" --autogenerate

# Apply latest migrations
uv run alembic upgrade head

# Roll back one revision
uv run alembic downgrade -1
```

📖 For detailed migration workflow, see docs and examples under `apps/docs`.

## Project Structure

```
packages/backend/
├── alembic/                 # Alembic migration scripts
│   └── versions/            # Timestamped revision files
├── alembic.ini              # Alembic config
├── src/boards/
│   ├── api/                 # FastAPI application
│   ├── dbmodels/            # SQLAlchemy ORM models (authoritative)
│   ├── database/            # Connection helpers and compatibility shim
│   ├── graphql/             # GraphQL schema and resolvers
│   ├── providers/           # Provider implementations
│   ├── generators/          # Generator implementations
│   ├── storage/             # Storage backends
│   └── config.py            # Configuration management
└── tests/
```

## License

MIT
