Skip to content

Repository files navigation

Backend

Python CI Code style: ruff

Table of Contents

Overview

This project is responsible for the backend services of the Astro-BEAM-AUTh application. It manages the following tasks:

  • Handling API requests and responses.
  • Managing user authentication and authorization.
  • Interfacing with the database for data storage and retrieval.
  • Managing telescope observations and scheduling.

How to Run

To run the backend, execute the following command:

uv run backend

Supabase Auth Setup

Configure backend authentication through environment variables (see .env.example).

Required values:

  • SUPABASE_URL: Supabase project URL (https://<project-ref>.supabase.co)
  • SUPABASE_AUDIENCE: expected JWT audience (default authenticated)

Auth policy values:

  • DEBUG_ALLOW_GUEST_HISTORY: temporary debug-only guest history flag; keep False in production

Database Management

Database lifecycle is managed from this project using Alembic migrations.

Initialize the database and apply all migrations:

uv run backend-db init

Apply pending migrations:

uv run backend-db upgrade

Create a new migration from model changes:

uv run backend-db revision -m "describe change" --autogenerate

Each created revision also generates SQL artifacts in migrations/versions/sql:

  • <revision_id>_upgrade.sql
  • <revision_id>_downgrade.sql

If you want to skip SQL artifact generation for a specific revision:

uv run backend-db revision -m "describe change" --autogenerate --no-sql

By default, revision IDs are generated as YYYYMMDD_NNNN. For example, the first revision on 2026-05-05 is 20260505_0001. You can still override manually:

uv run backend-db revision -m "describe change" --autogenerate --rev-id 20260505_0009

Inspect migration state:

uv run backend-db current
uv run backend-db history

Development

To install the development dependencies, run:

uv sync --dev

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.

Please read our Contributing Guidelines for more details.

About

Main backend for web and data APIs

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages