A RESTful API service that provides comprehensive information about MacBook models from 2010-2025, including support status, specifications, and compatibility details.
- Create a new repository on GitHub with these files
- Open in Codespaces - Click the green "Code" button and select "Create codespace on main"
- Wait for setup - The codespace will automatically install dependencies
- Start the server:
npm start # or for development with auto-reload: npm run dev - Access the API - The service will be available on port 3000
macbook-api/
βββ .devcontainer/
β βββ devcontainer.json
βββ data/
β βββ macbook_models_2010_2025.json
βββ server.js
βββ package.json
βββ README.md
βββ tests/ (optional)
- Ensure your repository has the
.devcontainer/devcontainer.jsonfile - Place your JSON data file in the
data/directory - Open the repository in GitHub Codespaces
- Run
npm start
# Clone the repository
git clone <your-repo-url>
cd macbook-api
# Install dependencies
npm install
# Create data directory and add JSON file
mkdir data
# Copy your macbook_models_2010_2025.json to data/
# Start the server
npm start- Codespaces:
https://your-codespace-url.github.dev - Local:
http://localhost:3000
- GET
/health - Returns service health status
- GET
/api/devices - Query Parameters:
status- Filter by support status (supported,vintage,obsolete)search- Search in model name, ID, or statussort_by- Sort by field (release_date,model_name,supported_end_date)order- Sort order (asc,desc) - default:desctype- Filter by device type (air,pro)
- GET
/api/devices/macbook-air - Same query parameters as above
- GET
/api/devices/macbook-pro - Same query parameters as above
- GET
/api/devices/:modelId - Returns device by model ID (e.g.,
MacBookAir10,1)
- GET
/api/support-status - Returns definitions for support status categories
- GET
/api/docs - Returns complete API documentation
# Get all supported devices
curl "https://your-codespace-url.github.dev/api/devices?status=supported"
# Search for M1 models
curl "https://your-codespace-url.github.dev/api/devices?search=M1"
# Get MacBook Air models sorted by name
curl "https://your-codespace-url.github.dev/api/devices/macbook-air?sort_by=model_name&order=asc"
# Get specific device
curl "https://your-codespace-url.github.dev/api/devices/MacBookAir10,1"{
"success": true,
"count": 10,
"data": [
{
"model_name": "MacBook Air (M1, 2020)",
"model_id": "MacBookAir10,1",
"release_date": "2020-11-17",
"support_status": "supported",
"supported_end_date": "2027-11-17",
"latest_macos_supported": "macOS Sequoia 15.5"
}
],
"metadata": {
"support_status_definitions": {...},
"notes": {...}
}
}npm start- Start production servernpm run dev- Start development server with auto-reloadnpm test- Run tests (when implemented)
The API is built with Express.js and includes:
- CORS support for cross-origin requests
- Security headers with Helmet
- Request logging with Morgan
- Comprehensive error handling
- Flexible filtering and sorting
PORT- Server port (default: 3000)
Each device includes:
model_name- Full model namemodel_id- Apple's internal model identifierrelease_date- When the model was releasedsupport_status- Current support level (supported/vintage/obsolete)supported_end_date- Estimated end of supportlatest_macos_supported- Highest compatible macOS version
// Check if a device is still supported
fetch('/api/devices/MacBookAir8,1')
.then(response => response.json())
.then(data => {
console.log(`Status: ${data.data.support_status}`);
console.log(`Support ends: ${data.data.supported_end_date}`);
});// Find vintage/obsolete devices
fetch('/api/devices?status=vintage')
.then(response => response.json())
.then(data => {
console.log(`${data.count} devices need attention`);
});// Get all devices and their macOS compatibility
fetch('/api/devices?sort_by=supported_end_date&order=asc')
.then(response => response.json())
.then(data => {
data.data.forEach(device => {
console.log(`${device.model_name}: ${device.latest_macos_supported}`);
});
});- Port 3000 in use: Change the PORT environment variable
- JSON file not found: Ensure the data file is in the
data/directory - Codespace port forwarding: Check the Ports tab in VS Code
For questions or issues, check the /api/docs endpoint for the most current API documentation.
MIT License - Feel free to use this for your organization's IT management needs!