You said Medieval, but that's a bit of a wide range.
As to these types of schools, they tended to be established from about 1000-1300, with the most growth in the 1200s. If you lean towards the late 1300s, your school might have been around for a hundred years or more in one form or another.
Although monasteries, for a long time, were the bastion of education for many communities--in Medieval times most monasteries were not converted into honest-to-goodness universities. (This did happen, in England, oh, round about the 1500s, which is Renaissance territory. Other conversions in other places happened much later, but the conversion wasn't a Medieval thing).
Many universities actually developed on their own, fiercely independent of the church, mainly because they thought credentials in academia were more important than church credentials. That's not to say that monasteries didn't have an influence, and it isn't to say that the church wasn't influenced by the creation of these institutions. You can start with the wikipedia entry and look at the Establishment section. Who paid for the uni, varied from community to community. And yes, who paid for it was, indeed, often the church.
But for neigh-sayers that speak as though there were NO connection between the church and universities, that doesn't add up, as students and teachers often had the same sort of privileges extended to them as clergy (like not being tried in regular court but Ecclesiastical). Also, many a pope issued papal bulls regarding the education/university system, so it wasn't as though the church had no say--and often, after uni education, one would go into the church.
For town sizes and distance from each other, see my answer here, where I list city sizes about 1337. London, which was one of Medieval times "mega cities" at least in England, anyway, had about 20,000 people there in 1337. This answer also kind of covers the co-dependence nearby settlements and towns could have on each other.
Now, that's just England. Paris, which founded its Uni round 1150ish, had an estimated population about 100,000 by 1200--and double that at least by 1328.
Cailloumax's answer includes some lovely maps, so I'll leave the specific street layout alone, except in general terms. City streets varied from community to community, but tended to be crooked affairs for the most part, with a few main straightaways.
As to farms in the city, well, if your population is high, they won't be enough to feed your city. Most of the farming is going to be beyond the walls. Farms inside the walls is actually something more likely to happen AFTER Medieval times, strangely. That isn't to say that there might not be orchards and gardens on the grounds of the monastery, your school, or the castle.
And then...there's the matter of the walls.
Ok, so most "walled Medieval towns" were actually little more than extensive CASTLE GROUNDS. They were where people went when they were attacked. When a city became important, they might wall more of it, beyond the grounds, but building a wall is expensive, so many times it still didn't encompass the WHOLE of the city. That doesn't mean that there aren't small walled Medieval cities, which encompassed the whole of the city, it just means that it's unlikely that there aren't suburbs spilling out of it. Bits of old walls before the city expands will often still be standing WITHIN the city, with an outer wall to protect from attack.
London outgrew its walls, and by 1300, the walls just separated the city center from the rest of it. If you're looking to make a really large city, the walls might be there, but they are mainly neighborhood barriers. So you may have slang as to that.
Before a Uni is physically built, understand that the community of scholars will already exist, and classes are held where ever there is room. Sometimes that will be at the local monastery, or castle grounds, or people's homes--for years. Then, they gain patronage, often from a person taught by the University's scholars (which, while it might not have a physical location, is recognized, sometimes by the local lord, sometimes by the church, or both). Lords like it because they might be scholars themselves, and because drawing students to a city can increase commerce.
That's not to say the locals will like the change. University students were a tad..rowdy, even back then--and they get special privileges when in comes to crimes committed, so there's that.
This link is great one that outlines the relationship between cities and universities, and the monastic communities that served at proto-universities in the city of Paris. It also talks about hall rental within a particular district, which then became the University of Paris. Seriously, check out the link, because basically--the University of Paris was founded because of a bar brawl, which escalated into assault, theft, and what amounted to state-sanctioned murder.
You might notice on the map that the uni district is separated by the river, with its own bridge over, somewhat isolating it, though it is technically within the city walls.
That's why it was easy to barricade when the local authorities started trying to kill them--there just weren't that many ways in and out of the district. This point of design may be something you want to look at.
A private institution of learning might want room to build, and it might not have been built inside the city proper--it can feature its own walls and gates, of course, and then around that stuff and people will naturally be set to cater to the students. Indeed, even when located within a city, building walls around Universities happened pretty frequently (often because the city might impose a curfew on the students, who had to be within their "quarter" of the city after a certain time--this varied from place to place and time to time).
Where the abbeys/monasteries are located in and around Paris might also be of interest to you. Only ONE of the abbeys was located within the city walls, and that one wasn't always within the bounds of the city. See this wiki link on all the walls built as the city expanded. While the Abbey of St Genevieve was founded in the 500s, it wasn't inside the city walls until 5 or 600 years later. Most Abbeys weren't inside a city to start with, particularly if they relied on their own agriculture to keep the monks and clergy fed. They can still have a farm once incorporated inside a city, but they could also sell or donate the land to city interests for the building of roads, infrastructure and other things. But often they kept some land for that purpose, sometimes for more decorative contemplative purposes, but often for a more practical purpose, such as making a product to sell to the public (preserves, beer, wine, that kind of thing).
Cambridge or Oxford might be a better model if you're looking to go smaller--their population was about 2,000 each. Cambridge University is interesting because it was founded by Oxford scholars who didn't like the way students and teachers were treated--so they moved to a community where they could set themselves better terms.
EDIT: I could go on at length regarding guildhall customs and layout (sometimes the guild hall wasn't separate from the marketplace, which can actually be inside it on particular days, and broken down at days end or not, depending on the type of city, how large it was, & this could depend on the mercantile fair culture of an area).