commit f4facbac7cf6e1607e9aea3cade4b6b40205e8c8 Author: Chandler Swift Date: Wed Dec 17 20:10:28 2025 -0600 Initial Pass diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2960e3b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.gguf +svs-services-server diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6274c2 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +I'm building a website for a joke company, that provides every service ever invented. The company's website is svsindustries.org. When going to, say, webdesign.svsindustries.org, the user will be presented with a site advertising SVS Industries' web design prowess. Similarly for, say, plumbing.svsindustries.org, hvac.svsindustries.org, management-consulting.svsindustries.org, landscaping.svsindustries.org, travel-nursing.svsindustries.org, etc. All companies have the same three employees: Chandler Swift, Eric Villnow, and Isaac Swift. + +The sever will be implemented in Go, and will live behind a Caddy load balancer providing TLS termination. It should pick up the requested host, and generate content based on that. It will use a template, currently templates/a.html. That template will contain slots for the variable content. The program will fill up a Page struct (detailed later) and use that to render the page. +```go +type Color struct { // may have .rgba() and .hex() and similar functions + // something that can encode color +} +type Theme struct { + AccentColor Color + SecondaryColor Color + BackgroundColor Color + // possibly more? +} +type Testimonial struct { + Name string // Barack Obama + Position string // Frequent Design Admirer + Content string // I can't believe how good these were. After the Obamacare Website, I knew it's important to get a website right on the first try, and boy did these gentlemen manage! +} +type Page struct { + Theme Theme + Title string // "SVS Web Design" + Tagline string // "Custom websites cooked to order" + WhatWeDo string // 2-4 paragraphs following a "What We Do" header selling our incredible + ChandlerBio string // Chandler has years of experience in the [...] sector + EricBio string + IsaacBio string +} +``` + +The server will keep a cache of all previous responses, to avoid time-consuming and inconsistent results. The cache will be stored in a sqlite database, with a single table with two columns, host and content; `host` will be e.g. `webdesign`; content will be a JSON encoding of the Page struct above. + +There will be a 404 page that fits the primary theme of each site (e.g. for webdesign.svsindustries.org/about-us we'll return a 404 that uses the Theme, Title, and Tagline for `webdesign.svsindustries.org` to generate a fairly generic 404 page.) + +To start, generate main.go. + +# GGUF + +https://huggingface.co/QuantFactory/SmolLM-135M-GGUF/resolve/main/SmolLM-135M.Q8_0.gguf?download=true diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b35aab5 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.chandlerswift.com/chandlerswift/svs-services-server + +go 1.25.4 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/headshots/chandlerswift.jpg b/headshots/chandlerswift.jpg new file mode 100644 index 0000000..1728ad4 Binary files /dev/null and b/headshots/chandlerswift.jpg differ diff --git a/headshots/ericvillnow.jpg b/headshots/ericvillnow.jpg new file mode 100644 index 0000000..5f8249c Binary files /dev/null and b/headshots/ericvillnow.jpg differ diff --git a/headshots/isaacswift.jpg b/headshots/isaacswift.jpg new file mode 100644 index 0000000..8cc1eff Binary files /dev/null and b/headshots/isaacswift.jpg differ diff --git a/main.go b/main.go new file mode 100644 index 0000000..4424e7a --- /dev/null +++ b/main.go @@ -0,0 +1,103 @@ +package main + +import ( + "embed" + "html/template" + "net/http" + "time" +) + +//go:embed templates/index.html +var indexHTML string + +//go:embed templates/404.html +var notFoundHTML string + +//go:embed headshots/* +var headshots embed.FS + +type Color struct { // may have .rgba() and .hex() and similar + Hex string + // something that can encode color +} + +type Theme struct { + AccentColor Color + SecondaryColor Color + BackgroundColor Color + // possibly more? +} + +type Testimonial struct { + Name string + Position string + Quote string +} + +type Page struct { + Theme Theme + Occupation string + Tagline string + WhatWeDo string + ChandlerBio string + EricBio string + IsaacBio string + Testimonials []Testimonial + CurrentYear int +} + +func getPageDataForHost(host string) Page { + return Page{ + Theme: Theme{ + AccentColor: Color{ + Hex: "#FF5733", + }, + SecondaryColor: Color{ + Hex: "#33C1FF", + }, + BackgroundColor: Color{ + // Creamy off-white + Hex: "#FFF8E7", + }, + }, + Occupation: "Web Design", + Tagline: "Custom websites cooked to order", + WhatWeDo: "Lorem Ipsum…", + ChandlerBio: "Chandler has years of experience in the [...] sector", + EricBio: "Eric is a seasoned professional in [...]", + IsaacBio: "Isaac specializes in [...]", + Testimonials: []Testimonial{ + { + Name: "Barack Obama", + Position: "Poolhall acquaintance", + Quote: "After the fiasco of the ACA Website, I know how important it is to get a website right on the first try, and boy do these gentlemen deliver!", + }, + { + Name: "Ada Lovelace", + Position: "Pioneer of Computing", + Quote: "The elegance and functionality of the websites created by SVS Web Design are truly ahead of their time.", + }, + { + Name: "Steve Jobs", + Position: "Visionary Entrepreneur", + Quote: "Design is not just what it looks like and feels like. Design is how it works. SVS Web Design understands this principle deeply.", + }, + }, + CurrentYear: time.Now().Year(), + } +} + +var tmpl = template.Must(template.New("index").Parse(indexHTML)) + +func main() { + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + host := r.Host + pageData := getPageDataForHost(host) + // Render indexHTML as template + tmpl.Execute(w, pageData) + }) + // Serve embedded headshots file + http.Handle("/headshots/", http.FileServer(http.FS(headshots))) + + http.ListenAndServe(":8080", nil) +} diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..ca1fe7c --- /dev/null +++ b/templates/index.html @@ -0,0 +1,189 @@ + + + + + + + Swift, Villnow & Swift Industries: {{.Occupation}} + + + + + + + + + + + +
+
+

SVS Industries

+

{{.Occupation}}

+

{{.Tagline}}

+ Meet Our Team +
+
+ + +
+
+

What We Do

+
+
+ {{.WhatWeDo}} +
+
+
+
+ + +
+
+

About Us

+
+ +
+ Chandler Swift +

Chandler Swift

+
+ {{.ChandlerBio}} +
+ chandlerswift.com +
+
+
+ Developer 2 +

Eric Villnow

+
+ {{.EricBio}} +
+ vill.now +
+
+
+ Isaac Swift +

Isaac Swift

+
+ {{.IsaacBio}} +
+ isaacswift.com + +
+ +
+
+
+ +
+
+

What Our Clients Say

+ +
+
+ + + + + + + + +