Skip to content

๐Ÿ’Š Modern App for managing home medicine inventory with family sharing, expiry tracking, out-of-stock management, and shopping lists. Features mobile-first responsive design, 6-character family codes, and real-time synchronization. Built with Next.js, TypeScript & Firebase.

License

Notifications You must be signed in to change notification settings

41vi4p/MediStock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’Š MediStock - Medicine Inventory Management

Version 1.5.8 - A comprehensive web application for managing home medicine inventory with expiry tracking, family sharing, and intelligent notifications. Built with Next.js, TypeScript, and Firebase.

๐Ÿ”— View Changelog

โœจ Features

๐Ÿ  Family Medicine Management

  • Family Groups: Create and manage medicine inventory for your entire family
  • 6-Character Family Codes: Simple, secure family joining system (no email required)
  • Optional Password Protection: Secure families with bcrypt-encrypted passwords
  • Role-Based Access: Admin and member roles with appropriate permissions
  • Real-time Sync: All family members see inventory updates instantly
  • Code Regeneration: Admins can generate new family codes anytime

๐Ÿ’Š Medicine Tracking

  • Comprehensive Database: Store medicine details, quantities, categories, and locations
  • Expiry Monitoring: Track expiration dates with visual warnings and alerts
  • Smart Categories: Organize medicines by type (Pain Relief, Antibiotics, Vitamins, etc.)
  • Location Tracking: Know exactly where each medicine is stored

๐Ÿ” Advanced Search & Filtering

  • Powerful Search: Find medicines by name, description, or category
  • Multiple Filters: Filter by category, location, stock status, expiry status
  • Out of Stock Management: Mark medicines as out of stock with tracking
  • Sorting Options: Sort by name, expiry date, quantity, or category
  • Quick Access: Dedicated expired medicines page with filtering
  • Delete Functionality: Remove medicines with confirmation dialogs

๐Ÿ“ฑ Enhanced Mobile Experience

  • Mobile-First: Fully optimized for phones and tablets
  • Responsive Dashboard: Shopping list integration with tiled button layouts
  • Touch-Friendly Forms: Large tap targets and intuitive layouts
  • Improved Dropdown: Email overflow handling with proper text truncation
  • Adaptive Navigation: Desktop navbar transforms to bottom navigation on mobile
  • Professional Mobile UI: Clean interface that works perfectly on small screens
  • Grid-Based Layout: Modern CSS grid for reliable responsive design

๐Ÿ” Authentication & Security

  • Google OAuth: Quick sign-in with Google account
  • Email/Password: Traditional authentication option
  • Secure Sessions: Firebase authentication with automatic session management
  • Protected Routes: Family-based access control

๐ŸŒ“ Modern UI/UX

  • Dark/Light Theme: Toggle between themes (system coming soon)
  • Modern Icons: Beautiful Lucide React icons throughout
  • Responsive Cards: Clean, card-based interface with mobile optimization
  • Loading States: Smooth loading animations and states
  • Shopping List Integration: Quick access from dashboard with purple theming
  • Confirmation Modals: Safe deletion and action confirmations

๐Ÿš€ Tech Stack

  • Frontend: Next.js 15, React 18, TypeScript
  • Styling: Tailwind CSS
  • Backend: Firebase Firestore, Firebase Auth
  • Icons: Lucide React
  • Deployment: Vercel (recommended)
  • Build Tool: Turbopack (Next.js)

๐Ÿ“‹ Prerequisites

  • Node.js 18+ installed
  • Firebase project setup
  • Google OAuth credentials (optional but recommended)

โšก Quick Start

1. Clone Repository

git clone https://github.com/yourusername/medistock.git
cd medistock
npm install

2. Firebase Setup

  1. Create Firebase Project

    • Go to Firebase Console
    • Create a new project
    • Enable Authentication (Email/Password and Google Sign-in)
    • Create a Firestore database
  2. Configure Authentication

    • Enable Email/Password authentication
    • Enable Google Sign-in (optional)
    • Add your domain to authorized domains
  3. Set Up Firestore

    • Create a Firestore database in production mode
    • Configure security rules (see below)

