A comprehensive SaaS platform for automating eBay dropshipping operations with Amazon product sourcing, built with Next.js 15, Firebase, and Stripe.
- Overview
- Architecture
- Tech Stack
- Project Structure
- Features
- Pages
- API Routes
- Getting Started
- Development
- Deployment
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
┌─────────────────────────────────────────────────────────────────────┐
│ 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 │
└───────────────┘
- User Authentication: Firebase Auth handles user registration/login
- eBay Integration: OAuth2 flow connects user's eBay seller account
- Product Sourcing: Web scraping fetches Amazon product data (ASIN lookup)
- Listing Management: Create/update eBay listings via Inventory API
- Order Processing: Track orders, handle fulfillment, manage disputes
- Payments: Stripe handles SaaS subscriptions and billing
| 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 |
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
| 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 |
| 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 |
- Subscription plans management
- Checkout sessions
- Webhook handling (invoice, subscription, checkout)
- Customer portal
/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- 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
/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
/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
| Endpoint | Method | Description |
|---|---|---|
/register |
POST | Create new user |
/settings |
PUT | Update user profile |
/forget-password |
POST | Request password reset |
/reset-password |
POST | Reset password |
| 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 |
| 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/* |
| 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 |
| 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 |
- Node.js 20+
- pnpm 10+
- Firebase project with Firestore, Auth, Data Connect
- eBay Developer account (sandbox/production)
- Stripe account
# 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 variablesCreate 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# 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- Linting: Biome + ESLint
- Formatting: Prettier with Tailwind plugin
- Type Checking: TypeScript strict mode
- Pre-commit: Husky hooks
# Run Playwright E2E tests
npx playwright testdocker build -t autobay .
docker run -p 3000:3000 autobay# Deploy functions
firebase deploy --only functions
# Deploy hosting
firebase deploy --only hostingThe production backend runs on AWS App Runner at:
https://mi23aibddp.eu-central-1.awsapprunner.com
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
}Private - All rights reserved