Chip-based single-atom detector