From 37cca43282126e36be06caeb320d1da7e5c36681 Mon Sep 17 00:00:00 2001 From: Ruberoid Date: Mon, 21 Jul 2025 11:13:45 +0300 Subject: [PATCH] added claude generated readme. --- CLAUDE.md | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..7db3a46 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,95 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +This is a microservices-based Telegram bot system for text monitoring and notifications. The system consists of 4 main services that communicate via RabbitMQ: + +- **telegram-listener**: Scans open Telegram channels and chats for messages +- **telegram-client**: Bot interface for user interactions +- **text-matcher**: Matches incoming messages against user subscriptions +- **users**: Manages users and their preferences + +## Architecture + +The services follow a message bus pattern using RabbitMQ for async communication: +- TelegramListener publishes MessageReceived events +- TextMatcher subscribes to MessageReceived, publishes TextMatchCreated/TextMatchMatched events +- TelegramClient subscribes to TextMatchMatched events and notifies users + +Each service follows Clean Architecture with separate projects for: +- Host (API/entry point) +- AppServices (business logic) +- Core (shared utilities) +- Api.Contracts (REST API contracts) +- Async.Api.Contracts (event contracts) +- Persistence (database layer, where applicable) +- Migrator (database migrations, where applicable) + +## Development Commands + +### Running the System +```bash +# Start all services with Docker Compose +docker-compose up + +# Start individual services for development +cd telegram-client && dotnet run --project src/Nocr.TelegramClient.Host +cd telegram-listener && dotnet run --project src/Nocr.TelegramListener.Host +cd text-matcher && dotnet run --project src/Nocr.TextMatcher.Host +cd users && dotnet run --project src/Nocr.Users.Host +``` + +### Building +```bash +# Build individual services +cd && dotnet build + +# Build specific projects +dotnet build src/Nocr..Host +``` + +### Testing +```bash +# Run unit tests (only text-matcher has tests currently) +cd text-matcher && dotnet test +``` + +### Database Migrations + +For text-matcher and users services: +```bash +# Add new migration (from service root directory) +cd text-matcher && ./src/Nocr.TextMatcher.Migrator/AddMigration.sh MyMigrationName +cd users && ./src/Nocr.Users.Migrator/AddMigration.sh MyMigrationName + +# Apply migrations (handled automatically by migrator containers in docker-compose) +``` + +## Configuration + +Services use layered appsettings configuration: +- `appsettings.json` - base settings +- `appsettings.Development.json` - local development +- `appsettings.DockerCompose.json` - Docker Compose environment +- `appsettings.protected.json` - sensitive settings (not in repo) + +## Service Ports + +When running with docker-compose: +- telegram-client: 4999 +- telegram-listener: 5000 +- text-matcher: 5001 +- users: 4998 +- RabbitMQ: 5672 (AMQP), 15672 (Management UI) +- MariaDB: 3306 (text-matcher), 3307 (users) + +## Key Technologies + +- .NET 8 +- ASP.NET Core Web APIs +- Entity Framework Core with MariaDB +- WTelegramClient for Telegram API +- Rebus for message bus (RabbitMQ) +- Docker & Docker Compose for containerization \ No newline at end of file