Skip to content

Azure-Samples/azure-sql-inventory-tracker-app

Repository files navigation

Inventory Tracker

Modernized inventory tracking stack built with a minimal .NET API, a shared core library, and a Svelte single-page app.

As seen on Budget Bytes: Build an Inventory Manager for Free!

Architecture

  • InventoryManagementAPI/ – Minimal API exposing receipt analysis and inventory endpoints.
  • InventoryTrackerApp.Core/ – Shared models, data access, text/image analysis helpers.
  • inventory-frontend/ – Vite-powered Svelte UI that talks to the API.
Svelte UI ──▶ InventoryManagementAPI ──▶ SQL
					 │
					 └──▶ InventoryTrackerApp.Core

Prerequisites

Backend setup

  1. Navigate to the repository root.

  2. Restore dependencies and compile:

    dotnet restore
    dotnet build
  3. Configure environment variables used by the API/Core:

    • AZURE_SQL_CONN – SQL connection string.
    • AI_FOUNDRY_ENDPOINT – Microsoft Foundry endpoint URL (ends with /).
    • API_KEY – API key for the Foundry AI resource.

    Alternatively, configure the AzureOpenAI section in appsettings.json:

    {
      "AzureOpenAI": {
        "Endpoint": "your-azure-openai-endpoint",
        "Deployment": "your-deployment-name",
        "ApiKey": "your-api-key",
        "Temperature": 0.1,
        "MaxOutputTokens": 256,
        "CatalogSampleSize": 50,
        "MinimumConfidence": 0.6
      }
    }
  4. Run the API:

    dotnet run --project InventoryManagementAPI/InventoryManagementAPI.csproj

    The API listens on http://localhost:5000 by default (HTTPS on https://localhost:7269).

Frontend setup

  1. Install dependencies:
    cd inventory-frontend
    npm install
  2. Start the dev server (proxies /api to http://localhost:5000):
    npm run dev
  3. If the backend runs on a different URL, set VITE_API_PROXY before starting the dev server or set VITE_API_BASE_URL for production builds.
  4. Build for production:
    npm run build

API surface

Method Route Description
GET / Health string.
GET /items Returns current inventory items.
POST /analyze Accepts an image/* file upload,
extracts products, saves to storage.

Svelte UI features

  • Upload a photo/receipt for automatic item extraction.
  • View inventory list with timestamps, categories, expiration dates.
  • Trigger manual refreshes without reloading the page.

Development tips

  • Use dotnet watch --project InventoryManagementAPI for hot reload while developing the API.
  • The Vite dev server proxies /api/* calls to the backend, so no CORS changes are needed in development.
  • To serve the built Svelte assets from ASP.NET later, point a static file middleware to inventory-frontend/dist after running npm run build.

About

Inventory Tracker Application with Intelligent Search Capabilities, as seen on Budget Bytes

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages