pcbuilder

1.0.0 • Public • Published

PC Builder API

A powerful Express.js server for generating compatible PC configurations based on budget and use-case requirements. Powered by BuildPC.

Features

  • Generate complete PC configurations based on budget constraints
  • Custom configurations for specific use cases (gaming, productivity, content creation)
  • Automatic compatibility checking between components
  • Performance ratings for different use scenarios
  • Upgrade path recommendations
  • Rate limiting to prevent abuse

Installation

# Clone the repository
git clone https://github.com/yourusername/pc-builder-api.git

# Navigate to project directory
cd pc-builder-api

# Install dependencies
npm install

# Create a .env file with your OpenAI API key
echo "OPENAI_API_KEY=your_openai_api_key_here" > .env

# Start the server
npm start

API Endpoints

Generate PC Build

POST /api/build-pc

Request Body:

{
  "budget": 1500,
  "use_case": "gaming",
  "preferences": {
    "brand_preferences": {
      "cpu": "AMD",
      "gpu": "NVIDIA"
    },
    "rgb": true,
    "noise_level": "quiet",
    "size": "mid-tower"
  }
}

Response:

{
  "build_name": "High-End Gaming Build",
  "total_price": 1489.95,
  "performance_rating": {
    "gaming": 8.5,
    "productivity": 7.2,
    "content_creation": 6.8
  },
  "components": {
    "cpu": {
      "name": "AMD Ryzen 5 7600X",
      "price": 249.99,
      "specs": {
        "cores": 6,
        "threads": 12,
        "base_clock": "4.7 GHz",
        "boost_clock": "5.3 GHz",
        "tdp": 105,
        "socket": "AM5"
      },
      "link": "https://www.amazon.com/AMD-Ryzen-7600X-Desktop-Processor/dp/B0BBHHT8LY/"
    },
    "motherboard": {
      "name": "MSI MAG B650 TOMAHAWK WIFI",
      "price": 199.99,
      "specs": {
        "socket": "AM5",
        "form_factor": "ATX",
        "ram_type": "DDR5",
        "max_ram_speed": 6600
      },
      "link": "https://www.amazon.com/MSI-MAG-B650-TOMAHAWK-WIFI/dp/B0BGJBG5YV/"
    },
    /* Other components would be listed here */
  },
  "compatibility": {
    "issues": [],
    "notes": [
      "All components are compatible",
      "System has sufficient cooling for the selected components"
    ]
  },
  "upgrade_path": {
    "recommendations": [
      "Could upgrade to Ryzen 7 7800X3D in the future for better gaming performance",
      "Additional storage could be added as needed"
    ]
  },
  "generated_at": "2025-03-03T17:30:45.123Z"
}

Environment Variables

Variable Description
PORT Port on which the server should run (default: 3000)
OPENAI_API_KEY Your OpenAI API key for GPT-4o

Error Handling

The API returns appropriate HTTP status codes and error messages:

  • 400: Bad Request (invalid input)
  • 429: Too Many Requests (rate limit exceeded)
  • 500: Server Error (with details when possible)

Testing

Run the test suite:

npm test

Dependencies

  • express: Web server framework
  • axios: HTTP client for API requests
  • dotenv: Environment variable management
  • express-validator: Input validation
  • express-rate-limit: API rate limiting

License

MIT

About

This API is designed to help users get optimized PC builds based on their specific requirements and budget constraints. It uses OpenAI's GPT-4o to generate configurations and ensures all components are compatible with each other.

Try our advanced PC builder.

Package Sidebar

Install

npm i pcbuilder

Weekly Downloads

5

Version

1.0.0

License

ISC

Unpacked Size

11.4 kB

Total Files

3

Last publish

Collaborators

  • stargazermedia