Skip to content

Inventory management app for electronic components with multi-location, container, and category support. Tracks items with UUIDs, logs check-in/out, manages projects, and stores data via local, SQL, or external databases through customizable API requests.

Notifications You must be signed in to change notification settings

YK12321/Invelog

Repository files navigation

Invelog

A comprehensive inventory management system for electronic components with advanced tracking, multi-location support, and project management capabilities.

Overview

Invelog is a robust inventory management solution designed to track electronic components across multiple locations, containers, and projects. Built with scalability and flexibility in mind, it provides real-time tracking of components with unique identification and comprehensive activity logging.

Key Features

πŸ—οΈ Hierarchical Organization

  • Multi-Location Support: Manage inventory across multiple physical locations
  • Container Management: Organize items in containers and subcontainers
  • Category System: Classify components by categories for easy organization
  • UUID Tracking: Every subcontainer and item is assigned a unique identifier for precise tracking

πŸ“¦ Inventory Management

  • Main Storage Containers: Designated inventory containers for primary storage
  • Project-Specific Containers: Create dedicated containers for individual projects
  • Item Movement: Seamlessly transfer items between main inventory and project containers
  • Component Tracking: Monitor individual components regardless of their current location

πŸ“Š Activity Logging

  • Usage Tracking: Log all activity for each item in the system
  • Check-In/Check-Out: Track when items are checked out and checked in
  • Time Monitoring: Record the duration items spend in different containers or projects
  • Audit Trail: Maintain complete history of component movements and usage

πŸ—‚οΈ Project Management

  • Project Creation: Set up projects with dedicated container allocation
  • Resource Allocation: Move components from main inventory to project-specific containers
  • Project Tracking: Monitor component usage per project over time

πŸ’Ύ Flexible Database Support

  • Local File-Based Storage: Perfect for single-user scenarios and offline access
  • SQL Database Integration: Connect to PostgreSQL, MySQL, SQLite, or MS SQL Server
  • REST API Support: Integrate with cloud-native applications via HTTP API
  • Custom Database Server: Deploy standalone server for multi-client access
  • Seamless Switching: Change database backends without modifying application code
  • Transaction Support: ACID compliance for SQL databases
  • Connection Pooling: Optimized performance for multi-user scenarios
  • Schema Management: Automatic table creation and migration support

Architecture

Invelog leverages object-oriented programming (OOP) to provide a clean, maintainable codebase with clear separation of concerns. The system architecture supports:

  • Modular Design: Easy to extend and customize
  • Database Abstraction: Switch between local and SQL databases seamlessly
  • Scalability: Handles small workshops to large enterprise inventories

Use Cases

  • Electronics Workshops: Track components across multiple storage locations
  • Makerspaces: Manage shared inventory and project-specific allocations
  • R&D Labs: Monitor component usage across research projects
  • Manufacturing: Track parts from warehouse to production floor
  • Educational Institutions: Manage lab equipment and student project materials
  • Multi-Location Teams: Share inventory data across network with database server
  • Remote Teams: Access centralized inventory via REST API from anywhere

Getting Started

Prerequisites

  • CMake 3.15 or higher
  • C++17 compatible compiler (Visual Studio 2017+, GCC 7+, or Clang 5+)

Quick Build (Windows)

# Navigate to project directory
cd "path\to\Invelog"

# Create build directory
mkdir build
cd build

# Generate build files
cmake ..

# Build the project
cmake --build . --config Release

# Run the demo
.\bin\Release\invelog.exe

# Or run the database server
.\bin\Release\invelog_server.exe --local ./data --port 8080 --api-key mySecretKey

For detailed build instructions, see docs/BUILD.md.

For a comprehensive quick start guide, see docs/QUICKSTART.md.

Basic Usage

#include "InventoryManager.h"
#include "LocalDatabase.h"

int main() {
    // Initialize with local database
    auto database = std::make_shared<LocalDatabase>("./data");
    InventoryManager manager(database);
    manager.initialize();
    
    // Create entities
    auto category = manager.createCategory("Resistors");
    auto location = manager.createLocation("Main Warehouse");
    auto container = manager.createContainer("Storage Box 1");
    auto item = manager.createItem("Resistor 1kΞ©", category, 100);
    
    // Organize inventory
    location->addContainer(container);
    manager.moveItem(item->getId(), container->getId());
    
    // Shutdown
    manager.shutdown();
    return 0;
}

Using Different Database Backends

// Option 1: Local File-Based Database
auto localDb = std::make_shared<LocalDatabase>("./data");

// Option 2: PostgreSQL Database
SQLDatabase::ConnectionConfig sqlConfig;
sqlConfig.type = SQLDatabase::SQLType::POSTGRESQL;
sqlConfig.host = "localhost";
sqlConfig.port = 5432;
sqlConfig.database = "invelog";
sqlConfig.username = "user";
sqlConfig.password = "pass";
auto sqlDb = std::make_shared<SQLDatabase>(sqlConfig);

