DristiDocs is a smart AI-powered pharmacy management platform designed to automate inventory control, order tracking, and document-based data extraction for chemists and administrators. This repository contains the frontend codebase built using React.js, TypeScript, and Material UI, optimized for a clean, responsive, and role-based interface.
The DristiDocs frontend acts as the client-side layer of the full-stack pharmacy system, providing role-specific views for Admins and Chemists. It includes modules for managing inventory, creating and reviewing orders, uploading invoices for AI-powered extraction (via OpenAI API), and generating insights through visual dashboards.
Coming soon...
- Secure sign-up and login flow for Admins and Chemists
- JWT-based session management with protected routes
- Role-based UI rendering
- View real-time stock levels and product attributes
- Add, edit, and remove items with category, state, quantity, price, and expiry
- Perform stock-out operations (sell/update quantities)
- Create new orders manually or via document upload
- View pending and shipped orders with full status tracking
- Visual timeline of pharmacy operations (inventory updates, orders, returns)
- Upload supplier invoices (PDF/Image)
- Extract structured data using OpenAI API
- Auto-update inventory from parsed document content
- Admin dashboard to manage chemists, stockists, and product configurations
- View orders, inventory trends, and usage analytics
-
Role-Based Dashboards
- Admin: Manage users, stockists, inventory, and analytics
- Chemist: Create orders, track stock, upload bills, manage sales
-
Document Upload Integration
- Uploads go to the backend which forwards to OpenAI API
- Results displayed in form for review before submission
-
Real-Time Inventory Sync
- All actions update inventory and order states live using Redux
-
UI/UX
- Built with Material UI for responsive, professional design
- Navigation drawer, badges, tooltips, and interactive tables
- Framework: React.js (v18+)
- Language: TypeScript
- Styling: Tailwind CSS (optional), Material UI (primary)
- State Management: Redux Toolkit
- Routing: React Router DOM
- API Client: Axios
- Auth: JWT stored securely in localStorage/cookies
- Others: React Hook Form, React Icons, Date Pickers, Skeleton Loaders
-DristiDocs/: Contains the React frontend code.
- public/: Holds static files like
index.htmland the favicon. - src/: Main source code for the application.
- api/: Contains Axios instances and API-related functions.
- assets/: Includes images, logos, and icons.
- components/: Houses reusable UI components like buttons, modals, and headers.
- features/: Contains domain-specific logic and functionality for various features:
- auth/: Handles user authentication (login/register).
- orders/: Manages the order-related UI and logic.
- inventory/: Manages the inventory system.
- upload/: Provides file upload and extraction functionality.
- pages/: Page-level routes and views.
- store/: Redux slices, actions, and store setup.
- utils/: Helper functions, constants, and validation utilities.
- App.tsx: Main app layout, routing, and rendering logic.
- main.tsx: Entry point for rendering the application, including Redux provider.
- package.json: Contains configuration for dependencies, scripts, and other settings.
DristiDocs uses Redux Toolkit for global state management, ensuring consistent data flow across the app. Each feature module (e.g., orders, inventory, auth) has its own slice, defined with actions and reducers.
-
Global State:
authSlice: Handles user login state and JWT tokens.orderSlice: Stores order list, status, and active order details.inventorySlice: Manages inventory records and stock updates.
-
Local State:
- Managed via
useState,useEffect, andReact Hook Formfor form data. - Modal visibility, table filters, and input values.
- Managed via
Benefits:
- Predictable state transitions.
- Centralized error handling and loading status.
- Easy integration with debugging tools (Redux DevTools).
All frontend HTTP communication is handled using Axios. The API base URL is dynamically set using the REACT_APP_API_URL environment variable.
A global Axios instance is created in /src/api/axiosInstance.ts, which automatically attaches the JWT token to the Authorization header for secure endpoints.
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;-
Login or Register
- Visit http://localhost:3000.
- Choose "Chemist" or "Admin" role and authenticate.
-
Chemist Dashboard
- Navigate to Inventory to view and update stock.
- Use Orders to view past orders or create new ones.
- Use Upload Bills to upload a PDF/image and extract data.
-
Admin Dashboard
- Access Manage Chemists to view or deactivate accounts.
- Use Stockist Management to add new vendors.
- View order trends, inventory movement, and analytics.
-
Uploading a Bill
- Navigate to Upload Bills.
- Select a file (image/pdf) and review the extracted data.
- Confirm to update inventory instantly.
-
Creating Orders
- Click New Order, select stockist, add products, and submit.
- Track status under Pending Orders and Shipped Orders.
-
Secure Session
- JWT token is saved locally (e.g., in
localStorage). - Sessions auto-expire, and users must log in again after expiration.
- JWT token is saved locally (e.g., in
- Node.js (v14 or higher)
- npm or yarn
- Backend running locally at
http://localhost:8000
- Clone the repository:
git clone https://github.com/JineshPrajapat/DristiDocs.git
cd DristiDocs/frontend- Install dependencies:
npm install- Configure environment variables:
VITE_LOCAL_BACKEND_BASE_URL=""- Run the Application
npm run devThe app will start on http://localhost:3000.
The app uses Redux Toolkit for managing application-wide state such as:
- Auth tokens and user data
- Inventory lists and actions
- Orders, bills, and UI feedback messages
Local state is managed using useState and React Hook Form for forms.
- Axios is used to handle HTTP requests to the backend.
- All protected routes send JWT in Authorization headers.
- Modular API service files are organized under
/src/api/.
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software in accordance with the license terms.
For any questions, suggestions, or issues, feel free to reach out to the project maintainer:
- Jinesh Prajapat
π§ prajapatjinesh585@gmail.com
π LinkedIn
Thanks to the following individuals for their contributions to this project:
- Jinesh Prajapat
- Tohid Khan
- Anjali Choudhary
- Tisha Chatrola
- Yatin Badeja