This is a full-stack web application that predicts the rarity of seashells based on physical characteristics (length, width, thickness, weight, pattern, and location). Users input seashell measurements through a scientific-themed form, and the server returns a rarity classification (Common, Uncommon, Rare, or Very Rare). Prediction history is stored in a PostgreSQL database and displayed in a table.
The project also contains legacy Python scripts (train_cnn.py, image_predictor.py, seashell_predictor.py) for CNN-based image classification and sklearn-based prediction, but the primary application is the TypeScript web app.
Preferred communication style: Simple, everyday language.
- Location:
client/directory - Framework: React with TypeScript, bundled by Vite
- Routing:
wouterfor client-side routing (single page: Home) - State Management:
@tanstack/react-queryfor server state (fetching predictions, history) - Forms:
react-hook-formwith@hookform/resolversand Zod validation - UI Components: shadcn/ui (New York style) built on Radix UI primitives, styled with Tailwind CSS
- Animations:
framer-motionfor result transitions and loading states - Design Theme: Ocean-themed scientific aesthetic with deep teals, cyans, and clean whites. Typography uses Space Grotesk (headers), Inter (body), and JetBrains Mono (data/monospace)
- Custom Components:
ScientificInput,ScientificSelect,RarityCard,HistoryList— domain-specific components wrapping base UI primitives - Path Aliases:
@/maps toclient/src/,@shared/maps toshared/
- Location:
server/directory - Framework: Express 5 running on Node.js with TypeScript (via
tsx) - Entry Point:
server/index.tscreates HTTP server, registers routes, serves static files - API Routes (defined in
server/routes.ts):POST /api/predict— accepts seashell measurements, returns rarity prediction with confidence scoreGET /api/history— returns the 10 most recent predictions
- Prediction Logic: Server-side heuristic scoring system that simulates a Random Forest classifier. It scores based on location (Deep Sea = rarer), pattern type, shell density, and size thresholds. This is a demo approximation, not a real ML model.
- Development: Vite dev server is integrated as middleware for HMR during development (
server/vite.ts) - Production: Client is built to
dist/public/, server is bundled with esbuild todist/index.cjs
- Location:
shared/directory - Schema (
shared/schema.ts): Drizzle ORM table definitions and Zod validation schemas shared between client and server - Routes (
shared/routes.ts): API contract definitions with paths, methods, input schemas, and response types — used by both frontend hooks and backend handlers
- ORM: Drizzle ORM with PostgreSQL dialect
- Connection:
pgPool usingDATABASE_URLenvironment variable - Schema: Single table
seashell_predictionswith columns:id(serial PK),length,width,thickness,weight(all real),pattern(integer 1-4),location(integer 1-2),predicted_rarity(text) - Migrations: Managed via
drizzle-kit push(npm run db:push) - Storage Layer:
server/storage.tsprovides aDatabaseStorageclass implementingIStorageinterface withcreatePrediction()andgetHistory()methods
- Dev:
npm run dev— runs tsx with Vite middleware for HMR - Build:
npm run build— runsscript/build.tswhich builds client with Vite and server with esbuild - Type Check:
npm run check— runs TypeScript compiler - DB Push:
npm run db:push— pushes Drizzle schema to database
- PostgreSQL — required, connected via
DATABASE_URLenvironment variable. Must be provisioned before the app runs.
- drizzle-orm + drizzle-kit — ORM and migration tooling for PostgreSQL
- express (v5) — HTTP server framework
- @tanstack/react-query — async server state management on the client
- react-hook-form + zod — form handling and schema validation (shared between client/server)
- framer-motion — animation library for UI transitions
- shadcn/ui ecosystem — Radix UI primitives, Tailwind CSS, class-variance-authority, clsx, tailwind-merge
- wouter — lightweight client-side router
- pg — PostgreSQL client for Node.js
- Google Fonts: Space Grotesk, Inter, JetBrains Mono, DM Sans, Fira Code, Geist Mono
- TensorFlow, Pillow, NumPy, pandas, scikit-learn, tkinter — used only by standalone Python scripts, not part of the main web application