A comprehensive, modern web application that scrapes, stores, and serves detailed tomato variety information from the Rutgers NJAES database. Built with Python (Flask) backend and Express.js frontend, featuring a beautiful UI with dark mode, loading animations, and one-click data scraping.
- Beautiful Design: Custom OperatorMono font with glassmorphism effects
- Dark Mode: Smooth toggle between light and dark themes with persistent preferences
- Loading Animations: Growing plant animations (π±βπΏβπβπ ) throughout the app
- Responsive Design: Works perfectly on desktop, tablet, and mobile devices
- Smooth Transitions: CSS animations with GPU acceleration for buttery performance
- Multithreaded Scraper: 4-8x faster scraping with configurable thread count
- Progress Bars: Beautiful tqdm progress indicators with real-time stats
- Rich Data Extraction: Comprehensive variety information including:
- Tomato Type (Heirloom, Garden, Cherry, etc.)
- Breed (Open Pollinated, Hybrid)
- Origin (Country/Region)
- Season (Early, Mid, Late)
- Plant Details (Height, Type, Leaf Type)
- Fruit Characteristics (Size, Shape, Colors)
- Growing Information (Days to maturity, Disease resistance)
- One-Click Scraping: Start scraper directly from the web interface
- REST API: Python Flask backend with comprehensive endpoints
- Smart Caching: Efficient data loading and caching mechanisms
- Background Processing: Non-blocking scraper execution
- Status Monitoring: Real-time scraper status checking
- Error Handling: Graceful error recovery and user feedback
- Express.js Server: Fast, reliable web server
- Search Functionality: Advanced search across all variety data
- Dynamic Routing: Individual pages for each tomato variety
- Statistics Dashboard: Comprehensive database analytics
- Real-time Updates: Refresh data without restarting
- Python 3.7+
- Node.js 14+
- npm, yarn, or bun (recommended)
- pip (Python package installer)
# Clone and start everything automatically
git clone https://github.com/LinuxCTRL/tomato-varieties
cd tomato-varieties
chmod +x start.sh
./start.sh
That's it! The script will:
- β Install all Python and Node.js dependencies
- β Run the scraper to fetch initial data (if needed)
- β Start both backend and frontend servers
- β Display helpful information and URLs
- Set up Python virtual environment:
Linux/macOS:
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Windows (Command Prompt):
cd backend
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
Windows (PowerShell):
cd backend
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
- Install frontend dependencies:
cd ../frontend
npm install # or bun install (recommended)
- Start the backend API:
Linux/macOS:
cd ../backend
source .venv/bin/activate
python api.py
Windows:
cd ..\backend
.venv\Scripts\activate
python api.py
- Start the frontend server (in another terminal):
cd frontend
npm start # or bun start
- Access the application:
- π Frontend: http://localhost:3000
- π§ API: http://localhost:5000
- Click "Scrape Fresh Data" button to fetch tomato varieties
- Toggle dark mode π with the switch in the top-right corner
- Search varieties using the search bar or dedicated search page
- Explore variety details by clicking on any tomato card
- Watch the beautiful growing plant animations π±βπΏβπβπ
tomato-varieties-database/
βββ π start.sh # Main startup script
βββ π backend/ # Python backend
β βββ π api.py # Flask REST API server
β βββ π
scraper.py # Multithreaded web scraper
β βββ π tomato_varieties.json # Scraped data (generated)
β βββ π requirements.txt # Python dependencies
β βββ π§ start.sh # Backend-only startup script
βββ π frontend/ # Node.js frontend
β βββ π server.js # Express.js web server
β βββ π package.json # Node.js dependencies
β βββ π views/ # EJS templates
β β βββ layout.ejs # Base layout with dark mode
β β βββ index.ejs # Home page with scrape button
β β βββ variety-detail.ejs # Individual variety page
β β βββ search.ejs # Advanced search page
β β βββ stats.ejs # Statistics dashboard
β β βββ loading-demo.ejs # Animation showcase
β β βββ error.ejs # Error page
β βββ π public/ # Static assets
β βββ π css/
β β βββ style.css # Modern UI with glassmorphism
β βββ π js/
β β βββ app.js # Frontend logic & animations
β βββ π fonts/
β βββ OperatorMonoLig-Book.otf # Premium font
βββ π README.md # This file
GET /
- API documentationGET /varieties
- List all varietiesGET /varieties/<name>
- Get specific variety detailsGET /search?q=<query>
- Search varietiesGET /stats
- Database statisticsGET /refresh
- Refresh data from JSON file
GET /
- Home page with all varietiesGET /search?q=<query>
- Search pageGET /tomato/<name>
- Individual variety detailsGET /stats
- Statistics dashboardGET /api/*
- Proxy to backend API
# Scrape fresh data from Rutgers website
python scraper.py
# Get all varieties
curl http://localhost:5000/varieties
# Search for specific variety
curl http://localhost:5000/search?q=Cherokee
# Get variety details
curl http://localhost:5000/varieties/cherokee-purple
- Browse All Varieties: Visit the home page to see all tomato varieties
- Search: Use the search bar to find specific varieties
- Variety Details: Click on any variety name to see detailed information
- Statistics: View database statistics and data quality metrics
The system is designed to stay current with the source website:
- Manual Update: Run
python scraper.py
to fetch fresh data - API Refresh: Use the
/refresh
endpoint to reload data without restarting - Frontend Refresh: Use the "Refresh Data" button in the web interface
- Backend: Modify
api.py
to add new endpoints - Frontend: Add new routes in
server.js
and create corresponding EJS templates - Scraper: Update
scraper.py
to extract additional data fields
- Styling: Modify
public/css/style.css
- Frontend Logic: Update
public/js/app.js
- Templates: Edit EJS files in
views/
Each tomato variety contains:
{
"name": "Variety Name",
"slug": "variety-name",
"url": "https://source-url",
"description": "Variety description",
"characteristics": {
"key": "value"
},
"growing_info": {
"days_to_maturity": "80",
"plant_type": "determinate"
},
"images": [
{
"url": "image-url",
"alt": "description"
}
]
}
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
- Data source: Rutgers NJAES Tomato Varieties
- Built with Flask, Express.js, Bootstrap, and Font Awesome
- The project uses Python virtual environment (
venv
) for dependency isolation - Virtual environment is automatically created and activated by
start.sh
- For manual development, always activate the venv:
source backend/venv/bin/activate
# Backend (Python)
cd backend
source venv/bin/activate
pip install -qqq new-package
pip freeze > requirements.txt
# Frontend (Node.js)
cd frontend
npm install new-package # or bun add new-package
- Use
start.bat
instead ofstart.sh
for one-command setup - Virtual environment activation:
venv\Scripts\activate
- Path separators: Use backslashes
\
instead of forward slashes/
Task | Linux/macOS | Windows |
---|---|---|
Start everything | ./start.sh |
start.bat |
Activate venv | source venv/bin/activate |
venv\Scripts\activate |
Navigate to backend | cd backend |
cd backend |
Navigate up one level | cd .. |
cd .. |
If using PowerShell, you may need to enable script execution:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser