Skip to content

Repository files navigation

PI3-Back - GALPyra Backend

Backend para GALPyra con FastAPI, SQLAlchemy 2.0 async, MySQL 8, Alembic y Pydantic v2.

Requisitos

  • Python 3.11+
  • MySQL 8.0

Estructura principal

PI3-Back/
├── application.py
├── requirements.txt
├── .env.example
├── Dockerfile
├── docker-compose.yml
├── alembic/
├── app/
└── tests/

Configuracion

  1. Copia variables de entorno:
cp .env.example .env
  1. Crea entorno virtual e instala dependencias:
python -m venv .venv
. .venv/Scripts/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -r requirements.txt

Ejecutar con Docker

docker compose up -d --build

API disponible en http://localhost:8000.

Ejecucion local

  1. Levanta MySQL (local o con docker).
  2. Aplica migraciones.
  3. Ejecuta seed.
  4. Inicia FastAPI.
alembic upgrade head
python -m app.core.seed
uvicorn app.main:app --reload --port 8000

Migraciones Alembic

Crear migracion:

alembic revision --autogenerate -m "descripcion_cambio"

Aplicar migraciones:

alembic upgrade head

Revertir una migracion:

alembic downgrade -1

Revertir a version especifica:

alembic downgrade <revision_id>

Usuario admin seed

  • email: admin@galpyra.com
  • password: Admin123*
  • nombre: Administrador GALPyra
  • rol: ADMIN

Modo desarrollo abierto

Los endpoints estan abiertos para facilitar integracion con Flutter y Postman.

  • El flujo JWT (login/refresh/logout) ya esta implementado.
  • get_current_user ya existe en app/core/dependencies.py.
  • Para endurecer seguridad luego, agrega Depends(get_current_user) en los routers que correspondan.

Pruebas

pytest -q

Documentacion OpenAPI

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc
  • OpenAPI JSON: http://localhost:8000/openapi.json

Checklist de cierre

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages