How doubleghosty/resellos works
Purpose and deployment shape
ResellOS is a SaaS for managing and automating resale marketplace operations: inventory, analytics, AI listings, account controls, pricing/relisting, and AI negotiation. It consists of a Next.js web application intended for Vercel and a separate persistent Node.js worker for 24/7 marketplace automation. Core entry points are src/app/page.tsx, src/app/dashboard/page.tsx, src/proxy.ts, and worker/src/index.ts.
Web application and access boundary
The Next.js 16 App Router application serves a public marketing site plus authenticated dashboard routes. Supabase Auth session handling and dashboard protection are enforced at the request boundary in src/proxy.ts; application layouts divide public and dashboard UI in src/app/layout.tsx and src/app/dashboard/layout.tsx. Authentication screens live at src/app/login/page.tsx and src/app/signup/page.tsx.
Dashboard operational surface
The dashboard is the human control plane for connected marketplace accounts, inventory, listings, automation state, messages, AI generation, and settings. Main route boundaries are src/app/dashboard/accounts/page.tsx, src/app/dashboard/inventory/page.tsx, src/app/dashboard/automation/page.tsx, src/app/dashboard/ai-studio/page.tsx, and src/app/dashboard/messages/page.tsx. Server actions for account and inventory mutations are colocated in src/app/dashboard/accounts/actions.ts and src/app/dashboard/inventory/actions.ts.
Data platform and tenant security
Supabase provides Postgres, Auth, and RLS-backed multi-user persistence. Schema evolution is defined in supabase/migrations/0001_init.sql, supabase/migrations/0002_stripe.sql, and supabase/migrations/0003_listings_sync.sql. The app uses distinct browser, server, admin, and middleware/proxy Supabase clients under src/lib/supabase/, creating a boundary between user-scoped operations and privileged backend/worker access.
Marketplace account connection and synchronization
Users connect accounts through src/app/api/accounts/connect/route.ts and request inventory/listing synchronization through src/app/api/accounts/resync/route.ts. Marketplace session material is encrypted before database storage by src/lib/crypto.ts; the worker uses compatible cryptography in worker/src/crypto.ts. Both deployments must share SESSION_ENCRYPTION_KEY. The worker then decrypts credentials only when operating the account.
AI and commercial APIs
Listing generation is exposed through src/app/api/generate-listing/route.ts and implemented with Anthropic/Claude integration in src/lib/ai.ts. Billing is Stripe-based: checkout, customer portal, and signed webhook intake are at src/app/api/billing/checkout/route.ts, src/app/api/billing/portal/route.ts, and src/app/api/billing/webhook/route.ts, supported by src/lib/stripe.ts. Stripe subscription state is persisted through the Supabase schema.
Persistent automation worker
worker/src/index.ts is an independent Node runtime that polls/coordinates automation against Supabase. Its core stages are relisting, scheduled pricing, and AI-supported negotiation in worker/src/engine/relist.ts, worker/src/engine/pricing.ts, and worker/src/engine/negotiation.ts. worker/src/store.ts is its persistence interface; worker/src/rate-limiter.ts and worker/src/config.ts constrain runtime behavior and configuration.
External marketplace boundary
Vinted integration is isolated behind adapters at worker/src/adapters/vinted.ts and worker/src/adapters/vinted-http.ts. This boundary converts worker intents into authenticated Vinted HTTP operations, including account-driven automation and synchronization. It deliberately does not evade DataDome or other anti-bot controls; failures such as 403 responses remain an expected operational risk rather than a hidden infrastructure concern.
Main entry points: 0001_init.sql Supabase · page.tsx Dashboard shell · actions.ts Accounts & inventory · route.ts Account APIs
Components 19
Next.js web app
Vercel-oriented public site and authenticated control plane.
- Marketing site
src/app/page.tsx - Auth proxy · Maintains Supabase sessions and protects dashboard requests.
src/proxy.ts - Dashboard shell · Human operations surface for accounts, inventory, automation, AI, and messages.
src/app/dashboard/page.tsx - Dashboard layout
src/app/dashboard/layout.tsx - Accounts & inventory · Connects accounts and manages inventory mutations.
src/app/dashboard/accounts/actions.ts - Automation, AI & messages
src/app/dashboard/automation/page.tsx - Account APIs · Connect and resync requests enter here.
src/app/api/accounts/connect/route.ts - Listing generation API
src/app/api/generate-listing/route.ts - Stripe billing APIs · Checkout, portal, and signed webhook intake.
src/app/api/billing/webhook/route.ts
Supabase platform
Auth, Postgres, and RLS-backed tenant persistence.
- Supabase · Tenant-scoped persistence and subscription state.
supabase/migrations/0001_init.sql - Session encryption · Encrypts marketplace sessions at rest; deployments share one key.
src/lib/crypto.ts
Automation worker
Persistent Node.js runtime for marketplace operations.
- Worker coordinator · Polls Supabase and coordinates account automation.
worker/src/index.ts - Worker store
worker/src/store.ts - Relist, pricing & negotiation · Runs relisting, scheduled pricing, and AI-supported negotiation.
worker/src/engine/relist.ts - Worker session crypto · Decrypts account credentials only during operation.
worker/src/crypto.ts - Vinted adapter · Translates worker intents to authenticated marketplace HTTP calls.
worker/src/adapters/vinted.ts
Other components
- Anthropic Claude
- Stripe
- Vinted · 403 and anti-bot failures are an expected operational risk.
Connections 20
- Auth proxy → Dashboard layout: authorizes
- Dashboard layout → Dashboard shell: hosts
- Dashboard shell → Accounts & inventory: operates
- Dashboard shell → Automation, AI & messages: operates
- Accounts & inventory → Account APIs: connects / resyncs
- Accounts & inventory → Supabase: user-scoped data
- Automation, AI & messages → Listing generation API: generates listings
- Listing generation API → Anthropic Claude: prompts
- Listing generation API → Supabase: stores results
- Account APIs → Session encryption: encrypts sessions
- Session encryption → Supabase: stores encrypted material
- Stripe billing APIs → Stripe: checkout / webhooks
- Stripe billing APIs → Supabase: persists subscriptions
- Worker coordinator → Worker store: reads and writes
- Worker store → Supabase: privileged persistence
- Worker coordinator → Relist, pricing & negotiation: schedules
- Relist, pricing & negotiation → Worker session crypto: requires credentials
- Worker session crypto → Vinted adapter: authenticated intents
- Vinted adapter → Vinted: HTTP operations
- Account APIs → Worker coordinator: sync work becomes available