diff --git a/README.md b/README.md index 5a36639..0fd0ad1 100644 --- a/README.md +++ b/README.md @@ -1,141 +1,93 @@ -# πŸš€ Welcome to Z.ai Code Scaffold +# OptiqueStock -A modern, production-ready web application scaffold powered by cutting-edge technologies, designed to accelerate your development with [Z.ai](https://chat.z.ai)'s AI-powered coding assistance. +Application de gestion de magasin d'optique β€” full-stack Next.js avec gestion des clients, produits, ventes, achats, atelier et rapports. -## ✨ Technology Stack +## Modules -This scaffold provides a robust foundation built with: +| Module | Description | +|---|---| +| **Accueil** | Dashboard avec accΓ¨s aux modules | +| **Clients** | Gestion des clients, relevΓ©s de vision, ordonnances | +| **Produits** | Catalogue (montures, verres, lentilles, accessoires), alertes stock, codes QR, images | +| **Fournisseurs** | Gestion des fournisseurs | +| **Achats & Stock** | Factures d'achat, rΓ©ception de stock, upload PDF | +| **Point de Vente** | Panier, paiements fractionnΓ©s, historique des ventes | +| **Atelier** | Suivi des commandes de montage (4 statuts : EN_ATTENTE β†’ EN_COURS β†’ TERMINE β†’ PRET) | +| **Rapports** | KPIs, graphiques (ventes, catΓ©gories, stocks), export CSV | -### 🎯 Core Framework -- **⚑ Next.js 16** - The React framework for production with App Router -- **πŸ“˜ TypeScript 5** - Type-safe JavaScript for better developer experience -- **🎨 Tailwind CSS 4** - Utility-first CSS framework for rapid UI development +## Stack -### 🧩 UI Components & Styling -- **🧩 shadcn/ui** - High-quality, accessible components built on Radix UI -- **🎯 Lucide React** - Beautiful & consistent icon library -- **🌈 Framer Motion** - Production-ready motion library for React -- **🎨 Next Themes** - Perfect dark mode in 2 lines of code +- **Framework**: Next.js 16 (App Router), React 19, TypeScript 5 +- **Base de donnΓ©es**: SQLite via Prisma ORM +- **UI**: Tailwind CSS 4, shadcn/ui, lucide-react +- **Γ‰tat & donnΓ©es**: Zustand, TanStack Query, TanStack Table +- **Formulaires**: react-hook-form + Zod +- **Graphiques**: Recharts +- **Autre**: Framer Motion, DND Kit, Sharp, QR Code, Sonner (toasts) -### πŸ“‹ Forms & Validation -- **🎣 React Hook Form** - Performant forms with easy validation -- **βœ… Zod** - TypeScript-first schema validation - -### πŸ”„ State Management & Data Fetching -- **🐻 Zustand** - Simple, scalable state management -- **πŸ”„ TanStack Query** - Powerful data synchronization for React -- **🌐 Fetch** - Promise-based HTTP request - -### πŸ—„οΈ Database & Backend -- **πŸ—„οΈ Prisma** - Next-generation TypeScript ORM -- **πŸ” NextAuth.js** - Complete open-source authentication solution - -### 🎨 Advanced UI Features -- **πŸ“Š TanStack Table** - Headless UI for building tables and datagrids -- **πŸ–±οΈ DND Kit** - Modern drag and drop toolkit for React -- **πŸ“Š Recharts** - Redefined chart library built with React and D3 -- **πŸ–ΌοΈ Sharp** - High performance image processing - -### 🌍 Internationalization & Utilities -- **🌍 Next Intl** - Internationalization library for Next.js -- **πŸ“… Date-fns** - Modern JavaScript date utility library -- **πŸͺ ReactUse** - Collection of essential React hooks for modern development - -## 🎯 Why This Scaffold? - -- **🏎️ Fast Development** - Pre-configured tooling and best practices -- **🎨 Beautiful UI** - Complete shadcn/ui component library with advanced interactions -- **πŸ”’ Type Safety** - Full TypeScript configuration with Zod validation -- **πŸ“± Responsive** - Mobile-first design principles with smooth animations -- **πŸ—„οΈ Database Ready** - Prisma ORM configured for rapid backend development -- **πŸ” Auth Included** - NextAuth.js for secure authentication flows -- **πŸ“Š Data Visualization** - Charts, tables, and drag-and-drop functionality -- **🌍 i18n Ready** - Multi-language support with Next Intl -- **πŸš€ Production Ready** - Optimized build and deployment settings -- **πŸ€– AI-Friendly** - Structured codebase perfect for AI assistance - -## πŸš€ Quick Start +## DΓ©marrage rapide ```bash -# Install dependencies +# Cloner et configurer bun install +echo 'DATABASE_URL="file:./dev.db"' > .env -# Start development server +# Base de donnΓ©es +bunx prisma generate +bunx prisma db push + +# Lancer le serveur de dΓ©veloppement bun run dev - -# Build for production -bun run build - -# Start production server -bun start +# β†’ http://localhost:3000 ``` -Open [http://localhost:3000](http://localhost:3000) to see your application running. +## Scripts -## πŸ€– Powered by Z.ai +| Commande | Description | +|---|---| +| `bun run dev` | Serveur de dΓ©veloppement (port 3000) | +| `bun run build` | Build production | +| `bun start` | Serveur production | +| `bun run lint` | ESLint | +| `bun run db:push` | Push Prisma schema β†’ DB | +| `bun run db:generate` | GΓ©nΓ©rer client Prisma | +| `bun run db:migrate` | Migration Prisma | +| `bun run db:reset` | Reset base de donnΓ©es | -This scaffold is optimized for use with [Z.ai](https://chat.z.ai) - your AI assistant for: - -- **πŸ’» Code Generation** - Generate components, pages, and features instantly -- **🎨 UI Development** - Create beautiful interfaces with AI assistance -- **πŸ”§ Bug Fixing** - Identify and resolve issues with intelligent suggestions -- **πŸ“ Documentation** - Auto-generate comprehensive documentation -- **πŸš€ Optimization** - Performance improvements and best practices - -Ready to build something amazing? Start chatting with Z.ai at [chat.z.ai](https://chat.z.ai) and experience the future of AI-powered development! - -## πŸ“ Project Structure +## Structure ``` src/ -β”œβ”€β”€ app/ # Next.js App Router pages -β”œβ”€β”€ components/ # Reusable React components -β”‚ └── ui/ # shadcn/ui components -β”œβ”€β”€ hooks/ # Custom React hooks -└── lib/ # Utility functions and configurations +β”œβ”€β”€ app/ +β”‚ β”œβ”€β”€ page.tsx # SPA β€” commutation de modules +β”‚ β”œβ”€β”€ layout.tsx # Layout racine +β”‚ β”œβ”€β”€ globals.css # Styles Tailwind + shadcn +β”‚ └── api/ # API REST (12 groupes de routes) +β”œβ”€β”€ components/ +β”‚ β”œβ”€β”€ clients/ # Module Clients +β”‚ β”œβ”€β”€ products/ # Module Produits +β”‚ β”œβ”€β”€ pos/ # Module Point de Vente +β”‚ β”œβ”€β”€ purchases/ # Module Achats +β”‚ β”œβ”€β”€ suppliers/ # Module Fournisseurs +β”‚ β”œβ”€β”€ atelier/ # Module Atelier +β”‚ β”œβ”€β”€ reports/ # Module Rapports +β”‚ └── ui/ # Composants shadcn/ui +β”œβ”€β”€ hooks/ # Hooks personnalisΓ©s +└── lib/ # Utilitaires (db, optical-utils, qr-code) ``` -## 🎨 Available Features & Components +## API -This scaffold includes a comprehensive set of modern web development tools: +Toutes les routes sous `/api/` suivent le pattern REST : -### 🧩 UI Components (shadcn/ui) -- **Layout**: Card, Separator, Aspect Ratio, Resizable Panels -- **Forms**: Input, Textarea, Select, Checkbox, Radio Group, Switch -- **Feedback**: Alert, Toast (Sonner), Progress, Skeleton -- **Navigation**: Breadcrumb, Menubar, Navigation Menu, Pagination -- **Overlay**: Dialog, Sheet, Popover, Tooltip, Hover Card -- **Data Display**: Badge, Avatar, Calendar +- `api/clients`, `api/clients/[id]`, `api/clients/[id]/patients` +- `api/patients`, `api/patients/[id]`, `api/patients/[id]/ordonnances` +- `api/produits`, `api/produits/[id]`, `api/produits/[id]/images` +- `api/fournisseurs`, `api/fournisseurs/[id]`, `api/fournisseurs/[id]/factures` +- `api/achats/factures`, `api/achats/factures/[id]`, `api/achats/factures/[id]/valider` +- `api/pos/products`, `api/pos/clients`, `api/pos/sales`, `api/pos/sales/[id]` +- `api/atelier/orders`, `api/atelier/orders/[id]` +- `api/reports/dashboard`, `api/reports/sales`, `api/reports/inventory`, `api/reports/export/*` +- `api/fichiers/[id]` -### πŸ“Š Advanced Data Features -- **Tables**: Powerful data tables with sorting, filtering, pagination (TanStack Table) -- **Charts**: Beautiful visualizations with Recharts -- **Forms**: Type-safe forms with React Hook Form + Zod validation - -### 🎨 Interactive Features -- **Animations**: Smooth micro-interactions with Framer Motion -- **Drag & Drop**: Modern drag-and-drop functionality with DND Kit -- **Theme Switching**: Built-in dark/light mode support - -### πŸ” Backend Integration -- **Authentication**: Ready-to-use auth flows with NextAuth.js -- **Database**: Type-safe database operations with Prisma -- **API Client**: HTTP requests with Fetch + TanStack Query -- **State Management**: Simple and scalable with Zustand - -### 🌍 Production Features -- **Internationalization**: Multi-language support with Next Intl -- **Image Optimization**: Automatic image processing with Sharp -- **Type Safety**: End-to-end TypeScript with Zod validation -- **Essential Hooks**: 100+ useful React hooks with ReactUse for common patterns - -## 🀝 Get Started with Z.ai - -1. **Clone this scaffold** to jumpstart your project -2. **Visit [chat.z.ai](https://chat.z.ai)** to access your AI coding assistant -3. **Start building** with intelligent code generation and assistance -4. **Deploy with confidence** using the production-ready setup - ---- - -Built with ❀️ for the developer community. Supercharged by [Z.ai](https://chat.z.ai) πŸš€ +Base de donnΓ©es SQLite auto-contenue β€” aucun serveur externe requis. diff --git a/prisma/dev.db b/prisma/dev.db new file mode 100644 index 0000000..0ce3c52 Binary files /dev/null and b/prisma/dev.db differ