BAAS Docs
Reference

Backend Development Guidelines

BAAS backend development environment, logging rules, configuration maintenance, and documentation boundaries.

This page consolidates the legacy develop_doc/env.md, develop_doc/log.md, and development overview for backend contributors and Tauri/backend integration maintainers.

Development Environment

Recommended editors:

  • PyCharm
  • VS Code

Use the Python version required by the current backend repository. The legacy docs used Python 3.9.21:

conda create -n baas_env python=3.9.21
conda activate baas_env
pip install -r requirements.txt

On Linux/macOS, use the backend project's current file, such as requirements-linux.txt. If the project has moved to uv or pdm, follow the current lockfile and README.

Configuring the BAAS conda environment in PyCharm

Backend Control Loop

The legacy development docs summarize BAAS task execution as:

Rendering diagram...

The Tauri client does not execute this loop directly. It owns configuration, scheduling UI, logs, and status display; the backend owns screenshots, recognition, control, and task logic.

Logging Rules

The legacy backend Logger lives in core/utils.py. Logs are sent to the UI or terminal. Static log strings should be written in English to help cross-language users and developers debug issues.

LevelUse Case
infoNormal runtime status
warningAbnormal state that can be recovered automatically
errorCurrent task cannot recover; restart task or stop BAAS
criticalInvalid parameters, startup failure, or task cannot run
lineSeparate task contexts
self.logger.info("Info Message")
self.logger.warning("Warning Message")
self.logger.error("Error Message")
self.logger.critical("Critical Message")
self.logger.line()

Configuration Maintenance

Backend config commonly covers:

  • Emulator connection: ADB IP, ADB port, multi-instance number.
  • Screenshot and control methods: nemu, adb, uiautomator2, scrcpy, mss, pyautogui, and others.
  • Feature parameters: cafe, lessons, crafting, stages, sweeps, shops, arena.
  • Scheduler parameters: enabled state, interval, daily reset, disabled windows, pre-tasks, post-tasks.
  • Resource state: AP, credits, pyroxene, tickets, shop coins.
  • Push settings: ServerChan, Feishu, custom JSON webhook.

When adding a config key, update:

AreaRequired Work
Backend defaultsDefault value and migration logic
Tauri UIForm control, validation, copy
SchedulerWhether it affects enablement or timing
DocsChinese and English descriptions
LogsDebuggable English log messages

Documentation Boundary

Backend development details belong in reference; normal user workflows belong in guide and features. Avoid putting source-level member lists into user pages; user pages should explain runtime impact and validation.

On this page