3. Environment Configuration

Create .env.local file in the root directory:

NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key_here
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id

4. Firestore Security Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Users can read/write their own profile
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
    
    // Family members can read/write medicines in their family
    match /medicines/{medicineId} {
      allow read, write: if request.auth != null && 
        exists(/databases/$(database)/documents/families/$(resource.data.familyId)) &&
        request.auth.uid in get(/databases/$(database)/documents/families/$(resource.data.familyId)).data.members[].userId;
    }
    
    // Family management - members can read, admins can write
    match /families/{familyId} {
      allow read: if request.auth != null && 
        request.auth.uid in resource.data.members[].userId;
      allow write: if request.auth != null && 
        request.auth.uid in resource.data.members[?(@.role == 'admin')].userId;
    }
    
    // Activity logs - family members can read, system can write
    match /activityLogs/{logId} {
      allow read: if request.auth != null && 
        exists(/databases/$(database)/documents/families/$(resource.data.familyId)) &&
        request.auth.uid in get(/databases/$(database)/documents/families/$(resource.data.familyId)).data.members[].userId;
      allow write: if request.auth != null;
    }
  }
}

5. Run Development Server

npm run dev

Open http://localhost:3000 to view the application.

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ app/                    # Next.js App Router pages
โ”‚   โ”œโ”€โ”€ auth/              # Authentication pages
โ”‚   โ”‚   โ”œโ”€โ”€ signin/        # Sign in page
โ”‚   โ”‚   โ””โ”€โ”€ signup/        # Sign up page
โ”‚   โ”œโ”€โ”€ dashboard/         # Main dashboard
โ”‚   โ”œโ”€โ”€ family/            # Family management
โ”‚   โ”œโ”€โ”€ logs/              # Activity logs
โ”‚   โ”œโ”€โ”€ medicines/         # Medicine management
โ”‚   โ”‚   โ”œโ”€โ”€ add/          # Add medicine form
โ”‚   โ”‚   โ”œโ”€โ”€ expired/      # Expired medicines view
โ”‚   โ”‚   โ””โ”€โ”€ search/       # Search and filter
โ”‚   โ”œโ”€โ”€ settings/          # User settings
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout
โ”‚   โ””โ”€โ”€ page.tsx          # Home page redirect
โ”œโ”€โ”€ components/            # React components
โ”‚   โ””โ”€โ”€ Layout/           # Layout components
โ”‚       โ”œโ”€โ”€ BottomNav.tsx # Mobile bottom navigation
โ”‚       โ”œโ”€โ”€ Layout.tsx    # Main layout wrapper
โ”‚       โ””โ”€โ”€ Navbar.tsx    # Desktop navigation
โ”œโ”€โ”€ contexts/             # React contexts
โ”‚   โ”œโ”€โ”€ AuthContext.tsx  # Authentication state
โ”‚   โ””โ”€โ”€ FamilyContext.tsx # Family management state
โ”œโ”€โ”€ lib/                  # Utility functions
โ”‚   โ”œโ”€โ”€ firebase.ts      # Firebase configuration
โ”‚   โ””โ”€โ”€ utils.ts         # Helper functions
โ””โ”€โ”€ types/               # TypeScript type definitions
    โ””โ”€โ”€ index.ts         # Application types

๐ŸŽฏ Core Features Guide

Family Management (v1.5.0 Enhanced)

  1. Create Family: Set up family group with optional password protection
  2. Generate Family Code: Get unique 6-character code for easy sharing
  3. Invite Members: Share family code (and password if set) with family members
  4. Join Family: Enter family code and optional password to join
  5. Manage Security: Change or remove family passwords anytime (admins only)
  6. Regenerate Codes: Create new family codes when needed
  7. View Members: See all family members with their roles and join dates

Medicine Management

  1. Add Medicines: Comprehensive form with all details
  2. Track Expiry: Visual indicators for expired/expiring medicines
  3. Organize: Categories and storage locations
  4. Search: Find medicines quickly with filters

