Skip to content

Automation-driven dropshipping platform designed for sourcing Amazon products, syncing listings to eBay, handling price/stock monitoring, auto-ordering, and workflow orchestration.

Notifications You must be signed in to change notification settings

AutoBay/autobay-fe-be

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

632 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoBay

A comprehensive SaaS platform for automating eBay dropshipping operations with Amazon product sourcing, built with Next.js 15, Firebase, and Stripe.

Table of Contents

Overview

AutoBay is an eBay dropshipping automation platform that helps sellers:

  • Source products from Amazon and list them on eBay
  • Manage listings, orders, and pricing automatically
  • Track sales analytics and customer messages
  • Automate order fulfillment workflows

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                           Frontend (Next.js 15)                      │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐ │
│  │   Pages     │  │ Components  │  │   Hooks     │  │  Providers  │ │
│  │  (App Dir)  │  │  (UI/Shadcn)│  │  (Custom)   │  │  (Context)  │ │
│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘ │
│         │                │                │                │        │
│         └────────────────┴────────────────┴────────────────┘        │
│                                    │                                 │
│                          ┌─────────▼─────────┐                      │
│                          │   API Routes      │                      │
│                          │  (Next.js API)    │                      │
│                          └─────────┬─────────┘                      │
└────────────────────────────────────┼────────────────────────────────┘
                                     │
        ┌────────────────────────────┼────────────────────────────┐
        │                            │                            │
        ▼                            ▼                            ▼
┌───────────────┐          ┌───────────────┐          ┌───────────────┐
│   Firebase    │          │   eBay API    │          │  Stripe API   │
│  - Auth       │          │  - Buy API    │          │  - Payments   │
│  - Firestore  │          │  - Sell API   │          │  - Subscriptions│
│  - Functions  │          │  - Fulfillment│          │  - Webhooks   │
│  - DataConnect│          │  - Analytics  │          └───────────────┘
└───────────────┘          └───────────────┘
                                     │
                                     ▼
                           ┌───────────────┐
                           │  Amazon Web   │
                           │   Scraping    │
                           └───────────────┘

Data Flow

  1. User Authentication: Firebase Auth handles user registration/login
  2. eBay Integration: OAuth2 flow connects user's eBay seller account
  3. Product Sourcing: Web scraping fetches Amazon product data (ASIN lookup)
  4. Listing Management: Create/update eBay listings via Inventory API
  5. Order Processing: Track orders, handle fulfillment, manage disputes
  6. Payments: Stripe handles SaaS subscriptions and billing

Tech Stack

Category Technology
Framework Next.js 15 (App Router)
Language TypeScript
Styling Tailwind CSS 4, shadcn/ui
State Management TanStack Query, React Context
Authentication Firebase Auth
Database Firebase Firestore, Data Connect (PostgreSQL)
Payments Stripe
APIs eBay REST APIs (Buy, Sell, Fulfillment)
Forms React Hook Form + Zod
Charts Recharts
Animations Framer Motion
Package Manager pnpm

Project Structure

