This guide covers a complete installation of Pagos Hotspot API from a fresh clone to a running server, including environment configuration, database setup, and both development and production startup commands. The service is a standard ASGI application built on FastAPI — no containers are required, though Docker Compose works equally well.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sistemashm24/pagos_hotspot_api/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before installing, ensure the following are available on your server or local machine:| Requirement | Minimum Version | Notes |
|---|---|---|
| Python | 3.9+ | 3.11 recommended |
| PostgreSQL | 15+ | Must be running and accessible |
| MikroTik RouterOS | 6+ | API service must be enabled on the router |
| Conekta account | — | Required for Conekta payments; obtain test keys at conekta.com |
| Mercado Pago account | — | Required for Mercado Pago payments; obtain credentials at mercadopago.com |
At least one payment gateway (Conekta or Mercado Pago) must be configured per company. You can start with test/sandbox credentials and switch to production keys later through the
cliente_admin panel.Install Steps
Install Python Dependencies
requirements.txt includes the following major packages:| Package | Purpose |
|---|---|
fastapi==0.104.1 | Web framework and OpenAPI generation |
uvicorn[standard]==0.24.0 | ASGI server (development) |
pydantic==2.5.0 | Request/response validation |
pydantic-settings==2.1.0 | Settings management from .env |
sqlalchemy==2.0.23 | Async ORM |
asyncpg==0.29.0 | Async PostgreSQL driver |
alembic==1.12.1 | Database schema migrations |
psycopg2-binary==2.9.9 | Sync PostgreSQL driver (Alembic) |
python-jose[cryptography]==3.3.0 | JWT API Key creation and validation |
passlib[bcrypt]==1.7.4 | Password hashing |
cryptography==41.0.7 | AES encryption for Mercado Pago tokens |
librouteros==3.3.0 | MikroTik RouterOS API client |
aiohttp==3.9.1 | Async HTTP client for gateway calls |
redis==5.0.1 | Caching layer |
structlog==23.2.0 | Structured JSON logging |
mercadopago | Mercado Pago SDK |
Create the .env Configuration File
Copy the example below into a new Required fields — the server will refuse to start if any of these are missing or empty:
.env file in the project root and fill in your values:| Variable | Description |
|---|---|
DATABASE_URL | Full async PostgreSQL connection string (postgresql+asyncpg://...) |
JWT_APIKEY_SECRET | Secret used to sign and verify router API Keys |
JWT_SESSION_SECRET | Secret used to sign and verify admin session tokens |
SECRET_KEY | General application secret key |
SUPER_ADMIN_INITIAL_EMAIL | Email for the initial super_admin account created by init_system.py |
SUPER_ADMIN_INITIAL_PASSWORD | Password for the initial super_admin account |
ENCRYPTION_KEY_MERCADO_PAGO | Fernet key used to encrypt Mercado Pago access_token and webhook_secret at rest |
Create the PostgreSQL Database
Run Database Migrations
Alembic manages the schema. Apply all migrations with:You should see output similar to:
Initialize the Super Admin Account
Run the initialization script to create the first Expected output:If you run this script again on an existing database, it will safely skip creation:
super_admin user using the credentials from your .env:Start the Server
2 × CPU cores + 1. For a 2-core VPS, use -w 5. Each worker handles requests independently, so scale horizontally before increasing workers beyond 8.Next Steps
Quickstart
Send your first payment request and receive Hotspot credentials in minutes.
Authentication Overview
Learn how to generate router API Keys and admin session tokens.