(FORTUNE Magazine) – David Weekly is in the process of forming two technology companies. His headquarters is cramped and messy, with tools on the floor and computer hardware crammed onto a small desk. Junk food and socks are scattered around the room, which, come to think of it, is typical for a freshman dorm room at Stanford University.

United Digital Media LLC is the company Weekly is currently spending the most time on. His idea is to use audio-compression technology to sell CD-quality music over the Internet. (His other company is a longer-term project called CoffeeHouse, which he hopes will make software that lets people interact on the Net in a "virtual world.") A thin, cheerful 18-year-old from Boston, Weekly happily demonstrates his digitized audio with a quick blast of techno dance music. "It's pretty cool!" he says, raising his voice over the noise. "The record companies are all very supportive, especially Geffen." The plan is to launch United Digital Media in a few months.

Is this for real, or a case of premature commerce? "I'm never quite sure," says Marc Levoy, the computer science professor whom Weekly considers his mentor. "But if his companies aren't for real, a hundred others could be, soon. That's how these things happen. I will consider it a success if I manage to keep him in school long enough to help him develop his judgment, teach him some things about technology."

Even on a campus as mad with dreams of startups as this one, Weekly's commercial ambitions seem unusually intense. Not by much, though. Intense ambition and nascent capitalism are everywhere in Silicon Valley, and much of that passion was born right here. With its pretty campus built around a cluster of Spanish mission-style buildings, Stanford may look like a gigantic, affluent Taco Bell filled with healthy-looking people out of a J. Crew catalogue, but it nourishes the Valley with world-class research. More than that, Stanford is the cause of Silicon Valley.

Herbert Hoover is probably Stanford's most famous alum--anyway, his name is all over campus--but a lesser-known figure had a far more profound impact on the university and, therefore, on all of American high technology: Frederick Terman. In the late 1930s, Terman was a professor of engineering who encouraged two of his students to turn a graduate thesis into a commercial product. The students set up shop in a now famous garage in Palo Alto; their names were William Hewlett and David Packard.

Perhaps the most amazing thing about the development of Silicon Valley and Stanford's role in it is how much all of this was planned. Terman was a visionary, frustrated with the tendency of smart people on the West Coast to head back East to get real jobs. He wanted to establish a center of technology in the area around Stanford, which in those days was noted for its orchards. Terman helped create a few crucial institutional links with industry, such as the Honors Cooperative Program, a part-time degree program for engineers at nearby companies that offered the same classes and faculty that on-campus students got. Terman was also behind the Stanford Research Park, one of the world's first industrial parks, established on university land in 1951.

Ever since, Stanford has kept up warm and productive relationships with businesses, and signs of this good will are evident all over the campus. The engineering school is endowed with a Yahoo! Professor. The Toshiba Classroom is on the same hall as the Mitsubishi Electric Corporation Classroom, the NEC Communications Classroom, and the Hewlett-Packard Auditorium, and they're all in the basement of the William Gates Computer Science Building. The Gates building is kitty-corner from the Paul G. Allen Center for Integrated Systems. (For what it's worth, the Gates building is more imposing than the Allen building. Also, the building named after Gates is a stand-alone structure, whereas Allen got his name on a building just by adding an annex--a backward-compatible upgrade, if you will. Draw your own psycho-architectural conclusions.)

The Stanford Research Park is filled: Hewlett-Packard has its headquarters there; Xerox PARC is just up the road. The Honors Cooperative still exists but is now part of a much larger program that includes a network that broadcasts classes to corporations all over the world. These formal relationships are important, but they're not the whole story. "Stanford is part of the broader Silicon Valley culture," says AnnaLee Saxenian, an economist at the University of California at Berkeley and author of Regional Advantage, which chronicles the development of Silicon Valley. "Much of what goes on between the university and industry has to do with people starting out as faculty or students. They keep in touch. People go back and forth from academia to industry. Much of this is informal."

It's impossible to list all the ways Stanford interacts with Silicon Valley. The university is a huge pool of talent that supplies the Valley with many of its engineers, lawyers, bankers, and venture capitalists, in addition to the odd billionaire entrepreneur. It's a source of fresh technology as well as a neutral meeting ground where industry types mix with faculty, students, and even competitors. Companies spin out of Stanford regularly: HP, of course, but also Sun Microsystems, Silicon Graphics, Cisco Systems, Yahoo. No one at Stanford seems to know exactly how many new companies are spinning off today. But then, what would be the point? It happens all the time, and startups appear and disappear so fast that counting them is fool's work. Many faculty members have part-time jobs in industry; many industry people have part-time faculty appointments. "I teach because it's a lot of fun," says Andrew S. Grove, a lecturer at the business school who runs Intel when he's not on campus.

