Announcing is not the same as guarding
It helps to split the watchdog job in two. Watch work means noticing something unusual and making noise about it. Guard work means being willing and able to stand ground against a threat. A Pug can manage a version of the first and should never be asked to attempt the second.
Many Pugs are reasonably alert at home because they are attached to their people and tuned to household sounds. A knock, a gate latch, or footsteps on gravel can set off a round of barking and an officious trot to the door. Owners who want a dog who hears things before they do may find that enough, especially in a flat where the bark carries and neighbours are close.
Why a Pug will not deter anyone
Once the door opens, the performance usually collapses into a welcome. Pugs were shaped as companions, and their instinct with a stranger is to solicit attention, not to challenge. A determined intruder will not be slowed by a small, flat-faced dog asking for a fuss, and putting a Pug in a position where it feels it must defend the house is unfair and unsafe for the dog.
Size and breathing close the question. A Pug cannot sustain a confrontation, overheats quickly under stress or exertion, and is at real risk if it lunges, is kicked aside, or bolts into the road during a disturbance. If deterrence is a genuine requirement for your home, the answer is locks, lighting, and an alarm system, with a different breed conversation only if you truly want a guarding dog and can meet that dog's demanding needs.
The barking itself needs managing
The Pug who appoints himself household announcer can become a nuisance if every passing dog or delivery earns a full performance. Reward the first alert, then teach a quiet cue and redirect the dog to a mat with something to chew, so the barking has an off switch. Check what is actually triggering it: a Pug left alone for long stretches may bark from loneliness rather than vigilance, and the fix there is company, a shorter absence, or a sitter, not more training drills.
Apartment owners should weigh this carefully. A breed sold as quiet and easy can still be vocal at the door, and thin walls make that the neighbours' problem as well as yours.
Choose a Pug for company, not security
If your real wish list is a friendly, funny companion who will probably tell you the post has arrived, a Pug fits beautifully. If the wish list starts with protection, be honest that you are shopping for something this breed was never meant to be, and forcing the role risks the dog.
Because a Pug greets callers instead of challenging them, doors and gates get opened to a dog who may wander out hopefully behind a visitor, which is why KinsLe's Lost Pet Alert System matters for this breed: it sends a free alert to nearby members within a short radius, and a finder can message you directly through your Pug's profile.