Confused with the use of 的 with respect to '住在上海旁边的一个小村子里’
"住(live)在(in)上海(Shanghai)旁边(beside)的(indicates attributive)一个(a)小(small)村子(village)里(used together with 在 to mean in)" can be translated as 'live in a small villiage beside Shanghai.'

的 is used between an attribute and the head noun it modifies. That is, an attribute must be followed immediately by a 的 in order to modify a noun.

The question lies in the different word orders between English and Chinese.
In English, the word indicating the location of A is usually placed after A, together with a preposition such as in/at/beside and so on. While in Chinese, the word indicating the location of A is usually placed in the attributive position (before A), followed immediately by a 的. So "a church in Washington" is translated as "在(in) 华盛顿(Washington)  的  一所(a)  教堂(church)" or just "华盛顿的一所教堂", "a church beside Washington" is translated as "华盛顿(Washington) 旁边(beside) 的 一所(a) 教堂(church)"

As for "住在上海旁边的一个小村子里", 住 means live, "在...里" means in, "上海(Shanghai) 旁边(beside) 的 一个(a) 小(small) 村子(village)" means "a small village beside Shanghai".

上海旁边(beside Shanghai) as a whole is used as attribute to modify 一个小村子.