60532905010dba923cfe1315a513b3954b895c60
The RTX 5070 case that prompted this: only 100 GPUs out of pc-builder.io's
actual 6222 were being scraped (its category pages only render the first
page server-side), so cheaper RTX 5070 variants existed on the site but
were invisible to our search. Investigating further also surfaced that
even with full pagination, most recent GPU listings (RTX 5070 included)
have no fixed Amazon price on pc-builder.io at all - just a generic
"search on Amazon" link - so pagination alone doesn't fully solve price
coverage either.
Pagination (part_scraper_service.ts):
- Reverse-engineered pc-builder.io's /products/data endpoint, which powers
the client-side DataTables widget behind every category page. Requires
a session cookie + CSRF token scraped from a fresh category page load,
and an exact field shape (columns[].data must be the literal strings
"Name"/"Add to Build", not numeric indices - a naive DataTables-shaped
request 500s otherwise).
- CATEGORY_CONFIG now tracks each category's real pc-builder.io
category_id and a per-category maxProducts depth, chosen by actual
catalog size and price-sensitivity: GPU near-full coverage (6000),
smaller/less price-volatile categories capped lower (300-800) to keep a
full `scrape:parts` run (all categories) in a reasonable time.
- ensureFreshCategory (triggered inline by a user's search when the cache
is stale) uses a much shallower QUICK_REFRESH_MAX_PRODUCTS=200 cap
instead of the category's full depth, since it runs inside the
request/response cycle of a search - full-depth coverage is only done
by the standalone `scrape:parts` command.
Always keep the best known price:
- scraped_parts.price is now nullable (migration): parts with no fixed
pc-builder.io offer are kept and searchable instead of being silently
skipped, so at least the model is discoverable even before a price is
resolved.
- New price_source / price_checked_at columns track where the currently
stored price came from ("pc-builder.io" or a merchant name from
merchant_price_service.ts).
- ScrapedPartsController#compare now persists the cheapest offer found
(via the new updatePriceIfCheaper()) when it beats the currently stored
price - so comparing prices benefits every future search/import for
that part, not just the user who triggered it. Never regresses the
price: a comparison finding a higher price than what's stored is
ignored.
- scrapeComponentType's catalog refresh applies the same "keep whichever
price is lower" rule per row, so a routine pc-builder.io re-scrape can
never overwrite a better price a comparison had already found and
persisted with a worse (or missing) one.
- Search results (GET /scraped-parts) are now ordered priced-cheapest-first,
then parts with no known price last (`ORDER BY price IS NULL, price ASC`),
so unpriced parts stay visible without pushing priced results down.
- NewPartSearch.vue displays the catalog price inline (or "No price yet"),
and the existing "Compare prices" flow now works for those unpriced
parts the same way it does for priced ones.
7 new/updated functional tests: nullable price is searchable and sorted
last, and 3 tests for updatePriceIfCheaper (cheaper offer replaces price,
pricier offer is ignored, first-ever price is accepted for a previously
unpriced part).
PC Builder
Une application web moderne pour construire et gérer des configurations PC personnalisées. Construite avec AdonisJS et Vue.js (Inertia).
🎯 Fonctionnalités
- Gestion des composants : Cataloguer et gérer les composants informatiques (CPU, GPU, RAM, etc.)
- Construction de PC : Créer et configurer des ordinateurs personnalisés
- Galerie de photos : Ajouter et gérer des images de vos configurations
- Authentification utilisateur : Système d'inscription et de connexion sécurisé
- Interface réactive : Interface utilisateur moderne avec Vue.js et Tailwind CSS
📋 Prérequis
- Node.js >= 18.0.0
- npm ou yarn
- PostgreSQL (ou autre base de données supportée)
- Docker (optionnel, pour l'environnement de développement)
🚀 Installation
1. Cloner le repository
git clone http://192.168.1.39:3000/Stude12/pc_builder
cd pc_builder
2. Installer les dépendances
npm install
3. Configuration de l'environnement
Copier le fichier .env.example en .env et configurer vos variables :
cp .env.example .env
Éditer .env et configurer :
DB_CONNECTION: Type de base de donnéesDB_HOST,DB_PORT,DB_USER,DB_PASSWORD,DB_DATABASE: Connexion à la baseAPP_KEY: Clé de chiffrement (générer avecnode ace generate:key)
4. Générer la clé d'application
node ace generate:key
5. Exécuter les migrations
node ace migration:run
6. Démarrer le serveur de développement
npm run dev
L'application sera disponible à http://localhost:3333
🛠️ Scripts disponibles
# Développement avec hot reload
npm run dev
# Compilation pour la production
npm run build
# Serveur de production
npm run start
# Linter (ESLint)
npm run lint
# Tests
npm run test
# Vérifier les types TypeScript
npm run typecheck
📁 Structure du projet
pc_builder/
├── app/ # Code métier
│ ├── controllers/ # Contrôleurs des routes
│ ├── models/ # Modèles Lucid (ORM)
│ ├── middleware/ # Middlewares
│ ├── validators/ # Validateurs
│ ├── services/ # Logique métier
│ ├── exceptions/ # Exceptions personnalisées
│ └── transformers/ # Transformeurs de données
├── inertia/ # Code frontend Vue.js
│ ├── pages/ # Pages Vue.js
│ ├── components/ # Composants Vue.js réutilisables
│ ├── layouts/ # Layouts de pages
│ ├── composables/ # Composables Vue.js
│ ├── assets/ # Images, icônes, CSS
│ └── directives/ # Directives Vue.js personnalisées
├── config/ # Fichiers de configuration
├── database/ # Migrations et schema
│ ├── migrations/ # Fichiers de migration
│ └── schema.ts # Schéma de la base de données
├── start/ # Points d'entrée de l'application
├── public/ # Fichiers publics statiques
├── resources/ # Templates Edge
├── tests/ # Tests unitaires et fonctionnels
└── node_modules/ # Dépendances (ignorées par git)
🗄️ Modèles de données
User
- Utilisateurs de l'application
- Authentification et autorisation
Computer
- Configurations PC
- Associations avec les composants
- Galerie de photos
Component
- Composants informatiques
- Classés par type (CPU, GPU, RAM, etc.)
ComputerState
- État et historique des configurations
ComputerPicture
- Images des configurations PC
🔐 Sécurité
- Validation CSRF sur tous les formulaires
- Hachage sécurisé des mots de passe
- Middleware d'authentification
- Protection CORS configurée
- Échappement des données XSS
🧪 Tests
# Exécuter les tests
npm run test
# Tests avec couverture
npm run test:coverage
📦 Déploiement
Avec Docker
# Construire l'image
docker-compose build
# Lancer les services
docker-compose up -d
Manuel
- Compiler le projet :
npm run build - Installer les dépendances de production :
npm ci --omit=dev - Démarrer l'application :
npm start
🤝 Contribution
Les contributions sont bienvenues ! Voici le workflow :
- Créer une nouvelle branche :
git checkout -b feature/ma-feature - Faire vos modifications
- Commiter vos changements :
git commit -m "Add: description" - Pousser vers la branche :
git push origin feature/ma-feature - Ouvrir une Pull Request
📝 Convention de commits
feat:Nouvelle fonctionnalitéfix:Correction de bugdocs:Documentationstyle:Formatage, sans changement logiquerefactor:Refactorisation de codetest:Ajout ou modification de testschore:Maintenance, dépendances
📄 Licence
Ce projet est sous licence MIT.
📧 Support
Pour toute question ou problème, veuillez ouvrir une issue sur le repository.
Repository : http://192.168.1.39:3000/Stude12/pc_builder
Branche principale : main
Languages
TypeScript
65.8%
Vue
32.8%
JavaScript
0.4%
Shell
0.4%
Edge
0.3%
Other
0.3%