- Project Overview
- System Architecture
- Core Features
- Tech Stack
- Security & Performance
- Screenshots
- Installation & Setup
StockPilot goes beyond traditional inventory tracking by introducing an advanced Role-Based Access Control (RBAC) architecture, an integrated Approval Workflow System, and a state-of-the-art AI-Powered Inventory Assistant.
Designed with a premium, responsive dark/light mode interface, StockPilot is built to help administrators and customers seamlessly manage products, record stock movements, track dynamic analytics, and automate tasks through natural language queries.
StockPilot is structured as a highly scalable full-stack application.
- Client Layer (Web & Mobile):
- A lightning-fast Vanilla HTML/CSS/JS frontend ensures zero framework overhead.
- Cross-platform ready: Deployed as a web application and packaged natively as an Android APK using Capacitor/Cordova.
- Application Layer (Node.js & Express.js):
- A RESTful API backend handling business logic, JWT authentication, request validation, and AI prompt orchestration.
- Data Layer (MongoDB Atlas):
- A NoSQL cloud database utilizing Mongoose schemas for
Users,Products,Movements,Requests, andShares.
- A NoSQL cloud database utilizing Mongoose schemas for
- AI Processing Layer (Groq API):
- Integrates the blazing-fast
Llama-3.1-8b-instantLLM to provide contextual, data-aware inventory insights to the user.
- Integrates the blazing-fast
- Complete Inventory Control: Easily add, update, and delete products. Track essential metadata including SKU, Supplier, Category, Price, Quantity, Storage Location, and Barcode.
- Stock Movement Tracking: Seamlessly record stock-in and stock-out operations. The system calculates amount totals automatically and maintains a full audit log.
- Request Approval Workflow: Customers can submit inventory change requests. Admins can review, approve, and execute them with a single click, or reject them with feedback notes.
- User Management: Suspend or activate customer accounts to maintain platform security. Generate secure, one-time
Share Tokensto grant external viewers access to inventory data. - Analytics Dashboard: Real-time summary cards, latest movement feeds, and low-stock indicators.
- Secure Browsing: Customers can view available stock levels and categories but are restricted from viewing sensitive business data (like supplier details or exact warehouse locations).
- Interactive Requests: Customers can actively participate in inventory management by submitting requests to add new products or record movements.
- Request Tracking: Monitor the lifecycle of submitted requests (Pending, Approved, Rejected) directly from the customer dashboard.
- Context-Aware Insights: Powered by the Groq API, users can ask natural language questions about their inventory (e.g., "Which electronics are low on stock?").
- Role-Based AI Logic: The AI intelligently adapts its responses based on the user's role. It will hide SKUs and sensitive data from customers, while giving full administrative data to admins.
- Dynamic Mermaid Charts: The AI is programmed to generate visual
piecharts andxychart-betabar graphs inside the chat interface to visualize stock distributions dynamically!
- Frontend: HTML5, CSS3 (Modern Variables & Responsive Design), Vanilla JavaScript (ES6+).
- Backend Runtime: Node.js.
- Web Framework: Express.js.
- Database: MongoDB Atlas (NoSQL) with Mongoose ORM.
- Authentication: JWT (JSON Web Tokens),
bcryptjsfor secure password hashing,cookie-parserfor XSS-proof HTTP-only cookies. - AI Integration: Groq Cloud API (
Llama-3.1-8b-instant). - Mobile Environment: Capacitor/Cordova wrapper for Android deployment.
- Hardened Authentication: User sessions are securely managed via
HttpOnlycookies, completely mitigating Cross-Site Scripting (XSS) token theft. - Role-Based Middlewares: Strict backend routing protections (
adminOnly,customerOnly) ensure authorization at the server level. - AI Rate Limiting: The Groq AI insights route utilizes an in-memory rate limiter (max 5 requests per minute per user) to prevent API abuse and control cloud costs.
- Robust Validation: Server-side validation safeguards database integrity when adding products, logging movements, and processing user inputs.
- Node.js (v16 or higher)
- MongoDB Atlas Connection URI
- Groq API Key
-
Clone the repository:
git clone https://github.com/vedant27-lab/stockpilot.git cd stockpilot -
Install dependencies:
npm install
-
Environment Setup: Create a
.envfile in the root directory and add your credentials:PORT=3000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_super_secret_jwt_key GROQ_API_KEY=your_groq_cloud_api_key
-
Start the application:
npm run dev
Navigate to
http://localhost:3000in your web browser.
Developed with ❤️ by Vedant

