This NestJS application automatically fetches random photos from an Immich server and sends them to Telegram. The application includes image compression, batch sending, and HTTP API for testing and manual triggers.
- NestJS Application: Built with NestJS framework
- Immich Integration: Fetches photos from Immich API
- Telegram Integration: Sends photos to Telegram via Telegraf bot API
- Image Compression: Compresses images to specified dimensions
- HTTP API: Provides endpoints for testing and manual triggers
src/
├── app.module.ts # Main application module
├── main.ts # Application entry point
├── config/ # Configuration management
│ ├── config.module.ts
│ ├── config.constants.ts
│ └── index.ts
├── image-compression/ # Image compression service
│ ├── image-compression.service.ts
│ ├── image-compression.module.ts
│ └── index.ts
├── immich/ # Immich integration
│ ├── immich.service.ts
│ ├── immich.module.ts
│ └── index.ts
├── telegram/ # Telegram integration
│ ├── telegram.service.ts
│ ├── telegram.controller.ts # HTTP API for testing
│ ├── telegram.module.ts
│ └── index.ts
└── mcp/ # MCP server implementation
└── mcp.module.ts
- Use TypeScript with strict mode
- Follow NestJS conventions
- Use ESLint and Prettier for code formatting
- Write comprehensive tests
IMMICH_API_URL: Immich server API endpointIMMICH_API_KEY: API key for Immich authenticationTELEGRAM_BOT_TOKEN: Telegram bot token for TelegrafTELEGRAM_CHAT_ID: Target chat ID for photo delivery
- RESTful endpoints for MCP tools
- Proper error handling and validation
- Rate limiting for external API calls
- Logging for debugging and monitoring
- Set up basic NestJS application structure
- Implement configuration management
- Add basic HTTP endpoints
- Implement Immich API client
- Add photo fetching functionality
- Handle authentication and rate limiting
- Implement TelegramService with Telegraf
- Add sendPhotos method for batch photo sending
- Support up to 10 photos per message with captions
- Handle single photo and media group sending
- Implement ImageCompressionService with compress method
- Add Sharp dependency for image processing
- Support default compression to 1920px on larger side
- Overwrite original file with compressed version
- Create HTTP endpoints for photo operations
- Add testing endpoints for Telegram integration
- Implement error handling and validation
- Docker containerization
- Environment-based configuration
- Logging and error tracking
- Automatic cleanup of temporary files
- Integration tests for image compression service with real images
- Unit tests for all services
- Integration tests for API endpoints
- E2E tests for HTTP API functionality
- Performance tests for photo processing
- Docker containerization
- Environment-based configuration
- Health checks and monitoring
- Logging and error tracking