Mobile Experience

  1. Bottom Navigation: Easy thumb navigation on mobile
  2. Profile Menu: Access family, settings, and logs from profile icon
  3. Responsive Design: Adapts to all screen sizes
  4. Touch-Friendly: Large tap targets and smooth interactions

๐Ÿšข Deployment

Vercel (Recommended)

  1. Connect Repository

    # Install Vercel CLI
    npm i -g vercel
    
    # Deploy
    vercel
  2. Configure Environment Variables

    • Add all Firebase config variables in Vercel dashboard
    • Set production domains in Firebase console
  3. Custom Domain (Optional)

    • Add custom domain in Vercel dashboard
    • Update Firebase authorized domains

Other Platforms

The application can be deployed to:

  • Netlify: Static hosting with serverless functions
  • AWS Amplify: Full-stack deployment
  • Google Cloud Platform: Native Firebase integration
  • Self-hosted: Docker container deployment

๐Ÿ“ฑ Mobile App Potential

The responsive design makes this web app perfect for:

  • PWA Conversion: Add to home screen functionality
  • Mobile Wrapper: Cordova/PhoneGap integration
  • React Native: Code sharing opportunities

๐Ÿค Contributing

  1. Fork the Repository
  2. Create Feature Branch
    git checkout -b feature/amazing-feature
  3. Commit Changes
    git commit -m 'Add amazing feature'
  4. Push to Branch
    git push origin feature/amazing-feature
  5. Open Pull Request

Development Guidelines

  • TypeScript: Maintain strict type safety
  • ESLint: Follow linting rules
  • Responsive: Test on multiple screen sizes
  • Accessibility: Ensure keyboard and screen reader support

๐Ÿ”ง Available Scripts

# Development server
npm run dev

# Production build
npm run build

# Start production server
npm start

# Linting
npm run lint

# Type checking
npm run type-check

๐Ÿ› Troubleshooting

Common Issues

  1. Firebase Configuration

    # Check environment variables
    echo $NEXT_PUBLIC_FIREBASE_API_KEY
  2. Build Errors

    # Clear Next.js cache
    rm -rf .next
    npm run build
  3. Authentication Issues

    • Verify Firebase project settings
    • Check authorized domains
    • Confirm OAuth configuration

Getting Help

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • Next.js Team: Amazing React framework
  • Firebase Team: Powerful backend services
  • Tailwind CSS: Beautiful utility-first CSS
  • Lucide: Gorgeous icon library
  • Vercel: Excellent deployment platform

๐Ÿ” What's New in v1.5.8

โœ… Shopping List Integration: Quick access shopping button on dashboard โœ… Enhanced Mobile Dashboard: Proper button tiling with CSS grid layout โœ… Responsive Design: Optimized layouts from mobile to desktop โœ… Out of Stock Management: Mark and filter medicines by stock status โœ… Delete Functionality: Safe medicine deletion with confirmations โœ… Bulk Operations: Manage expired medicines and shopping lists efficiently

Previous in v1.5.0

โœ… Family Code System: No more email dependencies - simple 6-character codes โœ… Password Protection: Optional bcrypt-encrypted family passwords โœ… Enhanced Mobile UI: Perfect mobile experience with responsive design โœ… Improved Security: Better validation and admin-only operations โœ… Cleaner Interface: Conditional content display and better form handling

๐Ÿ”ฎ Roadmap

  • Dark Theme: Complete dark mode implementation
  • Push Notifications: Expiry reminders
  • Barcode Scanner: Quick medicine addition
  • Analytics Dashboard: Usage insights
  • Backup/Export: Data portability
  • Multiple Languages: Internationalization
  • Medicine Database: Auto-complete from database
  • Doctor Integration: Share with healthcare providers

Made with โค๏ธ for better medicine management

Keep your family healthy with organized medicine tracking!

About

๐Ÿ’Š Modern App for managing home medicine inventory with family sharing, expiry tracking, out-of-stock management, and shopping lists. Features mobile-first responsive design, 6-character family codes, and real-time synchronization. Built with Next.js, TypeScript & Firebase.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages