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

For the combined framework and content-package development environment, use the coasti_planner_workspace repository, which provides mise and an optional Nix dev shell.

Build the frontend distributions

The backend does not build the frontend itself. Build the framework distribution 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). Content packages are built in their own repositories.

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.

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.deployment.example.yml:

host: 127.0.0.1
port: 8000
mode: dev
database: sqlite:///./coasti_planner.sqlite

extensions:
  - path: "../content_package"
    dev_url: "http://localhost:5174"
    database: sqlite:///./content_package/data/dummy.sqlite

Configuration is loaded by EYConf using its Pydantic validation backend. ServerConfig in coasti_planner.config defines the listening host and port, the prod/dev mode, and the framework meta database. Each extensions entry is an ExtensionConfig pointing at a content package folder; its compile-time settings are read from the coasti.yml in that folder.

Relative paths resolve against the configuration file, not against the current working directory. dev_url serves the content package from a running Vite dev server instead of its built frontend folder; Python modules are still loaded from path.

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 the framework distribution and configuring your content package:

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

Run the full stack in development mode

Development mode is set by mode: dev in the configuration and runs Uvicorn with autoreload. Run the backend from the backend project directory:

cd backend
uv run coasti-planner ../config.deployment.example.yml

The backend watches the Python folders of every configured content package. Run the Vite development servers in separate terminals:

pnpm --dir frontend dev
pnpm --dir <content-package> dev

The frontend development server proxies API requests to the autoreloading backend, while the frontend and content package servers reload their own source files. Set dev_url in the content package's config entry to serve it from Vite instead of its built frontend folder.

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

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.5
File Size Uploaded Provenance Actions
coasti_planner-0.2.5.tar.gz 1.8 MB Without provenance Details for coasti_planner-0.2.5.tar.gz

Built distribution (wheel)

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

Total release size: 3.5 MB

Release files / coasti_planner-0.2.5.tar.gz

Download URL coasti_planner-0.2.5.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
9ccb24c8688c09aca9a08e11c7c2be72bd27a199373b12e139f95021607f75db
BLAKE2b-256 checksum
How to use checksums
8d01df99c3729ca0c53caac27f77bc3f5e155091b7b322067100addc0c10d67e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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}

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

Download URL coasti_planner-0.2.5-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8ed460112f448eb68fa62ec5f5638972beb504176033116d5dcc5acb8218cccb
BLAKE2b-256 checksum
How to use checksums
d135593c79edbed6193b010ed7cf6e4d07634b743e442bb587a00588b22a5e47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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}

Security for coasti-planner 0.2.5

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