title_body: What is the minimum required content for a valid ePub? I would like to create my own ePub documents from scratch without a tool so that I have full control over the final result.
  
  What is the absolute minimum set of required files to have a valid ePub file? Or, to put it in programming terms, what would an ePub "Hello, world." file look like?
upvoted_answer: Here's an epub 3.0 file that validates with epubcheck 3.0.1 (the current version at the time of writing). There's plenty more info that can (and should) go in there, of course, but you asked for minimums. We'll start with file structure:  in the root directory, there's one mimetype file and two folders--the OEBPS and the META-INF. Here's the mimetype file contents:
  
  application/epub+zip
  
  
  be sure not to have any return/line break characters in there.
  In the META-INF folder, there's one file, the container.xml:
  
  &lt;?xml version="1.0"?&gt;
  &lt;container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"&gt;
    &lt;rootfiles&gt;
      &lt;rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/&gt;
    &lt;/rootfiles&gt;
  &lt;/container&gt;
  
  
  In the OEBPS folder, things get slightly more complex. First is the content.opf file:
  
  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;package xmlns="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/" unique-identifier="db-id" version="3.0"&gt;
  
  &lt;metadata&gt;
      &lt;dc:title id="t1"&gt;Title&lt;/dc:title&gt;
      &lt;dc:identifier id="db-id"&gt;isbn&lt;/dc:identifier&gt;
      &lt;meta property="dcterms:modified"&gt;2014-03-27T09:14:09Z&lt;/meta&gt;
      &lt;dc:language&gt;en&lt;/dc:language&gt;
  &lt;/metadata&gt;
  
  &lt;manifest&gt;
      &lt;item id="toc" properties="nav" href="toc.xhtml" media-type="application/xhtml+xml" /&gt;
      &lt;item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" /&gt;
      &lt;item id="template_css" href="template.css" media-type="text/css" /&gt;
      &lt;item id="hello" href="1_hello.xhtml" media-type="application/xhtml+xml" /&gt;
  &lt;/manifest&gt;
  
  &lt;spine toc="ncx"&gt;
      &lt;itemref idref="hello" /&gt;
  &lt;/spine&gt;
  
  &lt;/package&gt;
  
  
  Then comes the toc.xhtml file:
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"&gt;
  &lt;head&gt;
  &lt;title&gt;toc.xhtml&lt;/title&gt;
  &lt;link href="template.css" rel="stylesheet" type="text/css" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;nav id="toc" epub:type="toc"&gt;
          &lt;h1 class="frontmatter"&gt;Table of Contents&lt;/h1&gt;
          &lt;ol class="contents"&gt;
                 &lt;li&gt;&lt;a href="1_hello.xhtml"&gt;Hello&lt;/a&gt;&lt;/li&gt;
          &lt;/ol&gt;
  
      &lt;/nav&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  
  
  And finally we have the content of the ebook itself, in this case 1_hello.xhtml:
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"&gt;
  &lt;head&gt;
  &lt;title&gt;1_hello.xhtml&lt;/title&gt;
  &lt;link href="template.css" rel="stylesheet" type="text/css" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;h1&gt;Hello World!&lt;/h1&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  
  
  As a bonus, there's a toc.ncx file. This is not required to be valid, but it's required if you want the book to have a working Table of Contents on epub 2.0.1 devices (which is pretty much all of them):
  
  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;ncx version="2005-1" xml:lang="en" xmlns="http://www.daisy.org/z3986/2005/ncx/"&gt;
  
  &lt;head&gt;
      &lt;meta name="dtb:uid" content="isbn"/&gt;
      &lt;meta name="dtb:depth" content="1"/&gt;
  &lt;/head&gt;
  
  &lt;docTitle&gt;
      &lt;text&gt;&lt;/text&gt;
  &lt;/docTitle&gt;
  
  &lt;navMap&gt;
      &lt;navPoint id="hello" playOrder="1"&gt;
          &lt;navLabel&gt;&lt;text&gt;cover&lt;/text&gt;&lt;/navLabel&gt;
          &lt;content src="1_hello.xhtml" /&gt;
      &lt;/navPoint&gt;
  &lt;/navMap&gt;
  
  &lt;/ncx&gt;
  
  
  And there's also the template.css in there, which is just a CSS stylesheet. In this case, it looks like this:
  
  h1 {
    text-align: center;
  }
  
  
  And that's it! For more complex stuff, there are a number of free epub 3 samples available at https://code.google.com/p/epub-samples/.