If you want a granulated (detailed) postal code system, you will first need to create a detailed database with (preferably) official addresses. You cannot assign a postal code to an address that is not in a database.
Notice that 'official addresses' is not the same as 'legally licenced constructions'. The first is normally within the domain of the Ministry of Interior (e.g. for police or tax matters), while the second is usually within the competence of the Ministry of Urban Planning ! Although the most efficient way is to combine these two elements into one single database for practical reasons.
So probably, you will first have to create a website allowing local authorities to insert all local addresses into one single national database. This needs to be done locally because of the massive workload. After validation (meaning : official verification and proclamation), that address database can then very easily be used for assigning postal codes.
I have built such website as a consultant other countries and it is a very speedy way of proceeding with this type a projects. The final structure of your database will depend of course entirely on your country's adminitrative (sub)divisions. Such a system will allow you to create a single postal code for each distinct street (with the possibility of further detailing up to the level of the indiviual house-number itself, even apartment number).
As for the postal codes themselves to become internationally effective, you will need to follow UPU procedures. There are a number of steps and requirements to fulfill. But that only relates to the handling of international post to your country, coming from any other given country. Anyway, that is only a legal/administrative process that as no bearing on your project code.