autobay-fe-be/
├── app/                          # Next.js App Router
│   ├── (pages)/                  # Page routes
│   │   ├── dev/                  # Main app pages
│   │   │   ├── auth/             # Authentication pages
│   │   │   ├── dashboard/        # Dashboard & features
│   │   │   ├── pricing/          # Pricing page
│   │   │   ├── blog/             # Blog pages
│   │   │   └── ...
│   │   ├── privacy-policy/
│   │   └── terms-of-service/
│   ├── api/                      # API routes
│   │   ├── auth/                 # Auth endpoints (Firebase, eBay OAuth)
│   │   ├── ebay/                 # eBay API integrations
│   │   │   ├── buy/              # Buy API (search)
│   │   │   ├── sell/             # Sell APIs (inventory, accounts)
│   │   │   ├── fulfillment/      # Order management (not shown)
│   │   │   └── shadow-trace/     # eBay scraping
│   │   ├── payments/             # Stripe integration
│   │   ├── amazon/               # Amazon scraping
│   │   └── contact-us/
│   ├── providers/                # React Context providers
│   │   ├── auth/                 # User & eBay auth providers
│   │   ├── payments/             # Stripe provider
│   │   ├── external/             # TanStack Query provider
│   │   └── ui/                   # Theme, Sidebar, Toaster
│   ├── styles/                   # Global CSS
│   └── layout.tsx                # Root layout
│
├── lib/                          # Core business logic
│   ├── client/                   # Client-side utilities
│   │   ├── services/             # API service functions
│   │   ├── configs/              # Firebase client config
│   │   ├── schemas/              # Zod validation schemas
│   │   ├── ebay-client-api/      # eBay API wrappers
│   │   └── client-endpoints.ts   # API endpoint definitions
│   ├── server/                   # Server-side utilities
│   │   ├── configs/              # Firebase Admin config
│   │   ├── ebay-server-api/      # Server eBay integrations
│   │   ├── web-scraping/         # Playwright scrapers
│   │   └── utils/                # Server utilities
│   ├── constants/                # App constants
│   ├── global-schemas/           # Shared Zod schemas
│   └── global-utils/             # Shared utilities
│
├── components/                   # React components
│   ├── ui/                       # shadcn/ui components (48+)
│   ├── custom-components/        # App-specific components
│   ├── data-table.tsx            # Advanced data table
│   └── chart-area-interactive.tsx
│
├── hooks/                        # Custom React hooks
│   ├── payments/                 # Stripe hooks
│   └── use-mobile.ts
│
├── types/                        # TypeScript types
│   ├── api/                      # API response types
│   ├── db/                       # Database types
│   ├── ebay/                     # eBay API types
│   └── ui/                       # UI component types
│
├── dataconnect/                  # Firebase Data Connect
│   ├── schema/                   # GraphQL schema
│   └── example/                  # Connector config
│
├── functions/                    # Firebase Cloud Functions
│   └── src/
│
├── mocks/                        # Mock data for development
├── public/                       # Static assets
└── bash-scripts/                 # Automation scripts

Features

Core Features

Feature Description
Product Finder Search Amazon products by ASIN, upload CSV of ASINs
Listings Management Create, edit, bulk update eBay listings
Order Management Track orders, fulfillment status, shipping
Automations Pricing rules, auto-replenishment, stock sync
Analytics & Reports Sales metrics, traffic reports, customer insights
Customer Messages Manage buyer communications
eBay Accounts Multi-account support, OAuth integration
Amazon Buying Accounts Manage supplier accounts

eBay API Integration

API Category Endpoints
Buy API Product search, image search
Sell - Inventory Items, offers, locations, item groups
Sell - Account Policies, KYC, store, subscriptions
Sell - Finance Payouts, transactions, transfers
Sell - Analytics Traffic reports, service metrics
Fulfillment Orders, shipping, disputes, refunds

Payments (Stripe)

  • Subscription plans management
  • Checkout sessions
  • Webhook handling (invoice, subscription, checkout)
  • Customer portal

Pages

Authentication

  • /auth/login - Email/password login
  • /auth/register - New user registration
  • /auth/forget-password - Password reset request
  • /auth/reset-password - Password reset form
  • /auth/login-with-phone-number - Phone authentication
  • /auth/ebay - eBay OAuth callback

Dashboard

  • /dashboard - Main dashboard overview
  • /dashboard/listings - Manage eBay listings
  • /dashboard/orders - Order management
  • /dashboard/orders/[id] - Order details
  • /dashboard/product-finder - Amazon product search
  • /dashboard/product-finder/[id] - Product details
  • /dashboard/upload-asins - Bulk ASIN upload
  • /dashboard/reports - Analytics & reports
  • /dashboard/shadow-trace - eBay product tracking
  • /dashboard/automations - Automation rules
  • /dashboard/customers-messages - Buyer messages
  • /dashboard/ebay-accounts - eBay account management
  • /dashboard/amazon-buying-accounts - Amazon accounts

Settings

  • /dashboard/settings - Settings overview
  • /dashboard/settings/user-profile - Profile management
  • /dashboard/settings/subscription - Plan management
  • /dashboard/settings/notifications - Notification preferences
  • /dashboard/settings/system-preferences - App settings
  • /dashboard/settings/amazon-supplier-settings - Supplier config

