--- /dev/null
+###############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2025 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+import fastapi
+import typing
+
+from . import apiv1
+from . import backend
+
+from ..distros import Distro
+from ..repos import Repo
+
+# Create a new router for all endpoints
+router = fastapi.APIRouter(
+ prefix="/distros",
+ tags=["Distributions"],
+)
+
+async def get_from_path(distro: str = fastapi.Path(...)) -> Distro:
+ """
+ Fetches the distribution from the name in the path
+ """
+ return await backend.distros.get_by_slug(distro)
+
+@router.get("")
+async def get_distros() -> typing.List[Distro]:
+ """
+ An endpoint to list all available distros
+ """
+ return [distro async for distro in backend.distros]
+
+@router.get("/{distro}")
+async def get_distro(distro = fastapi.Depends(get_from_path)) -> Distro:
+ """
+ An endpoint to fetch information about a specific distribution
+ """
+ # Send 404 if we could not find the distro
+ if not distro:
+ raise fastapi.HTTPException(404, "Could not find distro")
+
+ return distro
+
+@router.get("/{distro}/repos")
+async def get_repos(distro = fastapi.Depends(get_from_path)) -> typing.List[Repo]:
+ """
+ An endpoint to fetch all repositories that belong to a distro
+ """
+ # Send 404 if we could not find the distro
+ if not distro:
+ raise fastapi.HTTPException(404, "Could not find distro")
+
+ # Return a list with all repos
+ return await distro.get_repos()
+
+# Add everything to the APIv1
+apiv1.include_router(router)