From d23f2ab53e2b721144db32f2bbab594b7ebd9609 Mon Sep 17 00:00:00 2001 From: oimwiodev Date: Sat, 30 May 2026 15:01:40 +0100 Subject: [PATCH] Enhanced README with project-specific documentation and added SQLite database --- README.md | 188 +++++++++++++++++++------------------------------- prisma/dev.db | Bin 0 -> 155648 bytes 2 files changed, 70 insertions(+), 118 deletions(-) create mode 100644 prisma/dev.db 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 0000000000000000000000000000000000000000..0ce3c521f67e5ccd5f437f8a23124397a5f518fd GIT binary patch literal 155648 zcmeI3U2ojhna78+H6tmqmDWiZMRh{aQLWk7i6?;(U>8M}8d1u?qnYW5Bg72~mKh#N zT+fgr4rxe>0!8Y|LDMFC(YpoqYHt_FSJ>VZSYUzP2k1?|!xoEOEU<^X`Z*Bs%4!pjAYEBw766bgk`>F*EeZ}{UqUk)GW zm5bfy-M(6Q_a6tdR64Wt7q89_mi~9?FZ0^s&q|-p-;9Clf( zwq;3?1x4DZ%Yw*CMPYqGpg*Fai-ID5q6m#9{q5B2LaSZdk=pl#d-DBTK^>dy6PuV_ zlB&wYIvE-Vrsf!ynO&i)Ipn~yjhy%QE!Q@U;gGm?jg5x2Jg|*pse7n7A1k6jr%{ha z8LQwkP?TzR4d$!uxmLy~ElWI#&0ADAXE?ye+q*UZSdrdOHT4XKvNI ztVz-z^t3MNQ$+<-Sb1Nwk6cEA6*(sZvSXQ!Ymb-j5j#~%4Z!eJ;qi#tbck(eZla^E z<@PAjM44{T@eHY=hRI?w?Apd)q(Rnh*V4&`mL7oCb&P#c*l0HEveX!d<=8F>8?Xu0 zy)ID%o74!E+KxP4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