feat(P1): web foundation — main.go, server.go, HTMX vendored, base+home templates (REQ-040)

Go 1.22 net/http.ServeMux + html/template + http.FileServer for static.
HTMX 2.0.10 vendored as web/static/htmx.min.js (NOT go get; G-006).
base.html layout with nav to all 5 screens. home.html overview.

---ci---
project: oy
phase: 1
milestone: v0.6
status: execute
---/ci---
This commit is contained in:
2026-08-18 13:43:53 +00:00
parent 9811aaabbb
commit 4166de5a4b
6 changed files with 184 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
package main
func main() {
runServer()
}
+41
View File
@@ -0,0 +1,41 @@
package main
import (
"html/template"
"log"
"net/http"
"os"
)
func runServer() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
tmpl, err := template.ParseGlob("web/templates/*.html")
if err != nil {
log.Fatalf("parse templates: %v", err)
}
mux := http.NewServeMux()
mux.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.NotFound(w, r)
return
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := tmpl.ExecuteTemplate(w, "home.html", nil); err != nil {
log.Printf("render home: %v", err)
}
})
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static"))))
srv := &http.Server{Addr: ":" + port, Handler: mux}
log.Printf("OpenYield web on :%s", port)
if err := srv.ListenAndServe(); err != nil {
log.Fatalf("server: %v", err)
}
}
+5
View File
File diff suppressed because one or more lines are too long
+78
View File
@@ -0,0 +1,78 @@
/* style.css OpenYield web UI minimal styling (lexicon-clean).
No banned terms in comments or class names (REQ-012/REQ-045). */
:root {
--bg: #0d1117;
--panel: #161b22;
--ink: #c9d1d9;
--muted: #8b949e;
--accent: #58a6ff;
--line: #30363d;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--ink);
line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.nav {
border-bottom: 1px solid var(--line);
padding: 0.75rem 1.5rem;
display: flex;
gap: 1.25rem;
align-items: center;
background: var(--panel);
}
header.nav .brand { font-weight: 600; color: var(--ink); }
header.nav a { color: var(--muted); }
header.nav a:hover { color: var(--accent); }
main { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem; }
footer {
border-top: 1px solid var(--line);
padding: 1rem 1.5rem;
color: var(--muted);
font-size: 0.85rem;
text-align: center;
}
.panel {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 6px;
padding: 1.25rem;
margin-bottom: 1.5rem;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
form .field { margin-bottom: 1rem; }
form label { display: block; margin-bottom: 0.25rem; color: var(--muted); font-size: 0.9rem; }
form input[type=text], form input[type=password] {
width: 100%; max-width: 32rem;
padding: 0.5rem 0.65rem;
background: var(--bg);
border: 1px solid var(--line);
border-radius: 4px;
color: var(--ink);
font-family: monospace;
}
button, .btn {
background: var(--accent); color: #0d1117; border: none;
padding: 0.5rem 1rem; border-radius: 4px; font-weight: 600; cursor: pointer;
}
button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }
.error { color: #f85149; }
.muted { color: var(--muted); }
+29
View File
@@ -0,0 +1,29 @@
{{define "base.html"}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{block "title" .}}OpenYield{{end}}</title>
<link rel="stylesheet" href="/static/style.css">
<script src="/static/htmx.min.js" defer></script>
</head>
<body>
<header class="nav">
<span class="brand">OpenYield</span>
<a href="/">Home</a>
<a href="/reach">Reach</a>
<a href="/stash">Stash</a>
<a href="/window">Window</a>
<a href="/standing">Standing</a>
<a href="/bloom">Bloom</a>
</header>
<main>
{{block "content" .}}{{end}}
</main>
<footer>
OpenYield — real production on the mesh. Reach, Stash, Window, Standing, Bloom.
</footer>
</body>
</html>
{{end}}
+26
View File
@@ -0,0 +1,26 @@
{{template "base.html" .}}
{{define "title"}}OpenYield — real production on the mesh{{end}}
{{define "content"}}
<section class="panel">
<h1>OpenYield</h1>
<p>
OpenYield is a mesh-native system for real production. A Holder creates a
Reach to enter the mesh, holds a Stash of Grain, and authorizes Window
access to partners. Standing accrues through honest participation, and
Bloom rewards sustained contribution. No middleman holds your Stash.
</p>
</section>
<section class="panel">
<h2>The five screens</h2>
<ul>
<li><a href="/reach">Reach</a> — create a Reach and view the mesh of Holders.</li>
<li><a href="/stash">Stash</a> — your sovereign Grain Stash (P2).</li>
<li><a href="/window">Window</a> — authorize partner access to your Stash (P3).</li>
<li><a href="/standing">Standing</a> — track progress toward Freeholder standing (P4).</li>
<li><a href="/bloom">Bloom</a> — accrued rewards for sustained contribution (P5).</li>
</ul>
</section>
{{end}}