Other Pages

  • /pricing - Subscription plans
  • /blog - Blog listing
  • /blog/[id] - Blog post
  • /contact-us - Contact form
  • /help-center - Help documentation
  • /changelog - Product updates
  • /privacy-policy - Privacy policy
  • /terms-of-service - Terms of service
  • /checkout-complete - Payment success
  • /checkout-failed - Payment failure

API Routes

Authentication (/api/auth/)

Endpoint Method Description
/register POST Create new user
/settings PUT Update user profile
/forget-password POST Request password reset
/reset-password POST Reset password

eBay Auth (/api/auth/ebay/)

Endpoint Method Description
/consent-screen GET Redirect to eBay OAuth
/callback GET OAuth callback handler
/exchange-auth-code POST Exchange code for tokens
/get-client-credentials POST Get app-level token
/update-user-access-token-with-refresh-token POST Refresh user token

eBay APIs (/api/ebay/)

Category Key Endpoints
Buy /buy/search, /buy/search-by-img
Inventory /sell/listing-management/inventory/*
Account /sell/account-management/account-v1/*
Finance /sell/account-management/finance/*
Analytics /sell/analytics-and-reporting/*

Stripe (/api/payments/stripe/)

Endpoint Method Description
/create-checkout-session POST Create checkout
/create-subscription POST Create subscription
/get-subscriptions GET List subscriptions
/get-current-customer GET Get customer data
/webhooks/* POST Webhook handlers

Other

Endpoint Method Description
/amazon/web-scraping POST Scrape Amazon product
/amazon/upload-asins-csv POST Bulk ASIN upload
/ebay/shadow-trace POST eBay product scraping
/contact-us POST Contact form submission

Getting Started

Prerequisites

  • Node.js 20+
  • pnpm 10+
  • Firebase project with Firestore, Auth, Data Connect
  • eBay Developer account (sandbox/production)
  • Stripe account

Installation

# Clone repository
git clone <repo-url>
cd autobay-fe-be

# Install dependencies
pnpm install

# Get environment secrets (requires PowerShell on Windows)
pnpm get-secrets

# Or create .env manually with required variables

Environment Variables

Create a .env file with:

# Firebase
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=

# Firebase Admin
FIREBASE_ADMIN_PROJECT_ID=
FIREBASE_ADMIN_CLIENT_EMAIL=
FIREBASE_ADMIN_PRIVATE_KEY=

# eBay
NEXT_EBAY_ENV=sandbox # or production
EBAY_CLIENT_ID=
EBAY_CLIENT_SECRET=
EBAY_REDIRECT_URI=

# Stripe
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=

# App
NEXT_PUBLIC_NODE_ENV=development

Development

# Start dev server
pnpm dev

# Run linter/formatter
pnpm fix

# Check code health
pnpm doctor

# Build for production
pnpm build

# Start production server
pnpm start

Code Quality

  • Linting: Biome + ESLint
  • Formatting: Prettier with Tailwind plugin
  • Type Checking: TypeScript strict mode
  • Pre-commit: Husky hooks

Testing

# Run Playwright E2E tests
npx playwright test

Deployment

Docker

docker build -t autobay .
docker run -p 3000:3000 autobay

Firebase

# Deploy functions
firebase deploy --only functions

# Deploy hosting
firebase deploy --only hosting

AWS App Runner

The production backend runs on AWS App Runner at: https://mi23aibddp.eu-central-1.awsapprunner.com

Data Models (Firebase Data Connect)

type User {
  email: String!
  displayName: String!
  createdAt: Timestamp!
  photoUrl: String
}

type PlatformAccount {
  user: User!
  platform: String!
  platformUserId: String!
  accessToken: String
  refreshToken: String
}

type Product {
  user: User!
  title: String!
  amazonASIN: String!
  amazonPrice: Float
  category: String
}

type Listing {
  user: User!
  product: Product
  ebayItemID: String!
  title: String!
  price: Float!
  status: String!
}

type Order {
  user: User!
  listing: Listing
  ebayOrderID: String!
  totalPrice: Float!
  status: String!
}

type PricingRule {
  user: User!
  name: String!
  ruleType: String!
  percentageMarkup: Float
}

License

Private - All rights reserved

About

Automation-driven dropshipping platform designed for sourcing Amazon products, syncing listings to eBay, handling price/stock monitoring, auto-ordering, and workflow orchestration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •