blue area ( including yellow square ) is the building itself.
• pink area is the space around the building.
• yellow square is the coordinates that ACNL uses to pinpoint where the building/pwp is.
All houses have a "buffer zone" that nothing save flowers can be on, and if anything spawns there or you place things there with an editor they are immediately wiped out when you start up the game and have Isabelle "prepare your town". Usually, save for Homebrew editing, nothing will even spawn there in the first place.
With the legitimate plot method it is possible to have a villager house move 2 spaces (aka 2 places you can set down a flower) away horizontally, 3 vertical, but this is the minimum space the game will allow normally.
The game, however, technically allows a house to be 1 spaces away from each other horizontally, but this doesn't happen naturally.
This is about the closest I can get the houses to each other with a save editor, you would just have another space there if you are doing this legit.
(Of course this is the screenshot of the one time I got coordinates wrong and had a good laugh about how me and my villagers were floating over the cliff.)
TL;DR Code allows for as little as 1 space horizontally between but you are limited to 2 spaces between with in-game methods.