react-seller

Web environment to register products, sell products, and handler the stock of the products. ReactJS

View on GitHub

React Seller

An inventory and sales management dashboard built with React 19, TypeScript, and Vite.

Architecture

react-seller/
├── client/                   # React 19 frontend (Vite + TypeScript)
│   └── src/
│       ├── app/              # App shell (layouts, providers, router)
│       ├── components/       # Reusable UI and shared components
│       ├── features/         # Feature-based modules
│       │   ├── auth/         # Authentication
│       │   ├── dashboard/    # Overview page
│       │   ├── products/     # Product CRUD
│       │   ├── customers/    # Customer CRUD
│       │   ├── vendors/      # Vendor CRUD
│       │   └── sales/        # Orders and cart management
│       ├── hooks/            # Global hooks (auth, theme, toast)
│       ├── lib/              # Utility functions
│       ├── services/api/     # Axios client with interceptors
│       └── types/            # Shared TypeScript types
├── server/                   # LoopBack 4 API
│   └── src/
│       ├── controllers/      # REST API controllers
│       ├── datasources/      # Memory datasource
│       ├── models/           # Entity models
│       ├── repositories/     # Data access layer
│       └── migrate.ts        # Seed data script
└── docs/                     # Documentation

Tech Stack

Frontend

Backend

Prerequisites

Development Setup

# Clone the repository
git clone https://github.com/kapit4n/react-seller.git
cd react-seller

# Start the API server (port 3000)
cd server
npm install
npm run build
npm run migrate   # Seed sample data
npm start

# In a new terminal, start the client (port 3001)
cd client
npm install
npm run dev

The client proxies /api requests to the server at http://localhost:3000.

Available Scripts

Client

| Command | Description | |—|—| | npm run dev | Start dev server (port 3001) | | npm run build | TypeScript check + Vite production build | | npm run preview | Preview production build |

Server

| Command | Description | |—|—| | npm run build | Compile TypeScript | | npm start | Start server (port 3000) | | npm run migrate | Seed database with sample data |

Features

API Endpoints

All endpoints are under /api and proxied to http://localhost:3000.

Method Endpoint Description
GET/POST/PUT/DELETE /api/products Product CRUD
GET/POST/PUT/DELETE /api/customers Customer CRUD
GET/POST/PUT/DELETE /api/vendors Vendor CRUD
GET/POST/PUT/DELETE /api/orders Order CRUD
GET/POST/PUT/DELETE /api/orderDetails Order detail CRUD

Filtering

Supports legacy bracket notation and JSON string filters:

GET /api/products?filter[where][code]=ABC
GET /api/products?filter={"where":{"code":"ABC"}}
GET /api/products?filter={"include":[{"relation":"orderDetails"}]}

Architectural Decisions

Contributing

  1. Create a feature branch from develop
  2. Make changes with logically grouped commits
  3. Verify the build: npm run build
  4. Open a pull request