Files
ems-core/CLAUDE.md
Du Wenbo 139ca4c128 feat!: backend-only architecture, remove frontend/nginx (v1.2.0)
- Remove frontend/ and nginx/ from core (each customer owns their frontend)
- Update docker-compose.yml to backend-only (postgres + redis + backend)
- Update docker-compose.prod.yml to backend-only
- Add CLAUDE.md with dev guidelines
- Update README.md with new architecture diagram

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 23:39:31 +08:00

1.3 KiB

EMS Core Development Guidelines

Overview

This is the shared core library for all EMS customer projects. Changes here affect ALL customer deployments.

Golden Rules

  • All changes must go through Pull Request with code review
  • Follow Conventional Commits: <type>(<scope>): <description>
  • Types: feat, fix, refactor, docs, test, chore, style, perf
  • Scopes: api, models, services, collector, hooks, tasks, config

Architecture

  • backend/app/api/v1/ — API endpoint modules
  • backend/app/collectors/ — Device data collectors (Sungrow, Modbus, MQTT, HTTP)
  • backend/app/hooks/ — Customer plugin system (base + loader)
  • backend/app/models/ — SQLAlchemy ORM models
  • backend/app/services/ — Business logic layer
  • backend/app/tasks/ — Background tasks (Celery + APScheduler)
  • backend/alembic/ — Database migrations
  • Note: Frontend is NOT included in ems-core. Each customer repo owns its own frontend.

Database Migrations

  • Every model change requires an Alembic migration
  • Test migrations before deploying: alembic upgrade head
  • Never manually edit alembic_version table

Testing

  • Run tests: cd backend && pytest
  • Minimum test coverage for new features

Version

  • Follow SemVer (MAJOR.MINOR.PATCH)
  • Current: see VERSION file