XcT_x_AyOuB
Auto-start Flask API service with dynamic port resolution.
The server automatically picks the correct port based on the hosting environment
(Render, Railway, Heroku, Replit, Fly.io, Cloud Run, Azure, Koyeb, …) and falls
back to an OS-assigned free port when nothing is configured. No more "port
already in use" or hard-coded 5000.
Install
pip install XcT_x_AyOuB
Usage
import XcT_x_AyOuB
That's it — the server starts and the process stays alive.
The banner shows you the actual port that was picked.
Force a specific port
PORT=8080 python my_script.py
Programmatic control
import XcT_x_AyOuB
print("Server is on port", XcT_x_AyOuB.get_port())
Endpoints
GET /start?uid=<UID>
GET /stop?uid=<UID>
GET /list
GET /status
GET /info?uid=<UID>
GET /restart
GET /settings (GET/POST)
Environment variables
The port resolver checks these env vars in order and uses the first one set:
PORT, SERVER_PORT, HTTP_PORT, WEBSITES_PORT (Azure), FUNCTIONS_CUSTOMHANDLER_PORT,
REPL_PORT (Replit), NIXPACKS_PORT (Railway), APP_PORT (Koyeb).
If none of them are set, the OS picks a free port automatically.
Other env vars:
XCT_NO_AUTOSTART=1 — disable auto-start, call XcT_x_AyOuB.run() manually
XCT_AUTOSTART_MODE=background — run server in a daemon thread
Changelog
1.0.2
- Dynamic port resolution: the server now adapts to the hosting platform
instead of being hard-coded to 5000.
- Scans all common platform env vars (Render/Railway/Heroku/Replit/Azure/…).
- Falls back to an OS-assigned free port if none is configured.
- If the chosen port is already busy, a free one is picked automatically.
- New helpers:
XcT_x_AyOuB.get_port() and XcT_x_AyOuB.resolve_port().
1.0.1
- Default auto-start mode changed from
background to blocking.
- Added startup banner with server URL.