Skip to case study
Back to projects

// Evidence Dossier

3DFAB Inventory System

The workshop can locate a part, check its stock and record its dispatch. The system brings together movements, replenishment alerts, work-order consumption, QR labels and reports.

PythonDjangoHTMXAlpine.jsTailwind CSSSQLiteQRReportLabOpenPyXL
Project video preview.

Find the part and see what remains

Workshop staff can check the component and its location before withdrawing it. The movement updates stock and helps identify when replenishment is needed.

  1. Find the part and its location.
  2. Record and apply the dispatch.
  3. Check remaining stock and the low-stock alert.

In the lab journey, a dispatch of eight units left two in stock and activated an alert. The records were fictional.

Who it serves

3DFAB workshop: physical components, storage locations and materials used in manufacturing jobs.

My responsibility

I designed and built the data model, Django backend, interface, QR labels, reports, tests and documentation.

Current status

Operational in production according to the author. Technical checks ran in an isolated SQLite copy with synthetic data.

What it enables

Check quantity and location before withdrawing a part. Record the movement and identify when stock falls below the minimum.

Context

3DFAB works with physical components and manufacturing materials. Inventory links each part to its category, primary location, available quantity and replenishment threshold. Work orders associate material use with a specific job.

I built the complete system and it is currently operational. No confirmed user count or real-use measurements are available; execution described here took place in a local laboratory.

Problem

A quantity alone does not explain where a component is stored or which operation changed it. The domain problem is to bring together catalog, location, movements and job consumption, while highlighting stock needing replenishment.

Consistency requires distinguishing pending from applied movements and checking repeated or simultaneous operations. An available history does not establish that every physical balance has a documented opening movement.

My role

I designed and developed the complete Django solution: models and relationships, forms, views, stock rules, interface, QR labels, alerts, reports, tests and documentation. Attribution comes from my confirmation, not from inferring responsibilities through Git.

This case-study review inspects and tests a product copy. It does not incorporate functional repairs into the source repository.

Constraints

Validation had to run locally without touching workshop data or services. Credentials, the existing database, uploaded files and logs were excluded; only necessary code, documentation and configuration files were copied.

There is no Python lockfile and some dependencies are not pinned. The installed environment was reused with its versions recorded, without updating packages to obtain passing tests. PostgreSQL, external email, physical readers and backup restoration were not executed.

Solution

The catalog combines components, categories, locations, photographs and specifications. Searches combine name, code, category, location and stock state; lists use pagination and preloaded relationships.

Movements support entries, withdrawals, transfers and count adjustments. Work-order consumption generates withdrawals. Signals create alerts and QR labels; reports produce PDF, Excel and CSV. QR content is an informational snapshot of the component and does not establish integrated mobile scanning. Indicators are calculated when the page is requested; continuous updates were not established.

Architecture and data model

Django 5 monolith: authentication and sessions → views and forms → domain models → persistence. Pages render on the server, with HTMX for queries and Alpine.js for interaction. Tailwind and Chart.js load from external services in the reviewed templates.

The model covers categories, locations, components, movement history, orders, component usage and alerts. QR labels and images are files outside database transactions.

SQLite is the default engine. DATABASE_URL contemplates PostgreSQL, with additional packages described in the guide and absent from the main dependency manifest. That engine was not run. The presence of select_for_update() does not provide row locking in SQLite.

Inventory architecture and workflow
Inventory architecture and workflow3DFAB inventory flow: Workshop user to web interface; administrator to Django admin; work order to material consumption. Paths converging on Django models and inventory rules, connected to local SQLite via ORM, post_save signals to QR files, and CSV, Excel and PDF reports. PostgreSQL is contemplated but was not tested.SessionWithdrawalORMpost_saveQRQueriesWorkshop userInventory interfaceHTMX · Alpine.jsAdministratorAdmin panelDjango AdminWork orderMaterial consumptionStock deductionDjango modelsInventory rules · ORMpost_save signalsAlerts & QR triggerSQLite localPostgreSQL is contemplated(not tested)Report generationPDF / ExcelCSVQR & imagesOutside DB transactionInventory architecture and workflow3DFAB inventory flow: Workshop user to web interface; administrator to Django admin; work order to material consumption. Paths converging on Django models and inventory rules, connected to local SQLite via ORM, post_save signals to QR files, and CSV, Excel and PDF reports. PostgreSQL is contemplated but was not tested.AccessOrdersWithdrawalORMpost_saveQRQueriesExportWorkshop userAdministratorInventory interfaceAdmin panelWork orderMaterial consumptionDjango modelsInventory rules · ORMSQLite localPostgreSQL not testedpost_save signalsAlerts & QR triggerQR & imagesOutside TXReport generationPDF / Excel / CSVOffline exports
Read the diagram and its limits

Workshop staff use the web interface to check catalog items and record stock movements. Administrators manage users and records in Django Admin. Saving a material consumption record for a work order creates a dispatch movement.