// Option 3: REST API Database
APIDatabase::APIConfig apiConfig;
apiConfig.baseUrl = "https://api.example.com";
apiConfig.authType = APIDatabase::AuthType::BEARER_TOKEN;
apiConfig.authToken = "your-token-here";
auto apiDb = std::make_shared<APIDatabase>(apiConfig);

// All databases use the same interface!
InventoryManager manager(localDb); // or sqlDb, or apiDb

For more database examples, see examples/database_examples.cpp.

Running the Database Server

The modular database server offers enhanced configuration options:

# Start server with all features
.\bin\Release\invelog_server.exe --local ./data --port 8080 --api-key mySecretKey --cors

# Start server with PostgreSQL and custom limits
.\bin\Release\invelog_server.exe --postgres "host=localhost dbname=invelog" --port 8080 --max-request 20971520 --timeout 600

# Start server for network access with CORS
.\bin\Release\invelog_server.exe --sqlite ./invelog.db --port 8080 --api-key secureKey456 --cors

New Configuration Options (v0.3.0):

  • --cors - Enable CORS headers for web applications
  • --max-request <bytes> - Set maximum request size (default: 10 MB)
  • --timeout <seconds> - Set request timeout (default: 300s)
  • --no-auth - Disable authentication for development

Clients can then connect from anywhere:

APIDatabase::APIConfig config;
config.baseUrl = "http://192.168.1.100:8080";  // Server IP
config.authType = APIDatabase::AuthType::API_KEY;
config.authToken = "secureKey456";

InventoryManager manager(std::make_shared<APIDatabase>(config));

For deployment guide, see docs/DEPLOYMENT_GUIDE.md. For modular architecture details, see MODULAR_ARCHITECTURE.md.

Current Status

Version 0.3.0 - Modular Server Architecture βœ…

All essential backend components have been implemented with professional architecture:

  • βœ… Complete data model (Item, Container, Location, Project, Category)
  • βœ… UUID-based tracking system
  • βœ… Activity logging and audit trails
  • βœ… Check-in/check-out operations
  • βœ… Search and query capabilities
  • βœ… Local file-based database
  • βœ… SQL database support (PostgreSQL, MySQL, SQLite, MS SQL Server)
  • βœ… REST API database integration
  • βœ… Database abstraction layer for seamless switching
  • βœ… Modular server architecture (HTTP, Routes, Serialization, Auth)
  • βœ… External dependencies integrated (nlohmann/json, cpp-httplib, SQLite3)
  • βœ… Production-ready REST API server with authentication
  • βœ… CORS support and configurable security
  • βœ… Comprehensive demo applications
  • βœ… CMake build system with FetchContent
  • βœ… Full documentation

Latest Updates (v0.3.0):

  • πŸŽ‰ Modular Architecture: Refactored 1,200+ line monolithic server into clean, maintainable modules
  • πŸŽ‰ Separation of Concerns: HTTP, Routes, Serialization, and Auth in separate modules
  • πŸŽ‰ Enhanced Configuration: ServerConfig with CORS, timeouts, request limits
  • πŸŽ‰ Professional Code Quality: Each module 20-220 lines, easy to test and maintain

Next Steps:

  • πŸ”„ Frontend development (Web UI)
  • πŸ”„ Unit testing framework
  • πŸ”„ Rate limiting and advanced security
  • πŸ”„ Real-time updates via WebSocket

See docs/ROADMAP.md for planned features and development timeline.

Documentation

Documentation Overview

The system is built with the following core components:

  1. UUID System: Cryptographically secure unique identifiers
  2. Data Models: Item, Container, Location, Project, Category, ActivityLog
  3. Database Layer: Abstract interface with three implementations:
    • LocalDatabase: File-based storage for single-user scenarios
    • SQLDatabase: Enterprise SQL support (PostgreSQL, MySQL, SQLite, MS SQL)
    • APIDatabase: REST API integration for cloud-native applications
  4. Modular Server Architecture (v0.3.0):
    • HTTP Module: Request/response handling with cpp-httplib
    • Route Handlers: Dedicated handlers per entity type (Items, Containers, etc.)
    • JSON Serialization: Centralized entity ↔ JSON conversion
    • Authentication: API key and Bearer token support
    • Configuration: Flexible ServerConfig with CORS, timeouts, limits
  5. Database Server: Standalone HTTP REST API server for multi-client access
  6. Business Logic: InventoryManager facade for all operations
  7. Activity Tracking: Comprehensive logging of all operations
  8. External Dependencies: Automatic download via CMake FetchContent
    • nlohmann/json v3.11.3
    • cpp-httplib v0.15.3
    • SQLite3 amalgamation

Contributing

Contributions are welcome! Here are some areas where you can help:

High Priority

  1. Frontend Development - Web-based UI for inventory management
  2. Unit Tests - Build comprehensive test suite
  3. Rate Limiting - Add rate limiter middleware to server
  4. WebSocket Support - Real-time inventory updates

