InvenTrack is a comprehensive inventory management system built with Next.js 14, designed to help businesses efficiently track and manage their inventory, suppliers, and orders. The application features a responsive design that works seamlessly across desktop and mobile devices.
- Key Features
- Tech Stack
- Architecture
- State Management
- Core Features
- Security
- Development Guide
- Mobile Support
- Future Roadmap
- π Real-time inventory tracking and management
- πͺ Comprehensive product and supplier management
- π± Responsive design with mobile-first approach
- π Advanced reporting and analytics
- π POS system integration capabilities
- π Secure JWT-based authentication system
- π Real-time stock updates and notifications
- π± Progressive Web App (PWA) support (planned)
- Framework: Next.js 14.2.7
- State Management: Zustand with persistence
- Styling: Tailwind CSS + Material-UI (MUI)
- Authentication: Custom JWT with HTTP-only cookies
- API Client: Axios with interceptors
- Form Management: React Hook Form
- Database: Supabase
- Code Quality: ESLint, Prettier
- Testing: Jest, React Testing Library
- Build Tool: Next.js built-in bundler
- Package Manager: npm/yarn
frontend/
βββ app/ # Next.js 14 app directory
β βββ (auth)/ # Authentication routes
β βββ dashboard/ # Dashboard views
β βββ inventory/ # Inventory management
β βββ suppliers/ # Supplier management
β βββ orders/ # Order processing
β βββ reports/ # Analytics & reporting
βββ components/ # Reusable components
β βββ ui/ # Base UI components
β βββ forms/ # Form components
β βββ layouts/ # Layout components
βββ stores/ # Zustand state stores
βββ utils/ # Utilities and hooks
βββ context/ # React Context providers
// Authentication Flow
interface AuthFlow {
login: {
input: { email: string; password: string };
output: { token: string; user: User };
storage: "http-only cookie";
};
validation: {
middleware: "JWT verification";
protection: "RouteGuard component";
};
}// Store Structure
interface StoreStructure {
products: ProductStore; // Product management
suppliers: SupplierStore; // Supplier management
profile: ProfileStore; // User profile & settings
ui: UIStore; // UI state (modals, alerts)
}// Example Product Store
const useProductStore = create(
persist(
(set, get) => ({
products: [],
loading: false,
error: null,
filters: {
category: null,
search: "",
status: "all",
},
actions: {
setProducts: (products) => set({ products }),
updateFilters: (filters) =>
set({ filters: { ...get().filters, ...filters } }),
loadProducts: async () => {
set({ loading: true });
try {
const data = await fetchProducts();
set({ products: data, error: null });
} catch (error) {
set({ error: error.message });
} finally {
set({ loading: false });
}
},
},
}),
{
name: "product-storage",
storage: createJSONStorage(() => localStorage),
}
)
);// Product Management Hook
export function useProduct() {
const { authState } = useAuth();
const store = useProductStore();
useEffect(() => {
if (authState.isAuthenticated && !store.loading) {
store.actions.loadProducts();
}
}, [authState.isAuthenticated]);
return {
...store,
// Additional computed properties
lowStockProducts: store.products.filter((p) => p.quantity <= p.minQuantity),
totalValue: store.products.reduce(
(sum, p) => sum + p.quantity * p.price,
0
),
};
}// Error Handling Structure
interface ErrorSystem {
types: typeof ERROR_TYPES;
handling: {
api: "Centralized API error processing";
ui: "Component-level error boundaries";
form: "Form-level validation errors";
};
display: {
toast: "Transient notifications";
modal: "Critical error dialogs";
inline: "Form validation messages";
};
}- Node.js (v18 or higher)
- npm or yarn
- Git
# Clone and install
git clone [repository-url]
cd inventracker
npm install
# Environment setup
cp .env.example .env.local
# Edit .env.local with your configuration
# Development
npm run dev # Start development server
npm run lint # Run ESLint
npm run test # Run tests
npm run build # Production build# Required environment variables
NEXT_PUBLIC_API_URL=your_api_url
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_key
NEXT_PUBLIC_APP_ENV=development
# Optional features
NEXT_PUBLIC_ENABLE_ANALYTICS=false
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn- Authentication: JWT with HTTP-only cookies
- Route Protection: Server-side middleware & client-side guards
- Data Safety: Input validation & sanitization
- API Security: CORS, rate limiting, request validation
- Frontend Security: XSS protection, CSP headers