Enhanced README with project-specific documentation and added SQLite database

This commit is contained in:
2026-05-30 15:01:40 +01:00
parent f6dc5fb07f
commit d23f2ab53e
2 changed files with 70 additions and 118 deletions

188
README.md
View File

@@ -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.

BIN
prisma/dev.db Normal file

Binary file not shown.