Skip to content

Code-X-tech/v0-linganisha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Linganisha - Smart Shopping Assistant

A modern, AI-powered shopping assistant that helps you find the best prices for products in your local area. Linganisha combines intelligent product search, real-time price comparison, and an interactive AI chat to make your shopping experience smarter and more efficient.

Features

πŸ” Smart Product Search

  • Search for products across multiple stores in your location
  • Real-time price comparison from local retailers
  • Automatic currency conversion to your local currency
  • Detailed product information including units and measurements

πŸ›’ Shopping List Management

  • Create and manage shopping lists with ease
  • Track quantities and units for each item
  • Auto-search for prices and alternatives
  • View detailed product information and pricing
  • Track shopping progress with completion stats

πŸ’¬ AI Shopping Assistant (Linga)

  • Chat with Linga, your personal shopping assistant
  • Get product recommendations and price insights
  • Add items to your shopping list directly from chat
  • Ask questions about your shopping list and prices
  • Personalized experience with name recognition and location awareness

πŸ“Š Admin Dashboard

  • Track user activity and engagement
  • View user statistics by location and device
  • Monitor search trends and popular products
  • Secure authentication with password management
  • Cross-device access from anywhere

🌍 Location-Based Features

  • Automatic location detection
  • Local store identification and caching
  • Currency conversion based on location
  • Geofenced search results

Tech Stack

  • Frontend: Next.js 16, React 19, TypeScript
  • Styling: Tailwind CSS v4, shadcn/ui components
  • Backend: Next.js API Routes, Server Actions
  • Database: Supabase (PostgreSQL)
  • AI: Vercel AI SDK with OpenAI/Anthropic models
  • Search: SerpAPI for product search
  • Authentication: Supabase Auth
  • Deployment: Vercel

Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn
  • Supabase account
  • SerpAPI key for product search
  • OpenAI or Anthropic API key for AI features

Installation

  1. Clone the repository ```bash git clone https://github.com/yourusername/linganisha.git cd linganisha ```

  2. Install dependencies ```bash npm install ```

  3. Set up environment variables ```bash cp .env.example .env.local ```

    Fill in your credentials in .env.local: ```env

    Supabase

    NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

    Search API

    SERP_API_KEY=your_serp_api_key

    AI Models

    OPENAI_API_KEY=your_openai_key

    or

    ANTHROPIC_API_KEY=your_anthropic_key ```

  4. Set up the database

    • Run the SQL scripts in your Supabase dashboard:
      • scripts/create-app-users-table.sql
      • scripts/create-search-count-function.sql
      • scripts/create-admin-user.sql
  5. Start the development server ```bash npm run dev ```

  6. Open your browser Navigate to http://localhost:3000

Project Structure

``` linganisha/ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ api/ β”‚ β”‚ β”œβ”€β”€ search/route.ts # Product search API β”‚ β”‚ └── chat/route.ts # AI chat API β”‚ β”œβ”€β”€ admin/ β”‚ β”‚ β”œβ”€β”€ login/page.tsx # Admin login β”‚ β”‚ └── dashboard/page.tsx # Admin dashboard β”‚ β”œβ”€β”€ page.tsx # Main app page β”‚ β”œβ”€β”€ layout.tsx # Root layout β”‚ └── globals.css # Global styles β”œβ”€β”€ components/ β”‚ β”œβ”€β”€ admin-dashboard.tsx # Admin dashboard component β”‚ β”œβ”€β”€ admin-login-form.tsx # Admin login form β”‚ └── ui/ # shadcn/ui components β”œβ”€β”€ lib/ β”‚ β”œβ”€β”€ supabase/ β”‚ β”‚ β”œβ”€β”€ client.ts # Supabase client β”‚ β”‚ └── server.ts # Supabase server β”‚ β”œβ”€β”€ user-tracking.ts # User activity tracking β”‚ └── admin-actions.ts # Admin actions β”œβ”€β”€ scripts/ β”‚ β”œβ”€β”€ create-app-users-table.sql β”‚ β”œβ”€β”€ create-search-count-function.sql β”‚ └── create-admin-user.sql └── public/ └── images/ # App assets ```

API Documentation

Search API (/api/search)

Request: ```json { "query": "milk 1 liter", "location": "Nairobi, Kenya", "deviceId": "device-123" } ```

Response: ```json { "results": [ { "title": "KCC Milk 1 Liter", "price": 150, "currency": "KES", "store": "Carrefour", "quantity": "1 liter", "url": "https://..." } ], "searchCount": 1 } ```

Chat API (/api/chat)

Request: ```json { "messages": [ { "role": "user", "content": "Add 2 liters of milk to my list" } ], "context": { "userName": "John", "location": "Nairobi, Kenya", "deviceId": "device-123", "shoppingList": [], "searchResults": [] } } ```

Response: ```json { "content": "I've added 2 liters of milk to your shopping list!", "actions": [ { "type": "ADD_ITEM", "item": "Milk", "quantity": 2, "unit": "liter" } ] } ```

Database Schema

app_users Table

```sql

  • id (UUID, Primary Key)
  • device_id (TEXT, Unique)
  • user_name (TEXT)
  • location (TEXT)
  • search_count (INTEGER)
  • last_active (TIMESTAMP)
  • created_at (TIMESTAMP)
  • updated_at (TIMESTAMP) ```

profiles Table

```sql

  • id (UUID, Primary Key)
  • email (TEXT)
  • full_name (TEXT)
  • created_at (TIMESTAMP)
  • updated_at (TIMESTAMP) ```

Admin Dashboard

Access the admin dashboard at /admin/login

Default Credentials:

  • Email: [email protected]
  • Password: linganisha2024 (change this immediately after first login)

Features:

  • View all users and their activity
  • Monitor search statistics
  • Track user engagement by location
  • Change admin password
  • Secure cross-device access

Security

  • All API keys are stored in environment variables
  • Sensitive data is never committed to git (see .gitignore)
  • Supabase Row Level Security (RLS) policies protect user data
  • Admin dashboard requires authentication
  • Password changes are securely handled through Supabase Auth

Environment Variables

See .env.example for all required environment variables. Never commit .env.local to git.

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, email [email protected] or open an issue on GitHub.

Acknowledgments


Automatically synced with v0.app deployments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors