All Projects
AI AgentsBackend

E-commerce Recommendation Engine (n8n)

Production recommendation backend: n8n + PostgreSQL, 4 modes (trending/co-purchase/personalized/repurchase), 74 nodes, webhook API, daily scheduler. No custom server required.

4
Recommendation modes
74
n8n nodes
None
Server required
Automated
Daily cleanup
Dataset

Custom e-commerce order data via REST API

Approach

4-algorithm recommendation engine with upsert, daily scheduler, webhook API

Tech Stack
n8nPostgreSQLJavaScript (Code nodes)REST webhooks
Keywords
n8nPostgreSQLMarket BasketRecommendationWebhooksAutomation
Deep Dive

Production recommendation engine built entirely with n8n + PostgreSQL — no Python server, no ML infrastructure.

4 Recommendation Algorithms

ModeAlgorithmUse Case
TrendingMost purchased in rolling 7-day windowHomepage
Co-purchaseMarket basket analysis"Frequently bought with"
PersonalizedCustomer history → top unorderedReturning customers
RepurchasePreviously bought consumablesReplenishment emails

Architecture (74 nodes)

POST /import-orders → validate client → upsert to PostgreSQL
POST /generate-recs → fetch orders → run algorithms → upsert results
GET  /get-recs      → fetch by mode + client_id
GET  /customer-recs → personalized + repurchase merged
ScheduleTrigger (daily) → purge orders > 90 days

Market Basket SQL Pattern For each order pair (A,B) bought by same customer: increment co_purchase_count(A,B). Query returns items with highest count for current product.

Why n8n Over Python? Typical recommendation backends require: model serving, Python env, monitoring, retraining. This delivers 4 recommendation modes with pure SQL + webhooks, deployable in hours, maintainable without code.