How abdulbositabdurahimovdeveloper/kundalik works
Project Type & Purpose
• KUNDALIK is a modular monolithic, full-stack Java Spring Boot application that exposes a REST API (“site” module) and a Telegram Bot interface (“telegram” module).
• Purpose: A multi-platform personal assistant offering weather, prayer-time, currency info to anonymous users; note/reminder/finance management for authenticated users; and a Telegram bot front-end.
File Structure
• Top-level build & infra: Dockerfile, Jenkinsfile, Maven wrapper & pom.xml.
• Single Spring Boot application in src/main/java/uz/kundalik, split into two logical sub-packages:
• site – the REST API (controllers, services, repositories, config, models, mappers, payloads).
• telegram – the bot logic (webhook controllers, bot controllers, services, repositories, mappers, payloads).
• Configuration & cross-cutting concerns under site/config (security, caching, async, logging, OpenAPI).
• Resources: Liquibase changelogs (db/changelog), static front-end assets (admin-panel, guide, i18n, mini-app), email and page templates.
• Tests under src/test.
Key Insights from README
• Tech stack: Java17, Spring Boot 3, Spring Data JPA (PostgreSQL), Liquibase, Spring Security + JWT, Redis cache, MinIO storage, TelegramBots library, OpenAPI, Lombok & MapStruct, cron-utils.
• Modular design: site (REST API), telegram (bot).
• External dependencies: currency, weather, prayer-time APIs; Redis; MinIO; PostgreSQL.
Main Components & Their Interactions
A. Clients / Entry Points
1. Web clients (static admin-panel & mini-app in src/main/resources/static)
2. API consumers (Swagger UI / any HTTP client)
3. Telegram platform (user’s Telegram app → Bot via Webhook)
B. API / Gateway Layer
• Spring MVC Dispatcher (controllers in site/controller & telegram/controller)
• JWT Authentication Filter (JwtAuthenticationFilter) & SecurityConfig
• OpenAPI endpoint
C. Business Logic Layer
• Site services (site/service implementations & interfaces)
• Telegram services (message generation, panel handling, keyboard builders, API clients)
D. Data Access Layer
• Spring Data JPA Repositories
• Liquibase migrations applied on startup
• Soft-deletion entities
E. Infrastructure & Supporting Services
• PostgreSQL Database
• Redis Cache (Spring Cache)
• MinIO Object Storage
• External REST API clients: WeatherApiClient, CurrencyApiClient, PrayerTimeApiClient
• MailService (SMTP) & SmsService (Telegram or other SMS gateway)
• Asynchronous executor thread pool (AsyncConfig) & cron-utils scheduler
Relationships & Data Flows
• HTTP/webhook → API Gateway → Controllers → Services → Repositories → Database / Cache / MinIO
• Services may call external REST APIs or send email/SMS → back to users
• Telegram updates flow from Telegram Platform (via webhook) into TelegramWebhookController, pass through UpdateDispatcherService → appropriate bot-panel services → send messages via SendMsg to Telegram Platform
• Admin-panel web UI communicates with REST endpoints (secured via JWT)
Architectural Patterns & Design Principles
• Modular monolith (two main logical modules, but one deployable JAR)
• Layered architecture: Controller → Service → Repository → Model
• Event publishing (e.g., UserRegisteredEvent) for decoupling
• Soft deletion & auditing via base entities (AbsAuditingSoftDeleteEntity)
• Externalization of config (application.yaml, ApplicationProperties classes, spring-dotenv)
• Mapping layer (MapStruct) to translate Entities ↔ DTOs
• Validation via custom annotations & global exception handler
Essential Elements to Capture
• Modules: Site vs. Telegram
• Layers inside each: Controller → Service → Repository
• Cross-cutting: Security, Caching, Async
• External integrations: MinIO, Redis, PostgreSQL, Weather/Currency/Prayer APIs, Email/SMS, Telegram Platform
• Startup flows: Liquibase migrations