ASI Database Node API
Production URL: https://asi-database-node-api.arybit.co.ke
FastAPI diagnostics, opt-in scoped user/authentication/session operations, an operator console, dual-engine database tooling,
and Azure deployment scripts for asi-database-node-api.
The backend is in backend/, static UI in ui/, SQL in Database/, and Azure tooling in deploy-database-api/.
Read the documentation index, database connection guide, deployment guide, and SQL catalog. Generated HTML starts at ui/doc/index.html, served after deployment at production documentation.
Database engines and isolated v14 deployment
MySQL 8.0 is the default for new deployments. MariaDB 10.11 uses the compatible
application adapter; PostgreSQL 16 remains supported and independently tested.
Use DATABASE_ENGINE=mysql|mariadb|postgresql; the legacy DB_ENGINE alias must
agree if present. Engine selection never migrates existing data.
The new production:14 target has its own resource group, VM, disk, SSH identity
and validation hostname. V13 is preserved. API-only access is the default:
HTTPS on 443, HTTP redirect on 80, restricted SSH and a loopback database.
Public database access requires a separate reviewed TLS/network configuration.
Read the v14 implementation checklist, migration and recovery runbook for exact prerequisites, tests, deployment commands and acceptance limitations. The last read-only Azure inspection returned ResourceNotFound for the old v13 VM; its canonical DNS still pointed at the former IP. No existing resources or DNS were modified by this work. V14 deployment is blocked pending operator-controlled backup encryption and verified validation DNS control. It is not production ready.
Local development
python -m venv .venv
source .venv/bin/activate
python -m pip install -r backend/requirements.lock -r backend/requirements-dev.txt
python tools/verify.py
python -m pytest backend/tests -q -p no:cacheprovider
cd backend
python -m uvicorn app:app --host 127.0.0.1 --port 8080
The local API provides /health, /healthz, /ready, /version, and interactive /docs. Production disables interactive OpenAPI documentation. Diagnostic readiness checks SELECT 1; application mode verifies required columns and the checksummed migration ledger. Neither proves consumer compatibility. The live operator console opens at / and /admin/ after deployment. Public health checks update automatically; database and service operations require the private VM operator token. See console operations.
Production configuration
The production:13 target example uses asi-database-node-api.arybit.co.ke. The VM version is independent of the public hostname. Review existing private deployment.targets.json separately; set the canonical domain, DNS and certificate aliases before deployment. Runtime allowed hosts and CORS derive from the selected target. The public UI follows its current HTTPS origin.
bash init-deploy-database-api.sh
bash run.sh --13 --staging --plan
bash run.sh --13 --staging --preflight
Production is the default environment. Automatic deploy/core can authenticate with Azure, publish source to main and wait for exact-commit CI. Review deployment before running cloud operations. Cleanup can remove disks and data.
Application operations
Set APPLICATION_API_ENABLED=1 after installing the selected engine auth stream: Database/mysql-auth or Database/postgresql-auth. Registered service keys supply narrowly scoped permissions and a server-controlled tenant. User lookup/create/update, hash-free credential status context, login events, sessions/revocation and atomic signup/password-reset token consumption are implemented. See API contract and PHP integration assumptions. No arbitrary SQL application endpoint exists. Keys rotate through a separate protected administrator CLI.
The new contract was exercised against disposable MySQL 8.0 and MariaDB 10.11 with PyMySQL. Existing legacy users are not automatically imported. The PHP consumer's source, live staging integration, new-schema backup restoration and production acceptance remain unverified. Default deployments retain PostgreSQL diagnostics.
TEST_MYSQL_PORTS=13306,13307 python -m pytest backend/tests/test_application.py -q
python tools/export-openapi.py --check
Database status
PostgreSQL and MySQL connectivity probes are supported. The PostgreSQL 16+ tenant/ledger foundation is experimental; it does not implement all legacy products. The legacy MySQL migration stream is disabled pending qualification. Schema changes, tenant isolation, backup restoration and public HTTPS require separate acceptance. Use SSH-tunneled database connections and private credentials; the production HTTPS URL is not a database socket.
Generate HTML documentation
python -m pip install -r tools/requirements-docs.txt
python tools/build-docs.py
python tools/build-docs.py --check
Every Markdown guide in docs/ is rendered under ui/doc/, alongside README and a reference for every SQL file. See documentation maintenance. SQL licensing is preserved in Database/LICENSE (repository file).