Berkeley, Carnegie Mellon, Cal Tech, MIT, and every other superb research university in the country provides people and technology to Silicon Valley. Some would argue, in fact, that MIT is the nation's finest engineering school. None, however, has managed to surround itself with a thriving high-technology region the way Stanford has. What sets Stanford apart from other intellectual centers isn't that it contains extremely smart people with big ideas; it's that there are so many smart people right in the one part of the world tailor-made to take their ideas and turn them into something real--and often profitable.

Silicon Valley is suffused with a persistent optimism that overrides life's minor problems. Suppose you can't make an interview appointment because an accident on a freeway has caused multi-city gridlock (as happened one day in late May; earlier that day, another freeway was tied up by a gun-wielding motorist). No problem: Just work from your cell phone. Or suppose you can't afford to buy a porch in Palo Alto, where small starter homes can cost half a million dollars: You can always commute from San Francisco, which--as Paul Krugman, a very smart economist at MIT, will argue--is really becoming a suburb of Silicon Valley. There doesn't even appear to be much friction between young and old. It's not easy to find a locality where a 26-year-old entrepreneur will, without fear of committing generational treason, cheerfully recommend a Palo Alto restaurant to an out-of-town reporter because it's "hip and yuppie." (To most people under age 35, the words "hip" and "yuppie" cancel each other out.)

If, however, there's a problem in these parts that really is a problem, not an opportunity, it's a shortage of talent, especially of engineering talent. With the Valley in a protracted economic boom, the competition for new engineers is nasty. The Stanford engineering school awards about 1,350 engineering degrees a year at all degree levels, and recruiters are desperate to hire the people who earn them. It's come to the point where some would-be employers stake out particular classes. One such class in the engineering school is CS198, a by-application-only computer science course that teaches undergraduates how to teach computer science. Each student who takes the class becomes a section leader of CS106, an introductory computer science course. To get into CS198, applicants not only must be excellent in computer science but also must be able to communicate effectively and run a class; i.e., they must be gearheads who can talk, a highly desirable commodity in an industry famous for introverted, misanthropic dweebs. If a company hires one of the 50 or so section leaders in the course, it gets more than an articulate engineer; it also gets someone who knows ten more students who took CS106, which happens to be the most widely taken course on campus. An even sweeter prize is hiring one of the two student coordinators who run the weekly sessions of CS198--these are the people who interview applicants to the class. So a coordinator knows 100 or more section leaders, each of whom knows ten more students--it's like hiring a headhunting firm at entry-level pay. "If you get one of these coordinators, they can supply you with information about who's good for the next two years," says Joe Liemandt, CEO of Trilogy, an Austin, Texas, software company he founded eight years ago with a group of Stanford undergrads.

Another company that has tapped into this vein of talent is a software startup in Menlo Park called KartoffelSoft. Both founders took CS198. One, Justin Kitch, says that of the 40 people at the company, at least five are CS198 alumni. Other than Trilogy, Kitch says, KartoffelSoft's main competition in recruiting out of this group is Microsoft. According to Adam Nash, a current student coordinator, Apple and Netscape have also figured out the whole CS198 thing. (Nash is going to Apple after he graduates this summer.) Companies with strong CS198 connections occasionally dispatch one of their section-leader hires to the class to give recruiting pitches during pre-class announcements. This is no longer allowed, at least not officially, because, Nash explains, "it just got too distracting. But we're a little better at stating that policy than carrying it out."

Last year, according to VentureOne, a San Francisco research firm, of the $10.8 billion dollars of venture capital that flowed into startup companies nationwide, $2.8 billion went to companies in the Bay Area. A very large portion of that $2.8 billion came from the venture capitalists who work in a string of nondescript buildings along Sand Hill Road in Menlo Park. Across the street is part of Stanford's sprawling land; central campus isn't much farther. In fact, this huge pile of money waiting for the right entrepreneurs is approximately a three-mile or nine-minute drive (lights, traffic) from the parking lot across the street from the Terman engineering building, which is within walking distance of many of Stanford's places of research. It takes about the same amount of time to drive from this lot to the offices of Wilson Sonsini, the premier Silicon Valley law firm, or to Il Fornaio, the overpriced restaurant in Palo Alto where every lunch is a high-tech industry dealmaking event.

