No description
prisma | ||
public | ||
src | ||
.dockerignore | ||
.gitignore | ||
docker-compose.yml | ||
dockerfile | ||
eslint.config.mjs | ||
justfile | ||
next.config.ts | ||
package-lock.json | ||
package.json | ||
postcss.config.mjs | ||
README.md | ||
tsconfig.json |
Compareware
A modern web application for comparing items and their properties, built with Next.js and Prisma.
What is Compareware?
Compareware allows users to compare different items by their properties in a structured, easy-to-use interface. Users can:
- Add items for comparison via URLs
- Select relevant properties for comparison
- View side-by-side comparisons of items
- Manage and customize comparison criteria
Tech Stack
- Frontend: Next.js 15 with TypeScript
- Database: SQLite with Prisma ORM
- Styling: Tailwind CSS
- Runtime: Node.js
Quick Start
Prerequisites
- Node.js 18+
- npm, yarn, or pnpm
Get the app running:
# 1. Clone and navigate to the project
git clone ssh://git@forge.ftt.gmbh/Progyssey/Compareware_next.js.git
cd compareware-nextjs
# 2. Install dependencies
npm install
# or
yarn install
# or
pnpm install
# 3. Set up the database
npx prisma generate
npx prisma migrate dev
# 4. Start the development server
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the application.
Database Schema
Key Concepts
- PK (Primary Key): Unique identifier for table records (🔑)
- FK (Foreign Key): Reference linking related tables (➡️)
- Core Properties: name and description properties that are always present
- Global Item ID: Shared identifier allowing items to exist across multiple URLs
Tables Overview
Table | Columns (PK/FK) | Description | Example Data |
---|---|---|---|
urls | id (PK), url , description , created_at |
Stores comparison URLs with metadata | 1, "/laptops", "Gaming laptops comparison", 2024-03-01 |
items | id (PK), url_id (FK), global_item_id , wikidata_id , item_order |
Items within specific URLs, linked to global items | "item1", 1, "global_macbook_pro", "Q214276", 0 |
properties | id (PK), name , global_usage_count |
All available properties with usage tracking | 1, "name", 5 2, "description", 5 3, "screen_size", 3 |
item_properties | global_item_id (PK), property_id (PK/FK), value , is_user_edited , updated_at |
Property values for global items | "global_macbook_pro", 1, "MacBook Pro", false, 2024-03-01 "global_macbook_pro", 3, "16 inches", true, 2024-03-01 |
selected_properties | url_id (PK/FK), property_id (PK/FK), display_order |
Active properties per URL | 1, 3, 0 |
deleted_properties | url_id (PK/FK), global_item_id (PK), property_id (PK/FK) |
Soft-deleted properties per URL/item | 1, "global_macbook_pro", 4 |
Data Flow
flowchart LR
User -->|Creates| urls
User -->|Adds| items
User -->|Defines| properties
User -->|Selects| selected_properties
User -->|Sets Values| item_properties
User -->|Soft Deletes| deleted_properties
urls -->|url_id| items
urls -->|url_id| selected_properties
urls -->|url_id| deleted_properties
items -->|global_item_id| item_properties
items -->|global_item_id| deleted_properties
properties -->|property_id| selected_properties
properties -->|property_id| item_properties
properties -->|property_id| deleted_properties
subgraph "Global Item Concept"
items -.->|shares global_item_id| item_properties
item_properties -.->|can exist across multiple URLs| items
end
Properties Data Flow
sequenceDiagram
participant User
participant App as Application
participant DB as Database
participant Wikidata
User->>App: Enters search
App->>Wikidata: fetch_wikidata_suggestions()
Wikidata-->>App: Return suggestions
App->>User: Show suggestions
User->>App: Selects item
App->>Wikidata: fetch_item_properties()
Wikidata-->>App: Return properties (IDs + values)
App->>Wikidata: fetch_property_labels()
Wikidata-->>App: Return labels
App->>DB: Store/update item_properties with global_item_id
App->>DB: Update property global_usage_count
App->>DB: Check deleted_properties for soft deletes
App->>User: Show labeled properties (filtered by soft deletes)
Note over App,DB: Items can be reused across URLs via global_item_id
Note over App,DB: User edits tracked with is_user_edited flag