How mahaut1/verrier-pro works
Project Type and Purpose
• VerrierPro is a full-stack web application designed for professional glass artisans to manage creations, galleries, orders, stock and events.
• Frontend: React 18 + TypeScript + Vite
• Backend: Express.js + TypeScript + Drizzle ORM
• Database: PostgreSQL (Docker locally, Neon in cloud)
• File uploads: Local “uploads/” plus R2 (cloud object storage)
File Structure Analysis
• Top-level directories:
• client/ – React single-page application
• server/ – Express API, routing, middleware, data-access
• shared/ – DTOs & schema definitions shared by client & server
• migrations/ – Drizzle SQL migrations and metadata
• uploads/ – Persisted image assets
• Infrastructure/config:
• docker-compose.yml, drizzle.config.ts, postgres.conf, pg_hba.conf
• Scripts for DB dumps and migrations (scripts/*.ts, init-from-env.sh)
• Build/config files:
• tsconfig.json, tsconfig.build.json, vite.config.ts, postcss.config.cjs, tailwind.config.ts
README Insights
• Describes domain: pieces, galleries, orders, stock, events, dashboard.
• Highlights architectural patterns:
• Domain-Driven Design
• Repository pattern via server/storage/*.storage.ts
• Command-Query Separation
• Express middleware for audit, rate limiting, error handling
• Deployment targets: Docker local, Railway/Neon production
Main Components
a. Frontend
• React SPA served by Vite dev server (localhost:5173) or static bundle under Express in production
• Components: pages/, forms/, UI primitives (shadcn/ui + Radix), React Query for state
• Authentication via HTTP-only cookies, TanStack Query for data fetching
b. Backend
• Express app with modular routes (server/routes/*.ts)
• Middlewares: session management (express-session + bcrypt), CSRF, rateLimiter, audit, errorHandler
• Data-access layer (server/storage/*.storage.ts) implementing repository pattern with Drizzle ORM
• R2 proxy route for direct object storage read/write
• Shared schema definitions imported from shared/schema.ts
c. Database
• PostgreSQL with tables: users, sessions, pieces, piece_types, galleries, orders, order_items, stock_items, stock_movements, events, event_pieces
• Migrations tracked under migrations/
• Connection logic in server/db.ts
d. External Services
• Neon (Postgres cloud) or local Docker Postgres
• R2 (S3-compatible object storage via server/lib/r2.ts)
• Mailer service (server/utils/mailer.ts)
Relationships and Data Flows
• User → Frontend (React) ↔ Backend (Express API) ↔ PostgreSQL
• Frontend uses React Query to call /api/* endpoints, sending session cookie
• Backend middleware authenticates request, routes → storage layer → DB
• File upload flows: Frontend POST to /api/r2-proxy or direct R2 endpoint, metadata in DB
• Events: separate route and storage for event-piece associations
• Dashboard aggregates multiple services: events, pieces, orders, stock movements
Architectural Patterns & Design Principles
• Separation of concerns: UI, API, data-access, migrations
• Repository pattern in storage modules for testability & decoupling
• CQRS: read models served by queries, writes via commands in routes
• Domain-Driven Design: clear modules per domain (events, galleries, orders, stock)
• Middleware chain enforces cross-cutting concerns (security, logging, rate limiting)