Skip to main content

Coasti Planning Framework — Backend

The backend is a Python 3.13 FastAPI application managed with uv. It serves the framework and content-package assets from local Vite build directories.

Setup

Run this command from the repository root:

uv sync --directory backend --locked

The repository root also provides a Nix/direnv development shell that installs the required tools automatically. See the root README.

Build the frontend distributions

The backend does not build the frontend itself. Build the framework and the example extension before running the backend in local distribution mode; the framework build is also bundled into the package when building a wheel (see Package the backend).

Framework distribution

Install the frontend workspace dependencies and build the planner framework:

pnpm --dir frontend install --frozen-lockfile
pnpm --dir frontend build

This creates the framework distribution in frontend/app/dist.

Example extension distribution

Install the extension dependencies and build the example content package:

pnpm --dir content_example install --frozen-lockfile
pnpm --dir content_example build

This creates the extension distribution in content_example/dist. The build includes the generated manifest.json and Module Federation entry point.

Configuration

The server accepts a server command and an optional YAML configuration path. The legacy form with only the configuration path remains supported.

The example configuration is available at config.example.yml:

backend:
  host: 127.0.0.1
  port: 8000
framework:
  dist_folder: ../frontend/planner/dist
extension:
  dist_folder: ./dist

Configuration is loaded by EYConf using its Pydantic validation backend. The configuration is represented by three pairs of schema/runtime types in coasti_planner.config:

  • BackendConfigSchema / BackendConfig define the listening host and port.
  • AssetSourceSchema / AssetSource define a local distribution or remote development server.
  • ServerConfigSchema / ServerConfig combine the backend, framework, and extension settings.

Each asset source defines a local dist_folder. Relative paths are resolved relative to the configuration file, not relative to the current working directory.

Meta database

The framework owns a meta database, separate from the content-package databases. It will hold users, permissions, and application metadata; the schema is intentionally empty until the first models land. Configure a file-backed SQLAlchemy connection string, top level next to host and port; relative SQLite paths resolve against the configuration file:

database: sqlite:///./coasti_planner.sqlite

Schema changes are versioned with Alembic, and the backend applies pending migrations on startup, so there is no separate migration step before starting the server. The migration scripts live in src/coasti_planner/migrations and ship with the package. Alembic logs through the application logger.

Authoring or inspecting migrations still uses the CLI from backend/. Because alembic.ini holds no connection URL, point the CLI at a database with COASTI_DATABASE_URL or the app config named by EYCONF_CONFIG_FILE:

export COASTI_DATABASE_URL=sqlite:///./coasti_planner.sqlite
uv run alembic revision --autogenerate -m "add user roles"
uv run alembic check                              # fail when models and migrations diverge

Run the backend

From the repository root, after building both distributions:

uv run --directory backend coasti-planner ../content_example/config.example.yml

Run the full stack in development mode

Development mode does not require either frontend distribution directory. Run the backend from the backend project directory:

cd backend
uv run backend server --dev

The backend uses Uvicorn autoreload and the example configuration by default. Run the Vite development servers in separate terminals:

pnpm --dir frontend dev
pnpm --dir content_example dev

The frontend development server proxies API requests to the autoreloading backend, while the frontend and extension servers reload their own source files.

HTTP endpoints

  • / serves the framework index.html and its root-relative assets.
  • /api_v1/framework/{path} serves framework distribution files.
  • /api_v1/extension/{path} serves extension distribution files.
  • /api_v1/extension/manifest.json serves the extension's generated manifest.

The manifest is read from the extension distribution. It is not duplicated in the backend.

Package the backend

Building the backend bundles the framework build into the wheel:

pnpm --dir frontend build        # produces frontend/app/dist
uv build --directory backend     # bundles it into the package

The CustomBuildHook in backend/hatch_build.py copies frontend/app/dist into src/coasti_planner/assets before packaging, and hatchling includes that directory in both the wheel and the sdist through the artifacts entries in pyproject.toml. The installed backend serves those bundled assets by default, so it needs no separate framework distribution. Wheel and sdist builds fail with a clear error when the framework has not been built yet. Editable installs (uv sync) are allowed to skip the bundle because development serves the SPA from the Vite dev server; they still pick it up when the build exists.

Metadata

Release files for coasti-planner 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coasti-planner 0.2.2
File Size Uploaded Provenance
coasti_planner-0.2.2.tar.gz 1.7 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for coasti-planner 0.2.2
File Interpreter ABI Platform
coasti_planner-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 3.3 MB

Release files / coasti_planner-0.2.2.tar.gz

Download URL coasti_planner-0.2.2.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
19de4517bf30f3c5af878f3be3eb92014d318d0afb53dec241a2f4c0775f954c
BLAKE2b-256 checksum
How to use checksums
f296afdf21465ca8d610d464c6c7613508b20d4fe3ee255f3e0a247f64a7c4b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / coasti_planner-0.2.2-py3-none-any.whl

Download URL coasti_planner-0.2.2-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
922df7b3ee2667a3ea1e5e284a35054882c0d5d581ca10b2bf1545fa075d1033
BLAKE2b-256 checksum
How to use checksums
a69687b4efd680a104c48284cfdab0891b6cad215fa500eaa3baf1697a2e43a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for coasti-planner 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page