Components and persistence: The core layer brings together Django models and inventory business rules for components, locations, and movements. This layer interacts with local SQLite via the Django ORM. Post_save signals execute alert evaluation and attempt QR label generation, persisting image files to disk.

Diagram simplifications: In the mobile view, actors and interfaces are grouped into consolidated stages to preserve clear visual relationships without horizontal scrolling or label crowding.

Tested scope: Core domain logic, movements and catalogs were executed and validated locally on SQLite (32/37 tests passing). CSV data export was verified. PostgreSQL is contemplated in the application configuration, but was neither executed nor verified in a live production environment.

Files have separate persistence. The injected QR failure left the component saved without its label. Saving a material consumption record again repeated the withdrawal in the tested scenario.

Technical implementation and evidence map. Unit and stock tests executed locally on SQLite; PostgreSQL engine and production concurrency were not validated in a live environment.

Main inventory workflow

Workflow checked using Django’s HTTP client with CSRF enforcement: start a test session, create a component with no stock, register a ten-unit entry, apply it and consult the detail page and stock response. Persisted quantity, applied state and server-assigned user were verified.

The domain test covered withdrawal, replenishment, transfer and adjustment: it checked balances, location change and alert creation/resolution. The browser confirmed sign-in and presentation of the synthetic catalog. These are local workflows, not evidence of continuous operation or physical reader tests.

Concurrency and stock integrity

Applying a movement places the stock update and movement state inside a transaction. An excessive withdrawal was rejected without changes. Simulating failure after the stock write rolled back balance, movement and alert; reloading allowed a successful retry.

Two overlapping withdrawals against ten units used threads and real SQLite connections, synchronized during reads: one applied and the other received a lock error; two units and one applied movement remained. This demonstrates contention, not satisfactory concurrency handling or a result transferable to PostgreSQL.

Tests found repeated effects with stale objects and when resaving work-order consumption. A directly entered initial balance also lacked an automatic opening movement. Complete idempotency and exhaustive reconciliation therefore require reinforcement.

Architectural decisions

The design puts component lookup and movement recording in the same application. Workshop workflows can display part status, alerts and material consumption.

Catalog and movements in Django

Benefit
The application groups forms, models, authentication and administration. HTMX enhances individual queries within the interface.
Cost and limits
Operations share the backend. Each modifying view or endpoint needs to enforce its own permissions.
In plain terms
The part record and its movements are available in the same application.

Applying a movement in one transaction

Benefit
Stock and movement state are written together. The injected write failure reverted the change in the tested scenario.
Cost and limits
The database engine determines contention. In SQLite, two overlapping withdrawals produced one application and one lock error. A stale instance could also apply a movement again.
In plain terms
A write failure can roll back the change. Simultaneous operations and repeated requests have different limits.

QR labels and alerts through signals

Benefit
Saving a component can generate its label and check whether its stock triggers an alert.
Cost and limits
Label generation can fail while the component remains saved with its QR pending.
In plain terms
The alert indicates when to review replenishment. A part can appear in the catalog while its label is still missing.

Materials linked to a work order

Benefit
Material consumption is linked to the job and creates a dispatch movement.
Cost and limits
In the tested case, saving the consumption again deducted the materials a second time.
In plain terms
The order shows which material was used. Editing its consumption requires fixing the repeated deduction.

Security and access control

Implemented: Django authentication, PBKDF2 password hashing, HttpOnly session cookies, CSRF middleware and HTTPS configuration controls. Checked locally: redirecting visitors without sessions, rejecting POST without CSRF and access with a synthetic account.

Role separation in the general interface did not pass validation. Groups and administration permissions do not establish enforcement in every view. This is shared inventory and is not presented as tenant isolation.

Rate limiting exists and a clean-cache test observed the expected block; original cases share cache state and one additional run varied across limiter windows. Overall abuse resistance was not established. Local settings retain five deployment warnings; production was not audited. Operational routes, secrets and workshop records are not published.

Testing and validation scope

The isolated copy used Python 3.12.10, Django 5.0.1 and SQLite 3.49.1 in a file. Django checks, static asset preparation and migrations passed. A browser signed in with a fictional account, confirmed a dispatch and opened the component on mobile and desktop. Stock went from ten to two and an alert was active.

The original suite ran 37 cases and recorded 32 passes, four rate-limit failures and one form error with a missing price. The 15 additional checks recorded nine passes and six failures. These included a read-only account performing a modification, a stale instance applying a movement again, a missing opening record, a quantity exported as text in Excel, repeated work-order consumption and SQLite locking.

The HTTP client with CSRF enforcement passed component creation and stock receipt. The injected write failure also rolled back in the tested case. The engine and behavior of the operational installation remain separate checks.

