CoolFace
Apppublic

chetan2710/Local_Medicine

sourceHugging Facemitupdated 11mo agoView on Hugging Face
0likes
App README

Local Medicine Backend API

Django REST API for the Local Medicine mobile application - helping users find medicines and nearby pharmacies.

Features

  • โ€”๐Ÿ” Authentication: JWT-based user authentication
  • โ€”๐Ÿ’Š Medicine Management: Search and manage medicine inventory
  • โ€”๐Ÿช Store Locations: Find nearby pharmacies and medicine stores
  • โ€”๐Ÿ“ฆ Inventory Tracking: Real-time inventory management
  • โ€”๐Ÿ“ Request Handling: Customer and shop request management

API Endpoints

Authentication

  • โ€”POST /api/v1/auth/register - Register new user
  • โ€”POST /api/v1/auth/login - User login
  • โ€”POST /api/v1/auth/refresh - Refresh JWT token
  • โ€”GET /api/v1/auth/me - Get current user info

Medicines

  • โ€”GET /api/v1/medicines/ - List all medicines
  • โ€”GET /api/v1/medicines/search?q=query - Search medicines
  • โ€”GET /api/v1/medicines/{id}/ - Get medicine details
  • โ€”POST /api/v1/medicines/ - Create medicine (admin)
  • โ€”PUT /api/v1/medicines/{id}/ - Update medicine (admin)
  • โ€”DELETE /api/v1/medicines/{id}/ - Delete medicine (admin)

Stores

  • โ€”GET /api/v1/stores/ - List all stores
  • โ€”GET /api/v1/stores/nearby?lat={lat}&lng={lng} - Find nearby stores
  • โ€”GET /api/v1/stores/{id}/ - Get store details
  • โ€”POST /api/v1/stores/ - Create store (shop owner)

Inventory

  • โ€”GET /api/v1/inventory/ - List inventory items
  • โ€”POST /api/v1/inventory/ - Add inventory item
  • โ€”PUT /api/v1/inventory/{id}/ - Update inventory
  • โ€”DELETE /api/v1/inventory/{id}/ - Remove inventory

Requests

  • โ€”GET /api/v1/requests/ - List requests
  • โ€”POST /api/v1/requests/ - Create request
  • โ€”PUT /api/v1/requests/{id}/ - Update request status

Technology Stack

  • โ€”Framework: Django 4.2
  • โ€”API: Django REST Framework
  • โ€”Authentication: JWT (Simple JWT)
  • โ€”Database: SQLite (development), PostgreSQL recommended for production
  • โ€”Server: Gunicorn
  • โ€”Static Files: Whitenoise

Environment Variables

See .env.example for required configuration variables.

Local Development

bash
# Install dependencies
pip install -r requirements.txt

# Run migrations
python manage.py migrate

# Create superuser (admin)
python manage.py createsuperuser

# Run development server
python manage.py runserver

Production Deployment

This project is configured for deployment on Hugging Face Spaces using Docker.

Environment Variables to Set in Hugging Face:

  1. 1.SECRET_KEY - Django secret key (generate a secure one)
  2. 2.ALLOWED_HOSTS - Your domain (e.g., .hf.space)
  3. 3.CORS_ALLOWED_ORIGINS - Your Flutter app URLs
  4. 4.DEBUG - Set to False in production

License

MIT License - See LICENSE file for details

Support

For issues and feature requests, please open an issue on GitHub.