Package Exports
- inflow-get
- inflow-get/schema
Readme
inflow-get
SQLite database seeded from the Inflow Inventory API. Uses inflow-api-types for schema validation.
Setup
npm installDatabase Setup
Generate and run migrations:
npm run db:generate
npm run db:migrateSeed from Inflow API
INFLOW_API_KEY=your-api-key INFLOW_COMPANY_ID=your-company-id npm run seedThis will:
- Fetch all data from your Inflow account
- Validate responses using Zod schemas
- Insert into SQLite at
./data/inflow.db
Seed Individual Entities
npm run seed:reference # Categories, locations, currencies, etc.
npm run seed:products # Products with prices, inventory, BOM
npm run seed:vendors # Vendors with vendor items
npm run seed:customers # Customers
npm run seed:orders # PO, SO, MOBrowse Data
npm run db:studioOpens Drizzle Studio to browse the SQLite database.
Use as a Library
import { db, products, salesOrders } from 'inflow-get';
// Query products
const allProducts = db.select().from(products).all();
// Query with joins
const ordersWithCustomers = db
.select()
.from(salesOrders)
.leftJoin(customers, eq(salesOrders.customerId, customers.customerId))
.all();Schema
Tables match the Inflow API structure (normalized):
Reference:
categories,locations,currencies,pricing_schemespayment_terms,tax_codes,taxing_schemesoperation_types,adjustment_reasons,team_members
Core:
products+product_prices,product_barcodes,inventory_lines,item_boms,product_operations,reorder_settingsvendors+vendor_itemscustomers
Orders:
purchase_orders+purchase_order_linessales_orders+sales_order_linesmanufacturing_orders
Transactions:
stock_transfers+stock_transfer_linesstock_adjustments+stock_adjustment_linesproduct_cost_adjustments+product_cost_adjustment_lines