StockTrack is a lightweight, self-hosted inventory management system built with HTML, PHP, and SQLite, designed for small stores, workshops, and internal teams.
Find a file
2026-01-14 09:28:27 +00:00
api qr code, scanner, low staock detetction 2026-01-14 09:28:27 +00:00
app qr code, scanner, low staock detetction 2026-01-14 09:28:27 +00:00
assets qr code, scanner, low staock detetction 2026-01-14 09:28:27 +00:00
data qr code, scanner, low staock detetction 2026-01-13 16:13:35 +00:00
admin.php qr code, scanner, low staock detetction 2026-01-13 16:13:35 +00:00
audit.php qr code, scanner, low staock detetction 2026-01-14 09:28:27 +00:00
backup_db.php qr code, scanner, low staock detetction 2026-01-13 16:13:35 +00:00
docker-compose.yml first commit 2026-01-13 05:19:41 +00:00
Dockerfile first commit 2026-01-13 05:19:41 +00:00
export.php Huge improvement like filters 2026-01-13 11:16:57 +00:00
fix_transactions.php Huge improvement like filters 2026-01-13 08:15:53 +00:00
import.php Huge improvement like filters 2026-01-13 11:16:57 +00:00
index.php first commit 2026-01-13 05:19:41 +00:00
install.php first commit 2026-01-13 05:19:41 +00:00
labels.php qr code, scanner, low staock detetction 2026-01-13 16:13:35 +00:00
login.php first commit 2026-01-13 05:19:41 +00:00
logout.php first commit 2026-01-13 05:19:41 +00:00
migrate_threshold.php qr code, scanner, low staock detetction 2026-01-13 16:13:35 +00:00
password.php first commit 2026-01-13 05:19:41 +00:00
public.php qr code, scanner, low staock detetction 2026-01-13 16:13:35 +00:00
README.md Update Readme.md 2026-01-13 11:55:15 +00:00
recover_db.php Huge improvement like filters 2026-01-13 08:15:53 +00:00
sw.js Huge improvement like filters 2026-01-13 08:15:53 +00:00
take.php qr code, scanner, low staock detetction 2026-01-14 09:28:27 +00:00
users.php Huge improvement like filters 2026-01-13 08:15:53 +00:00

StockTrack — Inventory Management System

A lightweight, robust Inventory Management System built with PHP and SQLite. Designed for tracking assets with condition monitoring (New, Repaired, Faulty), transaction auditing, and mobile PWA support.

StockTrack Logo

🚀 Features

📦 Inventory Management

  • Stock IN (Admin): Add new items or replenish stock.
  • Stock OUT: Dedup items when taken for use.
  • Condition Tracking: Track items as New, Repaired, or Faulty separately (e.g., HDMI Cable [New] vs HDMI Cable [Repaired]).
  • Import/Export: Bulk import items via CSV or export current stock for backups.
  • Soft Delete: Items can be deleted (hidden) without losing historical data.
  • Delete All: Admin option to wipe inventory while keeping logs.

🔍 Audit & History

  • Simple View: See current stock levels and status (In Stock / Out of Stock).
  • History View: Full transaction log (Who took what, when, and why).
  • Drill-Down: Click any item to see its specific history and variant stocks.
  • Quick Actions: Add or remove stock directly from the audit popup.
  • Filters: Filter by Date Range, Condition, Status, or Search query.

📱 User Experience

  • Public Check: Read-only page for anyone to search stock and print lists.
  • PWA Ready: Installable on mobile and desktop (includes Service Worker & Manifest).
  • Responsive: Optimized for mobile, tablet, and desktop screens.
  • Print Friendly: Clean print layouts for stock lists and reports.

🛡️ Security & Roles

  • Admin: Full access (Stock IN, Edit, Delete, User Management, Import/Export).
  • User: Restricted access (Stock OUT, Audit View).
  • Security: Password hashing (bcrypt), CSRF protection, and SQLite strict mode.

🛠️ Tech Stack

  • Backend: PHP 8.2+ (No frameworks, pure vanilla PHP).
  • Database: SQLite 3 (Zero configuration, file-based).
  • Frontend: HTML5, CSS3 (Custom styles), Vanilla JavaScript.
  • Container: Docker & Docker Compose.

🐳 Quick Start (Docker)

  1. Clone/Download this repository.
  2. Run with Docker Compose:
    docker compose up -d --build
    
    

3. **Open** in browser:
* **URL:** `http://localhost:8092`



### Default Credentials

| Role | Username | Password |
| --- | --- | --- |
| **Admin** | `admin` | `admin123` |
| **User** | `user` | `user123` |

---

## 🔧 Manual Installation (No Docker)

1. Ensure you have **PHP 8.0+** and the **php-sqlite3** extension installed.
2. Place the files in your web server directory (e.g., `/var/www/html` or `htdocs`).
3. Ensure the `data/` folder is writable by the web server:
```bash
mkdir data
chmod -R 775 data
chown -R www-data:www-data data

  1. Navigate to http://localhost/install.php to initialize the database.
  2. Delete install.php after installation for security.

📂 Project Structure

StockTrack/
├── api/               # AJAX Endpoints (History, Search, Transact)
├── app/               # Core Logic (Auth, DB Connection, Layouts)
├── assets/            # CSS, JS, Images, PWA Manifest
├── data/              # SQLite Database (Created after install)
├── admin.php          # Admin Dashboard (Stock IN, Manage Items)
├── audit.php          # Audit & Inventory Views
├── export.php         # CSV Export Logic
├── import.php         # CSV Import Logic
├── index.php          # Homepage
├── public.php         # Public Stock Check
├── take.php           # Stock OUT Page
├── sw.js              # Service Worker (PWA)
└── ...

⚠️ Troubleshooting

"Unable to open database file"

  • Ensure the data/ folder exists and has write permissions.
  • Docker users: Run sudo chown -R 33:33 data.

"Foreign Key Constraint Failed"

  • This happens if you try to log a transaction for an item that doesn't exist. The application handles this, but if you manually edit the DB, ensure referential integrity.

📜 License

This project is open-source. Feel free to modify and distribute.