# Lawn Mowing Schedule Manager A comprehensive full-stack application for managing lawn mowing schedules with zone tracking, history logging, and Telegram notifications. ## Features ### 🌱 Zone Management - Create and manage lawn zones with images - Set mowing intervals or specific dates - Track zone areas and status - Visual site plan with interactive markers ### 📊 Activity Tracking - Record mowing and trimming sessions - Bulk operations for multiple zones - Detailed history with notes and weather - Time tracking and statistics ### 📱 Telegram Notifications - Daily reminders for due/overdue zones - Weekly status reports every Sunday - Automatic scheduling with cron jobs - Manual test triggers ### 📈 Analytics - Zone status dashboard - Mowing progress tracking - Weekly and monthly statistics - Equipment usage tracking ## Setup ### Prerequisites - Node.js 18+ - npm or yarn ### Installation 1. Clone the repository ```bash git clone cd lawn-mowing-scheduler ``` 2. Install dependencies ```bash npm install ``` 3. Configure environment variables ```bash cp .env.example .env ``` Edit `.env` with your settings: ```env # Telegram Bot Configuration (optional) TELEGRAM_BOT_TOKEN=your_bot_token_here TELEGRAM_CHAT_ID=your_chat_id_here # Database DATABASE_URL=file:lawn_scheduler.db # Server PORT=3001 NODE_ENV=development ``` ### Telegram Setup (Optional) 1. Create a bot with @BotFather on Telegram: - Send `/newbot` to @BotFather - Follow the instructions to create your bot - Copy the bot token 2. Get your chat ID: - Start a chat with your bot - Send any message - Visit `https://api.telegram.org/bot/getUpdates` - Find your chat ID in the response 3. Add the credentials to your `.env` file 4. Test the connection using the Telegram settings in the app ### Development Start the development server: ```bash npm run dev ``` This will start: - Frontend (Vite): http://localhost:5173 - Backend (Express): http://localhost:3001 ### Production Build and start the production server: ```bash npm run build npm start ``` ## Docker Deployment ### Development ```bash docker-compose -f docker-compose.dev.yml up --build ``` ### Production ```bash docker-compose up --build ``` ## API Endpoints ### Zones - `GET /api/zones` - Get all zones - `POST /api/zones` - Create zone - `PUT /api/zones/:id` - Update zone - `DELETE /api/zones/:id` - Delete zone - `POST /api/zones/:id/mow` - Mark zone as mowed - `POST /api/zones/:id/trim` - Record trimming - `POST /api/zones/bulk-mow` - Bulk mowing session ### History - `GET /api/history` - Get mowing history - `GET /api/history/stats` - Get statistics ### Equipment - `GET /api/mowers` - Get mowers - `POST /api/mowers` - Create mower ### Telegram - `POST /api/telegram/test` - Test connection - `POST /api/telegram/check-reminders` - Manual reminder - `POST /api/telegram/weekly-report` - Manual report ## Notification Schedule - **Daily Reminders**: 8:00 AM - Zones that are due or overdue - **Weekly Reports**: Sunday 9:00 AM - Complete status summary ## Database Schema The application uses SQLite with the following main tables: - `zones` - Lawn zones with scheduling info - `mowing_history` - Activity log with sessions - `mowers` - Equipment tracking ## Technologies Used ### Frontend - React 18 with TypeScript - Tailwind CSS for styling - Vite for development and building ### Backend - Node.js with Express - SQLite with libsql client - Multer for file uploads - node-cron for scheduling - node-telegram-bot-api for notifications ### Infrastructure - Docker for containerization - Nginx for reverse proxy - File-based SQLite database ## Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Add tests if applicable 5. Submit a pull request ## License MIT License - see LICENSE file for details