myShop AI
Sales Management Powered by Google AI (Gemma 4)
1. Problem Statement
Small and medium business owners in emerging markets (like Bangladesh) often rely on scattered spreadsheets, paper ledgers, or disjointed messaging apps to manage their daily sales. This manual and chaotic process makes it incredibly difficult to track overall profitability, identify at-risk customers, or gain actionable business insights without hiring expensive technical experts or data analysts.
2. Importance of the Problem
Small and Medium Enterprises (SMEs) are the backbone of the global economy, yet they are historically underserved by modern enterprise software. Without proper analytics, these businesses lose money due to hidden inefficiencies. They fail to identify which products are actually driving profit, when loyal customers abruptly stop buying, or if their daily profit margins are silently shrinking. Solving this problem democratizes data intelligence, empowering millions of small business owners to make data-driven decisions and grow sustainably.
3. Proposed Solution
myShop AI bridges this gap by transforming a standard, intimidating spreadsheet workflow into an enterprise-level AI analytics platform. It provides an intuitive, easy-to-use dashboard that automates reporting and gives actionable advice.
Instead of staring at rows of numbers, business owners receive clear, AI-generated insights. The platform features a full-stack dashboard for CRUD operations on sales orders, role-based access control for staff, on-demand bilingual AI business insights, a dynamic AI pricing optimizer to maximize margins, an AI restock planner that turns sales velocity into a weekly purchase plan, automated daily performance emails, and many more features—all requiring zero technical knowledge from the end-user.
4. Gemma 4 Integration
At the heart of myShop AI is Gemma 4 (integrated via the google-genai SDK), acting as the sole intelligence engine for the platform. We utilize the Google AI Studio REST API to bring enterprise-level LLM capabilities directly into our backend. Gemma 4 is the only Large Language Model (LLM) used in this application.
- Automated Business Analyst: When generating a report, the backend summarizes structured sales data (such as Revenue, Total Orders, Average Order Value, and At-Risk Customers) and prompts Gemma 4 to analyze the business's health.
- Dynamic Pricing Optimizer: Gemma 4 reads live inventory and 30-day sales velocity to output structured JSON recommendations on whether to mark up prices (to capture margin on high-demand items) or discount prices (to clear dead stock).
- AI Restock Planner: Python first computes the hard numbers — per-product sales velocity, days of stock remaining, projected stockout dates, and suggested order quantities across a 14-day horizon. Gemma 4 then turns this into a practical bilingual purchase plan: what to buy this week and how many units, which products are about to stock out, and which to skip because they are overstocked or slow-moving.
- Multilingual Support: Gemma 4 evaluates the data and generates a professional, 5-point business report in Bengali (the local language) and English, making the insights highly accessible to local shop owners.
- Daily Automation: Gemma 4 powers the automated daily email reports, ensuring owners wake up to actionable insights in their inbox every morning.
5. System Architecture
myShop AI uses a decoupled client-server architecture designed for speed and scalability:
- Frontend (Client): A React.js Single Page Application (SPA) built with Vite, providing a fast, responsive user interface.
- Backend (Server): A FastAPI (Python) application that handles business logic, database transactions, and background task scheduling.
- AI Layer: Direct integration with Google AI Studio to communicate with Gemma 4 models.
- Database: SQLite (via SQLAlchemy ORM) for lightweight local development, easily upgradeable to PostgreSQL for production.
6. Technical Implementation
- UI & Visualization: The frontend utilizes
Rechartsfor interactive Revenue and Profit charts, and provides sleek AI dashboards for viewing pricing recommendations. - Security: The backend implements secure JWT (JSON Web Tokens) authentication, allowing distinct permissions for Owners, Admins, and Staff (e.g., Staff can add orders, but only Owners can view overarching analytics).
- AI Structured Outputs: We utilize strict Pydantic schemas within the
google-genaiSDK to force Gemma 4 to output its pricing recommendations in a tightly constrained, machine-readable JSON format for the frontend to digest. - Background Automation: We implemented
APSchedulerin the FastAPI backend to run hourly background jobs. It checks user settings, triggers Gemma 4 to generate a custom report for that specific hour, and dispatches it via SMTP email. - Google Sheets Sync: The system supports data hydration directly from standard
.xlsxexports or Google Sheets, minimizing friction for onboarding users. - Robust Reliability & Fallbacks: The system is designed for high availability. If the LLM API experiences network timeouts or rate limits, the backend seamlessly degrades to deterministic Python algorithms (e.g., falling back to hard-coded mathematical rules for the Restock Planner), ensuring the business owner always receives actionable data.
7. Challenges Encountered
- Prompt Engineering for Local Languages: Ensuring Gemma 4 generated high-quality, professional, and natural-sounding business advice in Bengali required careful prompt tuning. Direct, naive translations often sounded robotic. We iteratively refined the prompt structure to enforce a professional yet encouraging tone.
- Preventing AI Hallucinations: Initially, feeding raw tabular data into the LLM resulted in the AI occasionally hallucinating mathematical totals. We overcame this by shifting the deterministic math (calculating exact Revenue, AOV, and Profit) to Python. We strictly handled complex edge cases—like accurately subtracting cancelled and returned orders from Net Revenue—in the Python layer. We then passed these pre-calculated KPIs to Gemma 4 purely for qualitative analysis and strategic advice, resulting in 100% factual accuracy.
- Asynchronous AI UI Rendering: Integrating long-running LLM generation tasks (10-15 seconds) into a responsive React frontend initially caused race conditions and component unmounting crashes. We solved this by implementing strict loading states, robust error boundaries, and gracefully formatted UI updates so the user is never left staring at a broken screen or a silent loader.
8. Expected Impact
By making AI-driven analytics accessible, affordable, and natively integrated into familiar workflows, myShop AI can help thousands of small shop owners optimize their inventory, retain loyal customers, and increase their daily profit margins. It acts as a "Data Analyst in a Box", saving owners hours of manual accounting every week.
9. Future Improvements
- Voice-First Order Entry: Allow shop owners to speak a sale in Bengali and have Gemma 4 extract a structured order, removing typing as a barrier for busy or non-technical users at the counter.
- Two-Way Google Sheets Sync: Implement real-time, bidirectional synchronization between the web app and Google Sheets using Apps Script webhooks.
- Mobile Application: Build a dedicated Flutter mobile app for store staff to input sales and scan barcodes directly from their phones.
Log in or sign up for Devpost to join the conversation.