score:4
Before answering, I noticed you've asked a previous question regarding China and Southeast Asia (re: migrants to British Malaya during 19th century). I do not know your specific level and area of interest, so I'd like to recommend 2 books:
Back to question: How could Lanfang republic exist in 18th century Borneo if Chinese migration was prohibited during Qinq era?
Borneo has a long-standing trading relationship with south China since antiquity, long before the Manchu dyansty came around during mid-17th century. In fact, these Chinese settlers in insular Southeast Asia (of which Borneo is a part of) pre-date Qing by probably about 1,000 years, i.e. have been there since about 7th-8th century CE, if not earlier.
In other words, even before Zheng He's voyages under Ming (1405 to 1433), the Chinese already had business dealings with people of Borneo.
Borneo in the annals of China
In the Song Shu (宋书 Liu Song History Annals), which was edited by Shen Yue (沈约, 441–513) during the Nan/Southern dynasty, are records concerning the Poli nation (婆利国). Liang Shu (梁 书 Liang Dynasty History Annals), Nan Shi (南史 History Annals of the Nan/Southern Dynasty), Bei Shi (北史 Bei/Northern Dynasty History Annals), Sui Shu (隋书 History Annals of the Sui Dynasty), Jiu Tang Shu (History Annals of the Old Tang Dynasty) and Xin Tang Shu (新唐书 History Annals of the New Tang Dynasty) all show records of the arrival of an emissary from the Poli nation to pay tribute to China (进贡). In the Song Shi (宋史 Song Dynasty History Annals), Borneo was called “Boni” (渤尼/渤泥), and in the Ming Shi (明史 History Annals of the Ming Dynasty), Borneo was also most often known as “Boni (浡泥).”
Source: Wan Kong Ann, “Examining the Connection Between Ancient China and Borneo Through Santubong Archaeological Sites” Sino-Platonic Papers, 236 (April 2013)
From here, it was simply a matter of placing Chinese merchants in and around Borneo for business purposes, learn local customs and language, wait out the monsoon winds, etc. In time, this Chinese became localised (known as Peranankan).
So, the republic was not set up by Qing officials but localised Chinese merchants in Borneo. I believe Lanfang was more co-operative (think joint-stock company without the legal recognition/state support) than republic. The localised term is kongsi.