THE MACHINE · Hugging Face deployment bundle

This folder is the complete deployment bundle; you do not need to create its directory structure manually. Dockerfile is at this folder's root and the included src/the_machine/ package tree must stay intact. For a Hugging Face Space, use these files as the Space repository root and select the Docker SDK.

Security model

  • gateway.py is the only public listener. Every application page, static asset, API, and write action is behind sign-in.
  • The backend admin server listens only on 127.0.0.1:8765 inside the container. The gateway forwards requests to it only after authentication.
  • Passwords are stored as salted scrypt hashes in /data/the_machine/auth.sqlite3. Session identifiers are random, stored hashed, expire after 12 hours, and use HttpOnly, SameSite=Strict, and Secure cookies.
  • The first superuser must change the generated bootstrap password before using the app. No public account registration is provided. Superusers can create and deactivate normal, view-only users from the Users button.
  • Login forms use CSRF tokens, same-origin checks, and per-account/IP throttling. Set the exact Space hostname in HF_ALLOWED_HOSTS; unknown hosts are rejected.

Keep the Space Private while configuring and reviewing access. Do not publish API credentials in this folder, the Docker image, or Git.

Hugging Face configuration

Attach persistent storage at /data. The app's SQLite files, downloaded reports, market history, and admin logs are written under /data/the_machine.

Set these Space variables/secrets in Settings → Variables and secrets:

Name Type Value
HF_ALLOWED_HOSTS Variable Exact Space hostname only, such as account-space-name.hf.space; no scheme or path
HF_ADMIN_USERNAME Variable admin
HF_ADMIN_PASSWORD Secret The bootstrap password supplied separately; required only on first startup with an empty /data volume
BREEZE_API_KEY Secret ICICI Breeze API key
BREEZE_API_SECRET Secret ICICI Breeze API secret
BREEZE_SESSION_TOKEN Secret Current daily API_Session

PORT is set to 7860 by the image. HF_COOKIE_SECURE defaults to 1; leave it enabled on Hugging Face.

On first launch, sign in as admin, change the bootstrap password, then remove HF_ADMIN_PASSWORD from Space secrets and restart. The account database on persistent storage preserves the changed password. To create later users, use Users from the signed-in app; each new account must change its temporary password at first sign-in and has read-only access.

The current Breeze session-renewal and saved-token flow uses Windows DPAPI and a local browser, neither of which exists in this Linux image. Set or update BREEZE_SESSION_TOKEN in Space secrets and restart the Space after the daily ICICI sign-in. Do not use the app's local browser-capture flow in this deployment bundle.

Build and deploy

Build locally from this folder with docker build -t the-machine-hf ., or push this folder's contents to the Docker Space repository root. Keep the persistent /data volume attached across rebuilds and restarts. gateway.py starts the private backend and the authenticated port-7860 listener.

Vercel is not the target for this bundle: THE MACHINE uses a long-running Python service, background workers, and SQLite-backed persistent history. Hugging Face Docker Spaces provide a closer fit, but review access, credentials, daily session refresh, and persistence before using it with live market data.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support