This propinquity of university, capital, and industry has a lot to do with why so many real-world Valley types are seen so often at Stanford. On any given day, you're almost guaranteed to find at least one seminar or cocktail party with one or more entrepreneur-heroes in attendance. Proximity especially pays off in case studies, that staple of business schools. Silicon Valley is filled with interesting cases to study, and it's usually no great effort for the principals involved to go to a class that's studying them.

On Tuesdays during the spring quarter at the Graduate School of Business, two extremely popular classes start at 10 a.m. One is Charles Holloway's High-Tech Entrepreneurship class, where the day's case is Arbor Software, a data-analysis software company founded in 1991. Holloway, the Kleiner Perkins Caufield & Byers Professor of Management, runs the class efficiently, occasionally calling on students by name before he even turns around from the blackboard to see whose hand is raised. He guides the 66 students in the lecture room through the formation of Arbor--how the company got financing and why management made certain decisions. The students are engaged, often baldly criticizing the moves made by Arbor's CEO. Jim Dorrian, the CEO, sitting in the front row where everybody can see him, occasionally smiles and nods as the students pick over his performance. Finally, Holloway turns the floor over to Dorrian. "This was remarkably close to what happened," Dorrian says, and proceeds to tell the class the real story.

On the other side of the building is Irv Grousbeck's Seminar in Selected Entrepreneurial Issues. Grousbeck, who co-founded Continental Cablevision and retired 17 years ago to teach, has finished leading a discussion of Heartport, a high-profile startup that has developed a method of minimally invasive heart surgery. co-founder and CEO Dr. Wes Sterman is standing at the front of the room decrying the pestilence of shareholder lawsuits. Beside him is one of Heartport's venture capitalists, Petri Vainio of Sierra Ventures. When it's Vainio's turn, the students get a brief talk on stock market volatility and how it has affected Heartport's share price. After class, Sterman explains he'd love to do this at other schools too, but who has the time? Besides, he has several degrees from Stanford, much of the company's technology was developed there, and his co-founder is still an assistant professor in the medical school.

Across campus at the engineering school, another class exploits its Valley connections: the Technology Ventures Co-op. TVC is a nine-month program in which students work as paid summer interns at local high-tech startups. Tom Byers, the industrial engineering faculty member who runs the program, handpicks a dozen or so students to take three months of class, three months of internship, and then three more months of class. Students are mostly engineering seniors on their way to a master's. One in five applicants gets in--they're impressive enough that host companies occasionally offer them stock options. "For a summer job," says Byers. "One of my biggest headaches in this program is dealing with the startups that don't get interns."

Everyone in the Valley seems to know Byers, which isn't too surprising given his work history (and his name: His older brother, Brook, is the "Byers" of the legendary venture capital firm Kleiner Perkins Caufield & Byers). Before becoming a full-time teacher four years ago, he'd spent a decade or so working at startups: Symantec, a software company that succeeded, and Slate, a pen computing company that didn't. He sits on the boards of two companies and is a consultant at Interval Research, Paul Allen's think tank. Byers is convinced that entrepreneurship can be taught, or at least demystified. He's also giving a dozen lucky potential entrepreneurs a chance to network with some big names in Silicon Valley who come in as guest speakers--venture capitalists such as John Doerr and Vinod Khosla of Kleiner Perkins and Jeff Yang of Institutional Venture Partners, and entrepreneur icons such as Andy Bechtolsheim, who helped start Sun Microsystems and, recently, Granite Systems.

By the final class of the semester, all the TVC students have their internships lined up. Some of the startups are quite high profile. One student is going to Marimba, an Internet software company that's been getting a lot of press lately. No one knows whether these startups will last, which is the whole idea. If a company takes off, however, things get interesting. Stephanie Hannon was an intern last summer at Bechtolsheim's startup, Granite Systems. She enjoyed working there and signed a contract to return full-time in January after she finished her master's. Between the time she signed the contract and her first day of work, Cisco acquired Granite for $220 million. This has had a salutary effect on Hannon's finances--the stock options she was granted are already worth, she says, "ballpark six figures" on paper.

