4.**Results Logging**: Detailed results are saved to JSON files
5.**Rate Limiting**: 1-second delays between imports to be respectful to APIs
## Output Files
After running, you'll get timestamped JSON files with detailed results:
-`popular-sets-import-results-[timestamp].json`
-`bulk-import-results-[timestamp].json`
These files contain:
- Success/failure status for each set
- Number of cards imported per set
- Error messages for failed imports
- Summary statistics
## Prerequisites
1.**Server Running**: Make sure your Next.js dev server is running (`npm run dev`)
2.**Database Setup**: Ensure the database is initialized (`npm run setup-db`)
3.**Dependencies**: All required packages are installed
## Recommendations
### For First-Time Setup
Start with the popular sets import:
```bash
npm run import-popular
```
This will give you a solid foundation with the most relevant cards.
### For Complete Database
If you want everything, use the full import:
```bash
npm run import-all
```
### For Ongoing Management
After the initial bulk import, use the admin interface at `/admin/card-import` for:
- Importing new sets as they release
- Selective imports of specific sets
- Monitoring import progress
## Troubleshooting
### Common Issues
1.**API Rate Limits**: If you get rate limit errors, the scripts will continue but log failures
2.**Network Issues**: Scripts will retry and continue with the next set
3.**Server Restart**: If the server restarts, just restart the import script
### Monitoring Progress
Watch the console output for:
- ✅ Successful imports with card counts
- ❌ Failed imports with error messages
- 📊 Summary statistics at the end
### Stopping and Resuming
You can stop the script with `Ctrl+C` and restart it later. The scripts will start from the beginning, but the database will only store unique cards (no duplicates).
## API Endpoints Used
-`POST /api/cards/import-mtg` - Magic: The Gathering imports