Skip to main content

Backend API server for Boards - AI creative toolkit with GraphQL, auth adapters, and generation workers

Project description

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

Minimal Install

The minimal installation includes core functionality with local filesystem storage only:

pip install weirdfingers-boards

Install with Specific Generators

Install only the generator providers you need:

# OpenAI generators (DALL-E 3, Whisper)
pip install weirdfingers-boards[generators-openai]

# Replicate generators (Flux Pro, Lipsync)
pip install weirdfingers-boards[generators-replicate]

# fal.ai generators (nano-banana)
pip install weirdfingers-boards[generators-fal]

# Multiple generators
pip install weirdfingers-boards[generators-openai,generators-replicate]

# All generators
pip install weirdfingers-boards[generators-all]

Install with Storage Backends

Add cloud storage providers as needed:

# S3 storage (AWS, MinIO, DigitalOcean Spaces)
pip install weirdfingers-boards[storage-s3]

# Supabase storage
pip install weirdfingers-boards[storage-supabase]

# Google Cloud Storage
pip install weirdfingers-boards[storage-gcs]

# All storage backends
pip install weirdfingers-boards[storage-all]

Full Installation

Install everything (all generators and storage backends):

pip install weirdfingers-boards[all]

Development Installation

For local development with all providers for type checking and testing:

# Clone the repository
git clone https://github.com/weirdfingers/boards.git
cd boards/packages/backend

# Install with dev dependencies (includes all providers)
uv sync

Configuration

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

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

createdb boards_dev

2. Apply initial schema via Alembic

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

Development

Quick Start

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

# Run database migrations
boards-migrate upgrade head

# Start background workers
boards-worker

Development Server

# 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.

# 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/

Community & Social

Join the Weirdfingers community:

Testing

Boards uses pytest for testing with both unit tests (mocked) and optional live API tests.

Running Tests

# Run all unit tests (excludes live API tests)
make test-backend

# Or using pytest directly
cd packages/backend
uv run pytest tests/

# Run with coverage
uv run pytest tests/ --cov=src/boards --cov-report=html

# Run specific test file
uv run pytest tests/generators/implementations/test_flux_pro.py -v

Unit Tests vs Live API Tests

Unit tests (default):

  • Use mocked provider SDKs
  • Fast and free
  • Run automatically in CI/CD
  • Located: tests/**/test_*.py

Live API tests (opt-in only):

  • Make real API calls to providers
  • Consume API credits
  • Never run by default
  • Located: tests/**/test_*_live.py

Running Live API Tests

Live tests verify real connectivity with provider APIs but cost money. They are excluded from default test runs.

# Set up API key
export BOARDS_GENERATOR_API_KEYS='{"REPLICATE_API_TOKEN": "r8_..."}'

# Run a specific generator's live test
uv run pytest tests/generators/implementations/test_flux_pro_live.py -v -m live_api

# Run all live tests for one provider
uv run pytest -m live_replicate -v

# Run all live tests (not recommended - expensive!)
uv run pytest -m live_api -v

For detailed information on live API testing, see:

Test Organization

tests/
โ”œโ”€โ”€ conftest.py                              # Shared fixtures (database, etc.)
โ”œโ”€โ”€ generators/
โ”‚   โ””โ”€โ”€ implementations/
โ”‚       โ”œโ”€โ”€ conftest.py                      # Generator-specific fixtures
โ”‚       โ”œโ”€โ”€ test_flux_pro.py                 # Unit tests (mocked)
โ”‚       โ”œโ”€โ”€ test_flux_pro_live.py           # Live API tests (opt-in)
โ”‚       โ””โ”€โ”€ ...
โ”œโ”€โ”€ graphql/                                 # GraphQL API tests
โ””โ”€โ”€ storage/                                 # Storage backend tests

License

MIT

Project details


Download files

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

Source Distribution

weirdfingers_boards-0.11.2.tar.gz (184.8 kB view details)

Uploaded Source

Built Distribution

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

weirdfingers_boards-0.11.2-py3-none-any.whl (343.7 kB view details)

Uploaded Python 3

File details

Details for the file weirdfingers_boards-0.11.2.tar.gz.

File metadata

  • Download URL: weirdfingers_boards-0.11.2.tar.gz
  • Upload date:
  • Size: 184.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for weirdfingers_boards-0.11.2.tar.gz
Algorithm Hash digest
SHA256 96a6f8d3431b64c4a494dbb4a61ddfd6e0b91e151159aaea4e26f9b580e3a97b
MD5 e4bb351369de0a9f00ebc7e0e8d85340
BLAKE2b-256 6b94e7c000fbe71383c90408abb62fafda7f078e0b7aeae91c37ce004bbcbbd2

See more details on using hashes here.

File details

Details for the file weirdfingers_boards-0.11.2-py3-none-any.whl.

File metadata

  • Download URL: weirdfingers_boards-0.11.2-py3-none-any.whl
  • Upload date:
  • Size: 343.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for weirdfingers_boards-0.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bce5ff1011cc5084fe2c043c98169ebbf1813c77684f3e9106643858b5d81375
MD5 ff1b4d87ac81c8c2a7c487f1e56f87c2
BLAKE2b-256 f0c86e3479d786408d6c3962257028f611f8ee4accc0a5b4cc7c1c5418fd0b26

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