Technical documentation

re-publisher

Where things are in the code, how to run it and what was checked.
Version be01bfe3995f · prepared on 7 September 2026

About the project

Content goes through extraction, classification and draft preparation. The source and intermediate results are stored separately, so a failed step can be inspected and rerun.

FastAPI, PostgreSQL, a Telegram collector and a publication processing pipeline. The server runs the original app without a demo wrapper. Collection needs Telegram and model configuration. Those are not connected yet, so there is no collected content.

  • Telegram API ID/hash and an authorized MTProto session have not yet been provided. Collection of real messages has not started.
  • The active tfidf_logreg.joblib model and selected LLM settings are missing. There is no basis for claiming verified classification or rewriting quality.
  • The interface currently shows an empty production-schema database. The previous demo's synthetic corpus has not been mixed into the original tables.
  • External publishing has not been tested: it requires a destination channel and BOT_TOKEN or MAX settings. AUTO_PUBLISH remains false until the destination is configured.

Screenshots, diagrams and source evidence retain their original language; captions and descriptions are translated.

Architecture and diagrams

  • The original application's app.web.main:app is running, rather than app.portfolio.
  • PostgreSQL with the original migrations; separate persistent sessions, media, models, cache, artifacts and reports directories.
  • The collector and full-cycle pipeline are separate services in the connected profile. They are activated after configuring the Telegram session, model and selected integrations.
  • The administrative interface is protected by HTTPS Basic Auth; secrets are kept outside the repository.
Components and integration boundaries
Components and integration boundaries · Mermaid ↓
Production pipeline after configuration
Production pipeline after configuration · Mermaid ↓
Deployment
Deployment · Mermaid ↓

Code map: files and dependencies

This map is tied to version be01bfe3995f. The table lists the screen or API, related module and data.

FeatureScreen / APIModuleData / verification
CollectionTelegram MTProtoapp/main.py; app/collector.pyTG session → telegram_posts; connection awaiting configuration
Application interface/processed, /drafts, /pipelineapp/web/main.py; app/web/templates11 main GET sections checked
ClassificationPipeline / modelsapp/content/model_registry.py; pipeline_manager.pymodel_versions; active joblib is not yet available
Editorial processingRewriting / promptsapp/content/pipeline_rewriter.py; prompt_versions.pyPublicationDraft / RewriteAttempt; external models unverified
Operations/health; Docker ComposeDockerfile.runtime; app/config.py; alembicPostgreSQL, migrations, password access

Using the code map

  1. Before making a change, find the feature and trace its links to the API, state and storage.
  2. Check inputs, errors, repeated events and dependent workflows.
  3. After making a change, update the map and affected diagrams alongside the code.
  4. Run the related checks and link the new evidence to the source version.

Workflows and API

  1. Sign in to the owner's interface and open Materials, Drafts, Labeling, Models and Pipeline.
  2. Open Rewrite Progress, Prompts and Search: these are the original pages backed by PostgreSQL.
  3. After configuring Telegram: app.main login/login-qr → inspect-folder → limited sync → inspect materials.
  4. After registering a model and configuring the LLM: processing → classification → draft → review → approved publication to the selected channel.

Verification of the published version

CI: Full build of the original application ↗ · be01bfe3 · this demo's version · 2026-09-07

  • The original Docker image was built in GitHub CI. PostgreSQL migrations were applied.
  • All 11 main navigation pages return HTTP 200 after sign-in, with no JavaScript errors.
  • Unauthenticated requests return 401. /health confirms web and database availability.
  • Telegram collection, model execution and publishing are unverified because configuration is missing; these stages are not described as complete.

These checks apply to the listed version. Business metrics and model quality on an independent dataset were not measured.

Measurements

Container memory: three snapshots without external processing
Container memory: three snapshots without external processing · Source data ↓
  • Five sequential HTTPS GET requests from the VPS to itself: 81.5–228.6 ms, all HTTP 200. This is not a load test or an assessment of the external network.
  • No Telegram collection, LLM processing or Codex task ran during the measurements.

Running and operating

The Dockerfile.runtime image is built outside the VPS. Web starts with uvicorn app.web.main:app --host 0.0.0.0 --port 8080.

Runtime settings: /srv/portfolio/publisher/.env; additional integrations: /srv/portfolio/publisher/integrations.env. Secret values are not published.

After configuring the collector, create a session with app.main login-qr or login. Do not import old WTG data: WTG has been deleted and is not a recovery source.

Register the model with the standard app.content.model_registry register-initial-model command using the owner's supplied package. Initial sync is limited to 20 messages per chat.

Do not enable AUTO_PUBLISH without a configured destination channel. Keep administrative screens private when working with real data.

Stack

FastAPI / JinjaOriginal editorial interface
PostgreSQL / SQLAlchemy / AlembicProduction data schema and migrations
TelethonMTProto collector; awaiting a session
scikit-learn / LLMClassification and rewriting after model configuration

Materials and source code

Code history: since 16 June 2026. Demo preparation: 7 September 2026.

The evidence archive retains its original language.