A principal force driving Stanford's unending production of startups is this: So many people have started companies in the past that it just seems normal to get your degree (this step is optional), and take what you've learned and make a company out of it.

One startup role model, or more accurately one bunch of startup role models, can be traced to a single engineering building in the early 1980s: Margaret Jacks Hall, then home of the computer science department. Three startups hatched from technology developed there now have a combined market value of more than $50 billion. John Doerr, one of the Valley's most prominent venture capitalists, facetiously tells audiences that even an idiot could have been a successful venture capitalist (or VC, in Valley shorthand) in the early 1980s: All you had to do was hang around Margaret Jacks. Around 1980, Doerr, then a newly hired VC at Kleiner Perkins, started doing just that. On the second floor, a professor named Jim Clark was working on a project that would become Silicon Graphics. On the fourth, Andy Bechtolsheim, then a Ph.D. candidate, was building a prototype workstation for the Stanford University Network, or SUN, which would become Sun Microsystems. In the basement, a research computing director named Len Bosack, together with Sandy Lerner, his wife and counterpart at the business school, was coming up with ways to link the various computer networks woven throughout campus, an effort that became Cisco Systems. (Not everyone in Margaret Jacks went on to create billion-dollar computer companies. Ph.D. student David Shaw, for example, eventually started D.E. Shaw, a successful Wall Street trading firm, which in turn recently funded Juno, an E-mail service provider that's one of FORTUNE's Cool Companies this year.)

It was an exciting time. A new chip technology called very large scale integration, or VLSI, had made possible huge advances in microprocessor design. Researchers often lent one another a hand. "All the doors were open," says Doerr. "Everybody was really jazzed about what they were doing. They thought they had a chance to change the world, but they didn't quite know how to commercialize the technology they were working on." Apart from Clark, that is. Out of that group of people at Margaret Jacks, he was probably the most commercially minded. "I've been told that I went to Stanford with the express purpose of starting a company," says Clark, now chairman of Netscape. "I guess that's true."

Happily for the Margaret Jacks crew, Stanford didn't seem to mind too much that technology developed on campus was to be spun off into companies. The rules about what inventions and intellectual property Stanford has rights to are a bit confusing, but suffice it to say that the Office of Technology Licensing, which oversees these matters, didn't make things difficult for Clark or Bechtolsheim; Bosack and Lerner licensed their technology from Stanford for a nominal sum. Doerr made venture capital bets on two of the companies that sprang from the building: Sun and MIPS (a chip company that Silicon Graphics has since acquired). "I missed Cisco. Shame on me," he says with a shrug. "Guess I never made it down to the basement."

Such capitalist ferment is still going on--companies are constantly spinning out of Stanford. Sometimes it's a couple of graduate students who decide a project they're doing on the side is a company waiting to happen, which is how Yahoo! got started, but that's only one example. KartoffelSoft started with its co-founder's undergraduate honors thesis; a computer peripherals startup called Immersion began out of a Ph.D. student's work on how to create devices that let you feel what you see on a computer screen. Among the faculty of the engineering school, it seems harder to find people who have never had anything to do with a startup than the other way around: Both the former dean of the engineering school and the chairman of the computer science department are involved with companies they helped start.

A recent instance of a professor with a successful startup is David Cheriton, another member of the 1980s Margaret Jacks group. When Bechtolsheim left Sun in 1995 to start Granite, which is developing high-speed networking technology, he wanted a co-founder doing cutting-edge research in the field. "Dave was the first person I called," Bechtolsheim says. He quickly convinced Cheriton that a company made sense--$220 million worth of sense, as Cisco subsequently let Granite know in a most lucrative way.

This isn't to say that professors are encouraged to quit academia for good and go off empire-building the way Jim Clark did. Cheriton is still a professor in the computer science department and spends one day a week down at Cisco in San Jose. Faculty are not allowed to be full-time at outside companies, but they are encouraged to get out into industry part-time. (Part-time faculty like Andy Grove are free to pursue other interests.) Cheriton appreciates the university's accommodating policy toward the faculty's outside ventures, and so does Clark. "Anyone could have said to me, 'Wait, this isn't academic work,'" Clark says. "They don't get all huffy about the purity of academia."

