I have my geoserver installed in my machine (localhost). I create a database in PostGIS inside my geoserver and I create a web gis in leaflet that connects to that database.