Modern React + TypeScript frontend for Shipfex Logistics Management System. Built with Vite, Tailwind CSS, and React Router.
- Node.js 18+
- npm or yarn
# 1. Install dependencies
npm install
# 2. Make sure backend is running (http://localhost:3000)
# 3. Start dev server
npm run dev✅ Expected output:
VITE v7.2.4 ready in XXX ms
➜ Local: http://localhost:5173/
Then open http://localhost:5173 in your browser.
- Email: admin@shipfex.com
- Password: admin123
Notes:
- The backend seeds this SUPERADMIN automatically in debug/dev runs.
- Override with
DEV_SUPERADMIN_EMAIL/DEV_SUPERADMIN_PASSWORD. - Disable with
DEV_SEED_SUPERADMIN=0.
npm run dev # Start dev server (port 5173)
npm run build # Build for production
npm run lint # Check code with ESLint
npm run preview # Preview production buildsrc/
├── main.tsx → React entry point
├── App.tsx → Router configuration
├── index.css → Global styles
├── App.css → App-specific styles
│
├── pages/
│ ├── Login.tsx → Authentication page
│ ├── Inventory.tsx → Product management
│ ├── Orders.tsx → Order management
│ └── Tracking.tsx → Order tracking
│
├── layouts/
│ └── DashboardLayout.tsx → Main layout with sidebar
│
├── components/
│ └── Sidebar.tsx → Navigation sidebar
│
└── services/
└── api.ts → Centralized API client
✨ Authentication
- Simple login/logout
- localStorage persistence
- Protected routes
📦 Inventory Management
- CRUD operations for products
- Inline stock editing
- SKU management
- Delete with cascade
📋 Order Management
- Create orders with stock validation
- Cancel orders with automatic stock refund
- Real-time order status
- Customer tracking
🎯 Tracking
- Dynamic order lookup by ID
- Order status visualization
- React 19: UI framework
- TypeScript: Type safety
- Vite 7: Fast build tool
- React Router 7: Client-side routing
- Tailwind CSS 3: Utility-first styling
- Lucide React: Icon library
- ESLint: Code quality
Create .env.local:
VITE_API_URL=http://localhost:3000
For production, update to your backend URL.
import { api } from '@/services/api';
// Products
const products = await api.getProducts();
await api.createProduct({ name, sku, stock });
await api.deleteProduct(id);
await api.updateStock(id, amount);
// Orders
const orders = await api.getOrders();
await api.createOrder({ customer, product_id, quantity });
await api.deleteOrder(id);try {
const result = await api.someAction();
} catch (err) {
const error = err as ApiError;
console.error(error.message);
}Uses Tailwind CSS utilities. Key classes:
container mx-auto p-4→ Centered contentbg-blue-500 text-white→ Colorsflex justify-between items-center→ Layouthover:bg-blue-600 transition→ Interactions
"Failed to fetch from backend" → Make sure backend is running on http://localhost:3000
"Module not found"
→ Run npm install and restart dev server
"Types not working correctly"
→ Run npm run lint to check TypeScript errors
".env.local not being read"
→ Restart dev server after creating/modifying .env.local
- Components are code-split by route (automatic with Vite)
- Use lazy loading for images
- Memoize expensive computations with
useMemo - Debounce API calls if needed
- Create component in pages/ or components/
- Add types at the top of component file
- Use API service from services/api.ts
- Style with Tailwind CSS
- Test in browser with devtools
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
Install Chrome extension: React Developer Tools
- Open DevTools (F12)
- Go to Network tab
- Make API calls to see requests/responses
// In console
localStorage.getItem('isAuthenticated')
localStorage.removeItem('isAuthenticated')npm run build # Creates dist/ folder
npm run preview # Test production build locallyVITE_API_URL=https://your-api.comThen deploy dist/ folder to any static hosting (Vercel, Netlify, etc).
- Follow the existing code style
- Run
npm run lintbefore committing - Update types when changing data structures
- Test all features in browser
MIT
Built with ❤️ in React + TypeScript
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])