Medium Priority

  1. Migration System - Database schema versioning
  2. Batch Operations - Bulk import/export
  3. Advanced Search - Full-text search capabilities
  4. Metrics & Monitoring - Prometheus metrics endpoint
  5. GraphQL API - Alternative API alongside REST

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See docs/ROADMAP.md for detailed feature planning.

Project Structure

Invelog/
β”œβ”€β”€ include/                     # Core library headers
β”‚   β”œβ”€β”€ UUID.h                   # Unique identifier system
β”‚   β”œβ”€β”€ Item.h                   # Inventory item model
β”‚   β”œβ”€β”€ Container.h              # Storage container model
β”‚   β”œβ”€β”€ Location.h               # Physical location model
β”‚   β”œβ”€β”€ Project.h                # Project management model
β”‚   β”œβ”€β”€ Category.h               # Category system
β”‚   β”œβ”€β”€ ActivityLog.h            # Activity tracking
β”‚   β”œβ”€β”€ Database.h               # Database interface
β”‚   β”œβ”€β”€ LocalDatabase.h          # File-based database
β”‚   β”œβ”€β”€ SQLDatabase.h            # SQL database support
β”‚   β”œβ”€β”€ APIDatabase.h            # REST API database
β”‚   β”œβ”€β”€ DatabaseServer.h         # Legacy server (deprecated)
β”‚   └── InventoryManager.h       # Main API facade
β”œβ”€β”€ src/                         # Core implementations + executables
β”‚   β”œβ”€β”€ *.cpp                    # Core implementations
β”‚   β”œβ”€β”€ main.cpp                 # Demo application
β”‚   └── server_main.cpp          # Database server entry point
β”œβ”€β”€ server/                      # Modular server architecture (v0.3.0)
β”‚   β”œβ”€β”€ include/
β”‚   β”‚   β”œβ”€β”€ http/                # HTTP abstractions
β”‚   β”‚   β”‚   β”œβ”€β”€ HTTPRequest.h
β”‚   β”‚   β”‚   β”œβ”€β”€ HTTPResponse.h
β”‚   β”‚   β”‚   β”œβ”€β”€ RouteHandler.h
β”‚   β”‚   β”‚   └── HTTPServer.h
β”‚   β”‚   β”œβ”€β”€ routes/              # Entity route handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ ItemRoutes.h
β”‚   β”‚   β”‚   β”œβ”€β”€ ContainerRoutes.h
β”‚   β”‚   β”‚   β”œβ”€β”€ LocationRoutes.h
β”‚   β”‚   β”‚   β”œβ”€β”€ ProjectRoutes.h
β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryRoutes.h
β”‚   β”‚   β”‚   └── ActivityLogRoutes.h
β”‚   β”‚   β”œβ”€β”€ serialization/       # JSON conversion
β”‚   β”‚   β”‚   β”œβ”€β”€ JSONSerializer.h
β”‚   β”‚   β”‚   └── JSONDeserializer.h
β”‚   β”‚   β”œβ”€β”€ auth/                # Authentication
β”‚   β”‚   β”‚   └── Authenticator.h
β”‚   β”‚   β”œβ”€β”€ ServerConfig.h       # Server configuration
β”‚   β”‚   └── DatabaseAPIServer.h  # Server coordinator
β”‚   └── src/                     # Modular implementations
β”œβ”€β”€ examples/                    # Example applications
β”‚   β”œβ”€β”€ database_examples.cpp    # Database backend demos
β”‚   └── server_client_demo.cpp   # Server/client demo
β”œβ”€β”€ docs/                        # Documentation
β”‚   β”œβ”€β”€ ARCHITECTURE.md          # System architecture
β”‚   β”œβ”€β”€ ARCHITECTURE_DIAGRAMS.md # Architecture diagrams
β”‚   β”œβ”€β”€ BUILD.md                 # Build instructions
β”‚   β”œβ”€β”€ QUICKSTART.md            # Quick start guide
β”‚   β”œβ”€β”€ DATABASE_GUIDE.md        # Database backend guide
β”‚   β”œβ”€β”€ DEPENDENCY_GUIDE.md      # External dependencies
β”‚   β”œβ”€β”€ API_DOCUMENTATION.md     # REST API reference
β”‚   β”œβ”€β”€ DEPLOYMENT_GUIDE.md      # Deployment guide
β”‚   β”œβ”€β”€ SERVER_QUICKSTART.md     # Server quick start
β”‚   β”œβ”€β”€ DATABASE_SERVER_SUMMARY.md # Server implementation
β”‚   β”œβ”€β”€ SUMMARY.md               # Project summary
β”‚   └── ROADMAP.md               # Development roadmap
β”œβ”€β”€ MODULAR_ARCHITECTURE.md      # Modular server guide (v0.3.0)
β”œβ”€β”€ CMakeLists.txt               # Build configuration
└── README.md

License

(Coming soon - License information)


Built for makers, engineers, and organizations who need precise inventory control.

About

Inventory management app for electronic components with multi-location, container, and category support. Tracks items with UUIDs, logs check-in/out, manages projects, and stores data via local, SQL, or external databases through customizable API requests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published