Open-Inventory-Manager

command module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README ΒΆ

πŸ“¦ Open Inventory Manager

Open Inventory Manager is a lightweight, open-source platform for managing stock, assets, and supplies. It provides tools for tracking inventory levels, recording transactions, generating reports, and integrating with other systems. Designed to be modular and extensible, it can be adapted for retail, warehouse, office, or personal use.

A lightweight, high-performance inventory management backend built in Go, using:

  • ⚑ Gin (HTTP framework)
  • ⚑ BadgerDB (embedded key/value database)
  • ⚑ Async persistence
  • ⚑ JSON API
  • ⚑ Fully thread-safe in-memory inventory model

πŸš€ Features

  • Add, update, delete, and fetch with filters inventory items
  • In-memory collection with mutex protection
  • Automatic async persistence to BadgerDB
  • Unique ID generation based on timestamp
  • Supplier metadata support
  • Fast API built with Gin
  • Minimal CPU & memory usage
  • Runs in Docker (multi-stage build)
  • Simple to deploy & scale

πŸ›  Installation

Install via go install direct method (Recomended)
go install github.com/SumukhaS291299/Open-Inventory-Manager@latest

Make sure ~/go/bin is in your PATH:

export PATH="$PATH:$(go env GOPATH)/bin"

▢️ Running the server

go run main.go

Server runs by default on:

http://localhost:8080

πŸ”§ API Endpoints

POST /additem

{
  "attributes": {
    "name": "Widget",
    "description": "High-quality widget",
    "color": "Red",
    "category": "Gadgets",
    "location": "A1",
    "unit_price": 19.99,
    "stock_level": 100
  },
  "supplier": {
    "name": "Supplies",
    "supplier_type": "wholesale"
  }
}

DELETE /deleteitem

GET /filteritem

PUT /modifyitem

Use Httpie Collections.json to import the basic collection methods


πŸ’Ύ Persistence (BadgerDB)

All items are stored asynchronously in BadgerDB:

  • Fast writes
  • Durable
  • Embedded (no external DB needed)
  • Data survives server restarts

If you are using the image

By default it will persist a VOLUME in ["/data/db"] inside the container


Rules:

  1. All in-memory modifications happen inside the mutex.
  2. DB writes happen asynchronously in goroutines.
  3. Only local copies of items are used in goroutines (no shared memory).

This ensures:

  • Zero race conditions
  • Maximum throughput
  • Safe parallel API access

🐳 Docker Support

Build:

docker build -t inventory-manager .

Run:

docker run -p 8080:8080 inventory-manager

πŸ§ͺ Python API Tester (Mock Data)

pip install requests faker

Run:

python python_mocker.py

Generates random inventory items and POSTs them to your server.


🧱 Multi-stage Dockerfile (included)

πŸ™‹ Contributing

PRs welcome! Feel free to open issues for:

  • Bug reports
  • Feature suggestions
  • Performance improvements
  • Documentation updates

πŸ“œ License

MIT License β€” feel free to use for personal or commercial projects.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL