An interactive Streamlit web application for exploring and analyzing book data. Browse thousands of books with dynamic filtering, visualize market trends, and discover insights through interactive charts and analytics.
Live Demo: Deploy on Streamlit Cloud
- Price Distribution Histogram - Analyze price ranges across the catalog
- Rating Breakdown Chart - See the distribution of book ratings
- Books Per Category Analysis - Identify popular categories
- Average Price by Category - Compare pricing across categories
- Price vs Rating Scatter Plot - Explore the relationship between price and customer ratings
- Stock Availability Donut Chart - Track inventory status
- Filter by category (multi-select)
- Set price range with slider control
- Filter by minimum rating (1-5 stars)
- Stock availability toggle
- Keyword search in titles and descriptions
- Sortable book table with customizable ordering
- Book detail cards with comprehensive information
- Real-time search and filter functionality
- Display of 5 summary metrics (books shown, avg price, avg rating, categories, in stock)
- Clean, modern design with professional styling
- Responsive layout that works on all devices
- Smooth animations and hover effects
- Light color scheme for comfortable viewing
| Component | Technology |
|---|---|
| Framework | Streamlit |
| Data Processing | Pandas |
| Visualization | Plotly |
| Language | Python 3.13+ |
- Python 3.10 or higher
- Git
- pip package manager
git clone https://github.com/DeepighaJ/streamlit-books-catalog.git
cd streamlit-books-catalog# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS/Linux
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtpython scrape_all_books.pyThis will create/update all_books.csv with book data from books.toscrape.com.
streamlit run src/app.pyThe app will open in your default browser at: http://localhost:8501
streamlit-books-catalog/
βββ src/
β βββ app.py # Main application entry point
β βββ config.py # Configuration & constants
β βββ styles.py # CSS styling
β βββ data/
β β βββ loader.py # Data loading & preprocessing
β βββ components/
β βββ __init__.py
β βββ sidebar.py # Filter sidebar component
β βββ metrics.py # Summary metrics component
β βββ charts.py # Chart visualization components
β βββ table.py # Book table component
β βββ detail.py # Book detail card component
βββ all_books.csv # Book dataset (~11,000 books)
βββ scrape_all_books.py # BeautifulSoup data scraper
βββ requirements.txt # Python dependencies
βββ .gitignore # Git ignore rules
βββ README.md # This file
- Push code to GitHub (already done β )
- Visit Streamlit Cloud
- Click "New app"
- Connect your GitHub account
- Select repository:
streamlit-books-catalog - Set main file:
src/app.py - Click Deploy
Your app will be live at: https://app-books-catalog-djdeploy.streamlit.app/
# Ensure all changes are pushed to GitHub
git add .
git commit -m "Deploy ready"
git push origin main- Python version: 3.10+
- Main file:
src/app.py - Requirements file:
requirements.txt
- Use the sidebar on the left to apply filters
- Select multiple categories or adjust price/rating ranges
- Use the search box to find books by title or description
- Toggle "In stock only" to see available books
- Hover over charts to see detailed information
- Click on chart elements to interact with them
- The table updates automatically based on filters
- Go to the "Book detail" section
- Type in the search box to filter books
- Select a book from the dropdown
- View comprehensive book information including:
- Title, category, and price
- Rating (in stars)
- Stock availability and quantity
- UPC code
- Direct link to book
- Full description
The application uses book data scraped from books.toscrape.com, a practice website for web scraping enthusiasts.
- Total Books: ~11,000+
- Categories: 50+ book categories
- Data Points: Title, price, rating, availability, stock, category, UPC, description, URL
- Update Frequency: Run
python scrape_all_books.pyto refresh
To update the book catalog with the latest data:
python scrape_all_books.pyThe project follows a modular, component-based architecture:
- Separation of Concerns: Each feature is isolated in its own module
- Reusability: Components can be easily reused or extended
- Maintainability: Easy to locate and modify specific features
- Scalability: Simple to add new components or visualizations
- Create a new file in
src/components/ - Import in
src/app.py - Call the render function in the main flow
Example:
# src/components/my_feature.py
def render_my_feature(filtered: pd.DataFrame):
st.markdown("### My Feature")
# Your code here- The app caches data loading with
@st.cache_datadecorator - Charts are optimized with Plotly for smooth interactions
- Filtering is performed in-memory for fast response times
Solution: Run python scrape_all_books.py to generate the dataset
Solution: Run on a different port:
streamlit run src/app.py --server.port 8502Solution: Streamlit cloud instances are lightweight. For better performance, consider Streamlit's Streamlit Community Cloud Pro
pandas>=2.0.3
plotly>=5.18.0
streamlit>=1.36.0
For latest versions, see requirements.txt
Contributions are welcome! Please feel free to:
- π Report bugs by opening an issue
- π‘ Suggest features or improvements
- π§ Submit pull requests for enhancements
- π Improve documentation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
You are free to:
- Use this project for personal or commercial purposes
- Modify and distribute the code
- Use it as a learning resource
This project demonstrates:
- Streamlit: Building interactive web apps with Python
- Pandas: Data manipulation and analysis
- Plotly: Creating interactive visualizations
- Web Scraping: Using BeautifulSoup for data collection
- Git/GitHub: Version control and collaboration
- Modular Design: Component-based architecture
If you encounter any issues:
- Check the Troubleshooting section
- Review the Streamlit Documentation
- Search existing GitHub Issues
- Create a new issue with detailed description
Potential future enhancements:
- User reviews and ratings
- Wishlist/favorites functionality
- Export filtered results to CSV/PDF
- Price tracking and alerts
- Book recommendations engine
- Multi-language support
- Dark mode theme toggle
- Streamlit for the amazing framework
- books.toscrape.com for the practice dataset
- Plotly for interactive visualizations
- All contributors and users of this project
Made with β€οΈ using Streamlit
β If you find this project helpful, please consider giving it a star on GitHub!
Author: Deepigha Japamony