Observed results; passing checks and unresolved expectations
Verification / CheckResultScope & Evidence
Original suite32/37 · 4 failures and 1 errorStatic assets prepared. Shared cache in limiter tests; missing-price form error.
Additional tests9/15 · 6 failuresReal modules: HTTP workflow, domain, access controls, integrity, concurrency and files.
Create, receive and dispatchPassed locallyCreation and receipt with CSRF enforced. Browser dispatch from 10 → 2 with an active alert, all using fictional data.
Withdrawal, transfer, adjustmentPassed locallyBalances and location checked; alerts created and resolved.
Partial failuresRollback verifiedInjected save failure. Simulated QR failure: component retained without label.
SQLite concurrencyContention reproduced2 overlapping withdrawals: 1 applied, 1 lock error. PostgreSQL not run.
Integrity and permissionsReinforcement neededRole isolation, stale-state resend, consumption re-save and opening history checks failed.
ExportsPartial resultCSV retains code and quantity; PDF generated with valid header. Excel retains values as text: numeric assertion failed.
Configuration and startupCompleted locallyDjango check, static assets, migrations and startup with file-backed SQLite.

Deployment and environment

The author reports that the system is operational in the 3DFAB workshop. The guide describes Gunicorn, WhiteNoise, a proxy, HTTPS, PostgreSQL and backups as deployment options.

The lab prepared static assets and started Django on loopback with synthetic SQLite. A browser checked sign-in, dispatch confirmation and component lookup. The operational installation needs its own configuration and recovery checks.

Outcome and current status

I developed an application for finding parts, recording movements, raising alerts and tracking material consumption. The author reports operational use. The lab found a component, applied a dispatch and checked its remaining stock and alert.

The documented outcome is the ability to look up and move stock. Time savings, agreement with the physical inventory and availability of the installation require their own measurements.

Evidence and limits

Models, forms, views, signals and exports were inspected. Local evidence includes both suites, startup and the browser journey with fictional records. Write and QR generation failures were injected to observe the resulting state. Contention used real SQLite connections.

End-to-end development and operational use are attributed to the author. The installation engine, PostgreSQL, physical QR scanning, inbox delivery and backup restoration remain separate checks.

Synthetic database checks

The database was created exclusively with synthetic data. The workshop database was not opened. Balances, movement states, alerts and recovery effects were checked. Direct creation with positive stock lacks automatic opening history; this result is not extrapolated to real records.

Concurrency and repeated operations

Two real SQLite connections overlapped reads of the same component before writing. Final stock was consistent in that scenario, but the second operation received a lock error. This does not measure maximum capacity or simulate PostgreSQL. Resend and repeated-consumption tests found separate limits.

Software quality and workshop UX

The catalog and forms bring together workshop operations; messages, pending states and alerts help staff interpret what was recorded. Search and pagination bound the displayed volume; select_related reduces repeated queries in lists.

Software quality means checking inventory rules and their failures, not accumulating passing tests. Review adds resend, concurrency, rollback and export scenarios missing from the happy path.

Product UX depends on external resources for styling and interaction; full offline operation was not established. This case study offers an index, project navigation, readable diagram and mobile code wrapping. No accessibility score or benchmark is claimed.

Code sample and engineering test

Public, standalone adaptation of a withdrawal rule: validate quantity, reject overdraft and calculate whether the threshold is reached. Requires Python 3 and its standard library only. Both displayed blocks were concatenated and executed exactly. It imports no reserved code and does not replace the system’s real transactions.

Python
def plan_dispatch(stock, quantity, minimum):
"""Pure stock rule: no database, network or reserved code."""
values = (stock, quantity, minimum)
if any(type(value) is not int for value in values):
raise ValueError("Integer values required")
if stock < 0 or minimum < 0 or quantity <= 0:
raise ValueError("Invalid stock or quantity")
if quantity > stock:
raise ValueError("Insufficient stock")
remaining = stock - quantity
return remaining, remaining <= minimum

Isolated engineering test

Python
import unittest
class StockRuleTest(unittest.TestCase):
def test_dispatch_and_threshold(self):
self.assertEqual(plan_dispatch(10, 8, 3), (2, True))
def test_threshold_boundary(self):
self.assertEqual(plan_dispatch(10, 7, 3), (3, True))
def test_above_threshold(self):
self.assertEqual(plan_dispatch(10, 2, 3), (8, False))
def test_exact_stock(self):
self.assertEqual(plan_dispatch(10, 10, 0), (0, True))
def test_reject_invalid_inputs(self):
for values in [(10, 11, 3), (10, 0, 3), (-1, 1, 0),
(10, 1, -1), (10, True, 3), (10, 1.5, 3)]:
with self.subTest(values=values):
with self.assertRaises(ValueError):
plan_dispatch(*values)
unittest.main()

5 tests passed; the invalid-input test includes 6 subcases. This checks the pure rule only: it does not establish concurrency, permissions, persistence or production operation.