SGVS UI is a modern, responsive frontend application built with React 19, TypeScript, and Vite that provides a "CEO experience" for small and medium-sized business managers. With an intuitive interface, real-time analytics, and intelligent workflows, the platform transforms raw sales and inventory data into actionable business insights. Features dark/light theme support, full internationalization (English/Portuguese), and accessible components.
Here's a screenshot of the main dashboard showing sales metrics and quick product access:
Features visible:
β
Real-time sales metrics (revenue, profit, orders)
β
Visual charts with sales trends
β
Quick-access inventory status
β
Dark/Light theme toggle
Sales form with autocomplete and inventory control:
Features visible:
β
Intelligent product/customer autocomplete
β
Real-time margin calculations
β
Inventory updates on sale completion
β
Discount management per item
- React 19 β Modern UI library with hooks and concurrent features
- TypeScript β Static typing for safer code
- Vite β Lightning-fast build tool and dev server
- React Router v7 β Client-side routing and navigation
- TailwindCSS 3.4.17 β Utility-first CSS framework
- Class Variance Authority (CVA) β Type-safe component variants
- Headless UI β Unstyled, accessible components
- Lucide React β Modern icon library
- React Icons β Additional icon sets
- React Context API β Global state (Auth, Theme, Settings)
- Axios β HTTP client for API communication
- JWT Decode β Token parsing for authentication
- i18next + react-i18next β Multi-language support (EN/PT-BR)
- react-hot-toast β Toast notifications
- date-fns β Date formatting and manipulation
- Recharts β React charting library for analytics
- ESLint β Code linting
- Prettier β Code formatting
- TypeScript Compiler β Type checking
- Vite HMR β Hot module replacement
- β Real-time sales metrics and KPIs
- β Visual charts (line, bar, pie) with sales trends
- β Profit margin overview
- β Low stock alerts
- β Product ABC curve analysis
- β Full CRUD with drag-to-copy functionality
- β Real-time profit margin calculations
- β Stock level tracking and alerts
- β Category organization
- β Advanced filtering and sorting
- β Product details drawer
- β Complete customer database
- β Contact details and purchase history
- β Customer filtering and search
- β Confirmation modals for critical actions
- β Generic customer support
- β Fast sales creation with autocomplete
- β Multi-item cart system
- β Real-time subtotal and margin calculations
- β Per-item discount control
- β Automatic inventory updates
- β Sales history and filtering
- β Operational expense recording
- β Restocking expenses with inventory sync
- β Expense categorization
- β Historical reports and analytics
- β Light/Dark theme toggle with persistence
- β Full English/Portuguese support
- β Responsive design (mobile, tablet, desktop)
- β Global toast notification system
- β Confirmation dialogs for destructive actions
- β Loading states and error handling
- β Keyboard navigation & shortcuts
- β Secure login/register
- β Google OAuth integration
- β JWT token management
- β Protected routes
- β Session persistence
We started by creating a component library with CVA (Class Variance Authority) to ensure consistency across all UI elements. This was crucial because consistency directly impacts user trust.
Building the Sales form was the most complex task β it required:
- Real-time autocomplete β Searching products and customers with debouncing to avoid excessive API calls.
- Reactive form state β When you add/remove items, the totals must update instantly. Solution: managed state with proper dependency arrays.
- Theme management β Toggling dark mode at the application level without flickering. Solution: Context API + localStorage for persistence.
- Internationalization complexity β 50+ translation keys across different sections. Solution: structured i18n files + namespace organization.
This project deeply expanded my understanding of:
- React Performance: Not every state update needs the entire app to re-render. I learned about React.memo, useCallback, and proper Context API segmentation.
- Component Design Philosophy: Building truly reusable components is HARD. CVA helped enforce constraints while maintaining flexibility.
- Accessibility (a11y): Headless UI taught me that accessible components aren't an afterthought β they're fundamental to good UX.
- Form State Management: Managing form complexity in React without a library (like React Hook Form) revealed why those libraries exist.
- Type Safety with TypeScript: Strong typing caught bugs at compile-time that would've only surfaced in production. Especially critical for API response handling.
- Global State Pitfalls: Too much global state causes performance issues. I learned to segment state by domain (Auth, Theme, Settings).
- Dark Mode Implementation: It's not just CSS variables β it requires careful consideration of contrast, readability, and user preference persistence.
Just want to use the project? https://sgvs-ui.onrender.com/login
You'll need to have installed:
- Node.js 18+ (Download)
- npm 9+ or yarn (comes with Node.js)
- Git to clone the repository
- SGVS API running on
http://localhost:8081(see sgvs-api)
git clone https://github.com/your-username/sgvs-ui.git
cd sgvs-uinpm installThis will install all packages from package.json.
- Create a .env.local file in the project root:
touch .env.local- Add your configuration:
# API Configuration
VITE_API_BASE_URL=http://localhost:8081/api
VITE_API_TIMEOUT=30000
# Google OAuth
VITE_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
# App Configuration
VITE_APP_NAME=SGVS
VITE_PORT=5173
β οΈ IMPORTANT: Never commit .env.local! Use.env.local.examplefor version control.
The frontend expects the SGVS API to be running on http://localhost:8081:
# In another terminal, start the backend
cd ../sgvs-api
./mvnw spring-boot:runOr verify with:
curl http://localhost:8081/actuator/healthnpm run devThe application will open at: http://localhost:5173
You'll see HMR (Hot Module Replacement) enabled β changes are reflected instantly without page reload.
- Navigate to the login page
- Use credentials from the backend or Google OAuth
- Explore the dashboard!
npm run buildThis creates an optimized build in the dist folder.
npm run previewVisit http://localhost:5173 to test the production build.
Create a .env.local file with these variables:
# Backend API
VITE_API_BASE_URL=http://localhost:8081/api
VITE_API_TIMEOUT=30000
# Google OAuth (optional for Google login)
VITE_GOOGLE_CLIENT_ID=100517451932-6ig5ef7nssk34smisede47ogo9vsihuh.apps.googleusercontent.com
# Application
VITE_APP_NAME=SGVS
VITE_PORT=5173
# Logging (optional)
VITE_DEBUG=falsesrc/
βββ api/ # API integration
β βββ services/ # Service layer (ProductService, SaleService, etc.)
β βββ types/ # TypeScript interfaces & types
βββ assets/ # Images, SVGs, static files
βββ components/ # Reusable UI components
β βββ common/ # Buttons, modals, inputs
β βββ features/ # Feature-specific components (ProductTable, SalesForm)
β βββ layout/ # Layout components (Navbar, Sidebar)
β βββ lib/ # Component utilities
βββ contexts/ # React Context providers
β βββ AuthContext.tsx
β βββ ThemeContext.tsx
β βββ SettingsContext.tsx
β βββ ConfirmationModalProvider.tsx
βββ hooks/ # Custom React hooks
β βββ useDebounce.ts
β βββ usePagination.ts
β βββ useShortcutAction.ts
βββ lib/ # Utilities & helpers
β βββ apiClient.ts # Axios instance with interceptors
β βββ auth-error-message.ts
β βββ keyboardShortcuts.ts
βββ locales/ # i18n translations
β βββ en/
β βββ pt/
βββ pages/ # Route pages
β βββ LoginPage.tsx
β βββ DashboardPage.tsx
β βββ ProductsPage.tsx
β βββ SalesPage.tsx
β βββ ...
βββ styles/ # Global styles
βββ utils/ # Helper functions
βββ App.tsx # Main app component & routes
βββ main.tsx # Entry point
βββ vite-env.d.ts # Vite type definitions
npm run lintnpm run formatnpm run type-checknpm run buildCreates optimized, minified files in dist.
npm install -g vercel
vercelnpm install -g netlify-cli
netlify deploy --prod --dir=dist# Build
npm run build
# Deploy (requires AWS credentials)
aws s3 sync dist/ s3://your-bucket-name --delete- React Docs: https://react.dev
- Vite Docs: https://vite.dev
- TypeScript Handbook: https://www.typescriptlang.org/docs/
- TailwindCSS: https://tailwindcss.com/docs
- i18next: https://www.i18next.com/
- Recharts: https://recharts.org/
This is a personal project. If you find bugs or have UI/UX suggestions, please open an issue or pull request.
This project is under the MIT license. See the LICENSE file for details.
Crafted with β€οΈ and β as a modern full-stack business management application.
Backend (Spring Boot): sgvs-api
- React Documentation
- Vite Documentation
- TailwindCSS
- TypeScript Handbook
- Recharts Documentation
- i18next Guide
- Axios Documentation
