Phase A implements the foundational inventory tracking system with barcode scanning, SKU management, and stock movements.
http://localhost:8000
GET /
Returns API status information.
Response:
{
"message": "Warehouse Neuron API",
"status": "running"
}GET /health
Returns service health status.
Response:
{
"status": "healthy"
}POST /api/v1/stock/intake
Process a stock intake event from barcode scanning.
Request Body:
{
"barcode": "1234567890123",
"qty": 1,
"location_code": "A-01-B",
"movement_type": "IN",
"auto_create_sku": true,
"created_by": "john.doe@example.com"
}Request Fields:
barcode(string, required): The scanned barcodeqty(integer, optional): Quantity to add (default: 1)location_code(string, optional): Location code for the stockmovement_type(string, optional): Type of movement (default: "IN")auto_create_sku(boolean, optional): Auto-create SKU if not found (default: false)created_by(string, optional): User who performed the action
Response (Success - 200):
{
"movement_id": "123e4567-e89b-12d3-a456-426614174000",
"sku_id": "123e4567-e89b-12d3-a456-426614174001",
"sku_code": "1234567890123",
"on_hand": 5
}Response (Error - 404):
{
"detail": "SKU not found for barcode. Set auto_create_sku to true to create a new SKU."
}FastAPI provides automatic interactive documentation:
http://localhost:8000/docs
- Interactive interface to test all endpoints
- See request/response schemas
- Execute API calls directly from browser
http://localhost:8000/redoc
- Clean, professional documentation view
- Better for reading and understanding API structure
Download from: https://dbeaver.io/download/
- Open DBeaver
- Click Database → New Database Connection
- Select PostgreSQL
- Click Next
Connection Settings:
Host: localhost
Port: 5434
Database: warehouse_neuron
Username: wn_user
Password: wn_pass
Connection Details:
- Connection Name: Warehouse Neuron
- Connect at startup: ✓ (optional)
- Click Test Connection
- If successful, click Finish
- Expand the connection in the Database Navigator
Tables to explore:
locations- Warehouse locationsskus- Stock Keeping Unitssku_barcodes- Barcode mappingsstock_ledger- Current inventory levelsstock_movements- All stock transactions
Sample Queries:
-- View all SKUs
SELECT * FROM skus ORDER BY created_at DESC LIMIT 10;
-- View current stock levels
SELECT
s.sku_code,
l.code as location,
sl.on_hand,
sl.reserved
FROM stock_ledger sl
JOIN skus s ON sl.sku_id = s.id
LEFT JOIN locations l ON sl.location_id = l.id;
-- View recent stock movements
SELECT
sm.created_at,
s.sku_code,
l.code as location,
sm.qty,
sm.movement_type,
sm.created_by
FROM stock_movements sm
JOIN skus s ON sm.sku_id = s.id
LEFT JOIN locations l ON sm.location_id = l.id
ORDER BY sm.created_at DESC
LIMIT 20;
-- Check barcode mappings
SELECT
sb.barcode,
s.sku_code,
s.title
FROM sku_barcodes sb
JOIN skus s ON sb.sku_id = s.id;Download from: https://www.postman.com/downloads/
- Open Postman
- Click New → Collection
- Name it "Warehouse Neuron API"
Request:
- Method:
GET - URL:
http://localhost:8000/health - Click Send
Expected Response:
{
"status": "healthy"
}Request:
- Method:
POST - URL:
http://localhost:8000/api/v1/stock/intake - Headers:
Content-Type: application/json
- Body (raw JSON):
{
"barcode": "TEST-001",
"qty": 10,
"location_code": "WH-A-01",
"movement_type": "IN",
"auto_create_sku": true,
"created_by": "test_user"
}Expected Response:
{
"movement_id": "uuid-here",
"sku_id": "uuid-here",
"sku_code": "TEST-001",
"on_hand": 10
}Request:
- Method:
POST - URL:
http://localhost:8000/api/v1/stock/intake - Body:
{
"barcode": "TEST-001",
"qty": 5,
"location_code": "WH-A-01",
"movement_type": "IN",
"created_by": "test_user"
}Expected Response:
{
"movement_id": "uuid-here",
"sku_id": "uuid-here",
"sku_code": "TEST-001",
"on_hand": 15
}Request:
- Method:
POST - URL:
http://localhost:8000/api/v1/stock/intake - Body:
{
"barcode": "UNKNOWN-001",
"qty": 5,
"auto_create_sku": false
}Expected Response (404 Error):
{
"detail": "SKU not found for barcode. Set auto_create_sku to true to create a new SKU."
}- Click Save on each request
- Organize requests in folders (e.g., "Health", "Stock Operations")
- Right-click collection
- Export
- Choose Collection v2.1
- Save as
warehouse-neuron-api.postman_collection.json
Step 1: Check API Health
curl http://localhost:8000/healthStep 2: Scan First Item (Auto-Create)
curl -X POST http://localhost:8000/api/v1/stock/intake \
-H "Content-Type: application/json" \
-d '{
"barcode": "8901234567890",
"qty": 50,
"location_code": "RECV-01",
"movement_type": "IN",
"auto_create_sku": true,
"created_by": "receiver@warehouse.com"
}'Step 3: Verify in Database (DBeaver)
SELECT * FROM skus WHERE sku_code = '8901234567890';
SELECT * FROM stock_movements ORDER BY created_at DESC LIMIT 1;
SELECT * FROM stock_ledger WHERE location_id = (
SELECT id FROM locations WHERE code = 'RECV-01'
);Step 4: Move to Main Warehouse
curl -X POST http://localhost:8000/api/v1/stock/intake \
-H "Content-Type: application/json" \
-d '{
"barcode": "8901234567890",
"qty": 50,
"location_code": "WH-A-05",
"movement_type": "TRANSFER",
"created_by": "warehouse@warehouse.com"
}'Step 5: Check Final Stock Levels
SELECT
s.sku_code,
l.code as location,
sl.on_hand,
sl.updated_at
FROM stock_ledger sl
JOIN skus s ON sl.sku_id = s.id
JOIN locations l ON sl.location_id = l.id
WHERE s.sku_code = '8901234567890';- URL:
http://localhost:3000(Phase A - Not yet implemented) - Features:
- View all SKUs
- Search inventory
- View stock movements
- Location management
Current Status: Backend API ready, Flutter web app pending.
- Platform: iOS & Android
- Features:
- Camera barcode scanning
- Quick stock intake
- Offline queue
- Real-time sync
Current Status: Backend API ready, Flutter app pending.
- Platform: Windows, macOS, Linux
- Features:
- Full dashboard functionality
- Bulk operations
- Advanced reporting
- USB barcode scanner support
Current Status: Backend API ready, Tauri wrapper pending.
docker exec -it warehouse-neuron_redis_1 redis-cliMONITOR
XLEN stock_events
XREAD COUNT 10 STREAMS stock_events 0
Check container status:
docker psCheck backend logs:
docker logs warehouse-neuron_backend_1Restart services:
docker compose restartVerify PostgreSQL is running:
docker ps | grep postgresCheck port availability:
netstat -tuln | grep 5434Test connection:
psql -h localhost -p 5434 -U wn_user -d warehouse_neuronPassword: wn_pass
Common causes:
auto_create_skuis set tofalse- Barcode already exists but mapped to different SKU
Solution:
{
"barcode": "your-barcode",
"auto_create_sku": true
}- Add pagination to list endpoints
- Add GET endpoints for SKUs and movements
- Add search/filter capabilities
- Add authentication
- Add comprehensive error handling
- Add request validation
- Add API rate limiting
- Run initial migration (0001_init.sql)
- Add indexes for performance
- Add database backup strategy
- Add audit logging
- Unit tests for CRUD operations
- Integration tests for API endpoints
- Load testing
- Security testing
- OpenAPI schema completion
- Deployment guide
- Development workflow guide
- Architecture documentation
- API Documentation: http://localhost:8000/docs
- GitHub Repository: https://github.com/timothynn/warehouse-neuron
- Issues: https://github.com/timothynn/warehouse-neuron/issues
Last Updated: November 8, 2025
Phase: A - Foundations (Backend Complete)