How huzaifajh/stock-manager works
Project type and purpose
• Stock Manager is a full-stack inventory and stock management solution that can run both as a web application (Next.js SSR/SSG) and as a desktop application (Electron).
• The frontend and backend are consolidated in a single Next.js codebase: React components under src/app and RESTful API routes under src/app/api. The persistence layer uses MySQL accessed via Sequelize (src/lib/sequelize.ts and src/lib/models).
File structure
• Top-level “main.js” and “preload.js” are your Electron entry points (main and renderer IPC bridge). “printService.js” likely encapsulates native printing logic.
• “next.config.ts”, “package.json” and “npm scripts” drive the Next.js build and development servers, as well as the Electron packaging.
• src/app/layout.tsx, globals.css and tailwind.config.ts define the global UI shell and theming. src/app contains two main areas:
• src/app/POS – point-of-sale pages.
• src/app/accounts – accounting reports pages.
• src/app/api – REST endpoints for CRUD operations (categories, products, sales, purchases, reports, etc.).
• src/lib/models + src/lib/sequelize.ts define your domain model and database schema mappings.
README for additional insights
• The README confirms MySQL as the database, Next.js for web, Electron for desktop builds, and highlights environment variables for DB credentials and API URL.
Detail
• Every major feature area (POS, Accounts, Settings) as sub-components of the React UI.
• Do not omit the build and packaging steps: illustrate how npm scripts transform the Next.js code into both a web service and an Electron installer.