Skip to main content
Real-time Commerce

The Cart that Never Forgets

Eliminate database contention on launch day. Use Rivet Actors to hold shopping carts, reserve inventory, and power agentic search sessions across devices.

shopping_cart.ts
1import { actor } from "rivetkit";
2
3export const shoppingCart = actor({
4 state: { items: [], history: [] },
5
6 actions: {
7 // Instant recommendations based on hot state
8 recommend: async (c) => {
9 const recent = c.state.history.slice(-5);
10 return await c.ai.recommend(recent);
11 },
12
13 addItem: async (c, { productId, qty }) => {
14 const stock = await c.rpc.inventory.reserve(productId, qty);
15 if (!stock) throw "Out of Stock";
16
17 c.state.items.push({ productId, qty });
18 c.broadcast("cart_updated", c.state);
19 }
20 }
21});

The Universal Session

Stop syncing database rows to keep devices in sync. With Rivet, the Actor is the session. All devices connect to the same living process.

Mobile App
+1 Sneakers
Cart Actor
1 Item • $120
Web Store
Synced

Built for Conversion

Speed is revenue. Rivet makes your store feel instant.

Inventory Reservation

Hold items in the actor's memory for 10 minutes. If the user doesn't checkout, release stock instantly.

Universal Cart

The same cart state follows the user from mobile to desktop to tablet. No refresh required.

Agentic Search

Use the actor's session history to feed a vector search instantly, re-ranking results based on user intent.

Live Recommendations

Update suggested products in real-time as the user scrolls, based on their immediate view history held in RAM.

Flash Sales

Handle huge spikes in traffic. 100k users can add to cart simultaneously without locking your database.

Collaborative Shopping

Allow multiple users to view and edit the same cart (e.g. families or procurement teams).

Case Study

High-Volume Drop

A streetwear brand launching a limited edition collection. 50,000 users arrive in 60 seconds.

  • No Overselling: Atomic decrement of inventory in memory
  • Queueing: Fair FIFO processing of checkout requests
  • Instant Feedback: UI updates immediately on success/fail
Item: Retro High '85
Stock: 42 / 5000
Selling Fast
User: guest_9921Checkout Success
User: guest_4402Cart Expired
Inventory Load: 98%

Commerce at Scale

Marketplaces

Coordinate buyers and sellers in real-time auctions with instant bid updates.

Ticketing

Reserve seats for concerts or events. Prevent double-booking with atomic locks.

Food Delivery

Track order status, driver location, and inventory in a single stateful entity.

Subscription Apps

Manage access rights and feature gating dynamically based on payment status.

Works with your stack

Shopify
Stripe
Medusa
BigCommerce
Adyen
Algolia

Sell without limits

Build shopping experiences that are fast, reliable, and instantly synchronized.