The process by which Silicon Valley's mixture of technology, optimism, and money slops over onto Stanford can be amazing--and amusing--to watch. On one evening in early May, for example, the Business Association of Stanford Engineering Students is hosting VentureFest '97 in a large room in the student union. The room is packed with about 350 people, many of them nonstudents, all eager to meet the four venture capitalists sitting on the dais. The atmosphere is like a tent meeting with four preachers ready to breathe fire and a congregation that can't wait to get scorched.

The VCs give peppy talks filled with inspirational platitudes and practical advice. "We get a lot of business plans," one explains to the crowd. "I highly recommend you find someone to get you in the door," he adds, apparently not realizing that finding that someone is precisely why so many people are here to begin with.

After two hours of presentations and Q&A comes the moment the crowd has been waiting for: Meet the Venture Capitalists. There is a mass movement toward the front of the room as the audience parses itself into four groups, one for each VC. Thus begins an hour and a half or so of desperate schmoozing. A 40-ish guy, who says he's a physician from San Diego, tells a reporter he's seen it all before. "These guys are second tier," he says, gesturing dismissively toward the dais. "They're just looking for cheap labor." Clearly the VCs are having a delightful evening. Outside the main room, a smaller eddy forms when it's discovered that a reporter is about. Asked to guess how many of the students present are planning to start a company, a grad student says, "We all are. If not, maybe we'll go to McKinsey." This provokes a laugh from another student standing nearby. "Oh, come on," he teases, "and waste your education?"

For venture capitalists looking for deal fodder, an even better place to search is the annual Trilogy/Stanford Entrepreneur's Challenge. This is a contest that awards $15,000 to the best business plan from a pool of 34 student entries. (Several universities have similar competitions. The idea originated at MIT.) Teams of contestants from all over Stanford work for several months developing their ideas for the final judging, which takes place on May 23.

On the morning of judgment day it rains, which in Silicon Valley means major traffic tie-ups. Somehow, only one of the six judges shows up late: Ann Winblad of Hummer Winblad Venture Partners. Most, if not all, of the finalist entries are real business plans and have impressive technology, impressive personnel, or both. The presentations take place in a stuffy room in the Terman building, with most of the questioning done by Winblad, Rob Ryan (founder and ex-CEO of Ascend Communications), Joe Liemandt (of Trilogy), and Tom Kosnik, a consulting professor of engineering management who is an evangelist of entrepreneurship at the engineering school. The judges pay close attention and ask pointed questions. "But have you spoken to your potential customers?" Winblad asks one presenter, who hasn't. During a break, when asked how she finds time to devote nearly an entire day to hearing student presentations, she says, "I love this. This is such a great day. It's all part of a great food chain."

The winner is a team that wants to build a system it claims will make chip design more efficient. (The team won't find out they've won until a ceremony a few weeks later.) After this team finishes up and leaves the room, Liemandt says admiringly of its leader, "That guy could sell anything." Winblad also picks the team to win. "This guy's got all the right yuppified characteristics VCs in Silicon Valley love. He's got great teeth," she says. Then she looks at Liemandt and wryly adds, "You know what I'm talking about."

Whether the winning team will become a real company, or for that matter whether any of these teams will make it, the judges have no way of knowing. "One thing you can never tell," says Liemandt, "is how much of this is just an exercise and how much is their life."

Liemandt is always looking for people who want to devote themselves to creating high-tech companies, so it figures he's aware of David Weekly. Liemandt first heard of him through Christy Jones, a Trilogy co-founder who spun off an electronic commerce company called Last fall Weekly sent an E-mail to the company, critiquing its Website in detail. Impressed, Jones flew him to Austin to offer him a summer job. Weekly declined, saying he'd rather work on his projects at Stanford.

By May 28, the semester is almost over. For Weekly, it's been a busy month. When he first spoke to FORTUNE in late April, he only had the CoffeeHouse project to worry about. Now he's got United Digital Media, too. (He's also running an online consortium to gather support for the audio technology United Digital Media will use.) Despite the pressure, he's as enthusiastic as ever. Several weeks before the publication of this story, Weekly's Website began telling visitors to watch for an upcoming article in FORTUNE.

Weekly may decide to become an academic, or go into advertising, for that matter--or maybe he'll found the next Sun, Silicon Graphics, or Cisco. When he's asked if he's ever been to Margaret Jacks Hall, a quizzical expression crosses his face. "No, sorry." But now he has to get back to work. Starting companies takes a lot of time, and finals are only a couple of weeks away.