A modern, enterprise-ready inventory management system designed for multi-tenant scalability and precision.
KIPO is a highly scalable, multi-tenant SaaS solution (v1.4.0) meticulously engineered to revolutionize restaurant and food business management. It empowers owners with comprehensive inventory control, precise sales tracking, real-time Kitchen Display System (KDS), and robust team coordination with granular permissions. Designed for enterprise readiness, KIPO delivers deep financial insights through advanced analytics and ensures seamless scalability with integrated Stripe-powered subscription management.
KIPO solves the complexities faced by small to medium-sized businesses in managing inventory and sales professionally and centrally. It moves beyond manual spreadsheets by offering:
- Centralized Multi-tenant Control: Manage multiple companies under a single account with complete data isolation.
- Comprehensive Stock Audit: Detailed logging of every movement (in, out, sale, adjustment) for full traceability.
- Financial Intelligence: Automated dashboards providing real-time profit, contribution margin, and cost history.
- Proactive Stock Management: Configurable low-stock alerts (
minStock) to prevent shortages and optimize inventory levels.
- π’ Advanced Multi-tenancy: Complete data isolation across companies. A single user can be part of multiple organizations with different roles.
- π Modular Sales & POS (New): A completely refactored sales interface featuring specialized containers for Cart management, Customer selection, and real-time Financial Summaries. Supports Venda Avulsa (one-off sales) with precision.
- π§βπ³ Kitchen Display System (KDS): Real-time order management system. Track order status across different prep stages with automatic synchronization via SSE (Server-Sent Events).
- π CRM & Notification Center: Integrated intelligence for customer relationships. Automatic alerts for birthdays, manual price adjustments with justification, and a global notification hub.
- π Advanced Analytics & Reporting: Deep financial engines that track revenue, profit, and margins. Export professional XLSX reports with calculated metrics for offline auditing.
- π₯ Identity & Team Management: Professional role hierarchy (Owner, Admin, Member). Includes a frictionless WhatsApp invitation flow.
| Technology | Role | Features |
|---|---|---|
| Next.js 16 | Foundation | App Router, Server Actions, PPR (Partial Prerendering) |
| React 19 | UI Library | Actions, UseOptimistic, Transitions, Enhanced Lifecycle |
| Auth.js v5 | Security | Type-safe authentication & multi-tenant session management |
| Prisma ORM | Data | PostgreSQL integration with relational multi-tenant schema |
| Stripe | Revenue | Automated billing, webhooks, and subscription lifecycle |
| Sentry | Reliability | Full-stack error monitoring and performance tracing |
| Library | Description |
|---|---|
| Tailwind CSS | Premium glassmorphism and modern UI tokens |
| shadcn/ui | Robust components powered by Radix UI (Radix 1.x) |
| Framer Motion | Fluid micro-animations and smooth UI transitions |
| ExcelJS | High-performance generation of complex XLSX reports |
| Recharts | Dynamic data visualization for financial trends |
| Sonner | Interactive, global notification system |
erDiagram
Company ||--o{ UserCompany : "has members"
User ||--o{ UserCompany : "linked to"
Company ||--o{ Product : "owns"
Company ||--o{ Sale : "manages"
Sale ||--o{ SaleItem : "contains"
Product ||--o{ SaleItem : "refers to"
Product ||--o{ StockMovement : "movement log"
User ||--o{ Sale : "registers"
User ||--o{ StockMovement : "performs"
Company {
string id PK
string name
enum plan "FREE | PRO"
int maxProducts
string stripeCustomerId
}
User {
string id PK
string email
string phone
string password
}
Product {
string id PK
string name
decimal price
decimal cost
decimal operationalCost
int stock
}
Sale {
string id PK
decimal totalAmount
decimal tipAmount
decimal discountAmount
string paymentMethod
string createdBy FK
}
git clone https://github.com/tonelopes-dev/stock-manager
npm install
npx prisma generate# Start the development server
npm run dev
# Run database migrations
npx prisma migrate devkipo/
βββ app/
β βββ (protected)/ # Dashboard, Sales (PDV), Products, Team, CRM
β βββ auth/ # Login, Password recovery flow
β βββ _actions/ # Transactional Server Actions (the core logic)
β βββ _data-access/ # Clean Room Data Access Layer (Repository Pattern)
β βββ _lib/ # Core configs (Auth, RBAC, Prisma, Stripe)
β βββ _components/ # Reusable global UI (Notification Center, Layout)
βββ prisma/ # Relational Schema with Multi-tenant isolation
βββ docs/ # Additional documentation and PT-BR READMEKIPO follows enterprise-grade architectural patterns that ensure code quality, security, and scalability:
UI Layer (React Components)
β
Action Layer (Server Actions - Type-safe API)
β
Data Access Layer (Repository Pattern - CRUD operations)
β
Database (PostgreSQL + Prisma)
- Multi-Tenancy by Design: Every query enforces
companyIdisolation at the ORM level. Data breaches between tenants are architecturally impossible. - Type-Safe Server Actions: Leverages Next.js Server Actions with Zod validation for end-to-end type safety from client to database.
- Role-Based Access Control (RBAC): Granular permissions system (
OWNER>ADMIN>MEMBER>VIEWER) with 13+ capability checks for sensitive operations. - Data Transfer Objects (DTOs): Clean separation of database models from API responses. Raw Prisma models never leave the data access layer.
- Performance Optimization: Strategic use of Prisma
select()(neverinclude()) to prevent N+1 queries and optimize response times. - Error Handling: Centralized error handling via
safe-actionwrapper with Portuguese user messages and English logs for debugging.
- Unit Tests: Vitest for business logic validation
- Integration Tests: Testing Server Actions with database interactions
- E2E Tests: Playwright for user workflows (login, sales, reports, etc.)
- Type Safety: Strict TypeScript mode with no implicit
anytypes
- β Multi-tenant data isolation enforced at ORM level
- β
Row-level security patterns via
companyIdfiltering - β Password hashing with industry-standard algorithms
- β JWT-based session management with Prisma storage
- β RBAC permission checks on every sensitive operation
- β Sentry integration for real-time error monitoring and performance tracking
- β Audit logging for compliance and accountability
KIPO - Empowering Modern Inventory & Sales Management
This codebase demonstrates:
- Enterprise Architecture: Clean separation of concerns with real-world multi-tenancy
- Modern TypeScript: Strict mode with end-to-end type safety
- Best Practices: SOLID principles, design patterns, and scalable folder structures
- Production-Ready Code: Error handling, monitoring, testing, and documentation
Interested in joining the team or collaborating? Reach out via GitHub Issues or visit our website.
KIPO is built with β€οΈ and serves as a reference implementation for SaaS platforms. For licensing details, see the LICENSE file.
Elevating restaurant operations through modern technology. β¨