Skip to content

Commit

Permalink
Initial history of Pushup website
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsmith committed Dec 28, 2023
0 parents commit dbe26cb
Show file tree
Hide file tree
Showing 20 changed files with 1,030 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/build
.DS_Store
.direnv/
.envrc

9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.19 AS builder
WORKDIR /app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static'" -o /myproject ./build/cmd/myproject
FROM alpine
COPY --from=builder /myproject /
EXPOSE 8080
ENTRYPOINT [ "/myproject" ]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Pushup main website

This is the main website for the Pushup project, including documentation. It
is a Pushup app.
39 changes: 39 additions & 0 deletions app/layouts/default.up
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>^if sectionDefined("title") {
<text>^outputSection("title")</text>
} ^else {
<text>Pushup - page-oriented web framework for Go</text>
}</title>
<meta name="description" content="Pushup is a server-side page-oriented web application framework for Go.">
<link rel="icon" href="/static/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/static/style.css" />
<script src="/static/htmx.min.js"></script>
</head>
<body>
<nav>
<ul>
<li><a hx-boost="true" href="/">Pushup</a></li>
<li><a hx-boost="true" href="/docs/">Documentation</a></li>
<li><a href="https://github.com/adhocteam/pushup">GitHub</a></li>
</ul>
</nav>
<main>
^outputSection("contents")
</main>
<footer>
<p>
Copyright &copy; 2022.
Made with <a href="https://pushup.adhoc.dev/">Pushup</a>.
Supported by
<a class="adhoc" href="https://adhoc.team/"><img
src="/static/adhoc-logo.png"
alt="Ad Hoc logo"
width="91" height="91"> Ad Hoc</a>.
</p>
</footer>
</body>
</html>
6 changes: 6 additions & 0 deletions app/pages/docs/$doc.up
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
^handler {
doc := getParam(req, "doc")
rawMarkdown := GetStaticContents("docs/" + doc + ".md")
}

^convertMarkdown(rawMarkdown)
22 changes: 22 additions & 0 deletions app/pages/docs/index.up
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<h1>Pushup documentation</h1>

^{
type doc struct {
name string
url string
}
docs := []doc {
{name: "Introduction to Pushup", url: "intro"},
{name: "Getting started", url: "getting-started"},
{name: "Syntax", url: "syntax"},
{name: "Guides", url: "guides"},
}
}

<ul>
^for _, d := range docs {
<li>
<a hx-boost="true" href="^d.url">^d.name</a>
</li>
}
</ul>
103 changes: 103 additions & 0 deletions app/pages/index.up
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<header>
<h1>
<img
width="91" height="49"
src="/static/logo.png"
alt="Pushup logo, a caret surrounded by left and right angle brackets ala HTML element">
Pushup web framework
</h1>
</header>

<section>
<p>A server-side, page-oriented web framework for the Go programming language.</p>

<p>Pushup’s goal is to make it faster to develop and easier to maintain server-side web applications using Go.</p>

<p>Pushup is <b>preview</b>, pre-release software in early-stage development. It is not yet suitable for production use. Expect breaking changes.</p>
</section>

<iframe width="560" height="315" src="https://www.youtube.com/embed/nkyiATkZ4Js" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

<section id="code-example">
<h2>Pushup example</h2>
<pre><code><span class="keyword">^^import</span> <span class="go">"time"</span>

<span class="keyword">^^</span>{
<span class="go">title := "Hello, from Pushup!"</span>
}

<span class="html">&lt;h1&gt;</span><span class="simple-expr">^^title</span><span class="html">&lt;/h1&gt;</span>

<span class="html">&lt;p&gt;</span>The time is now <span class="simple-expr">^^time.Now().String()</span>.<span class="html">&lt;/p&gt;</span>

<span class="keyword">^^if</span> <span class="go">time.Now().Weekday() == time.Friday</span> {
<span class="html">&lt;p&gt;</span>It's Friday! Enjoy the start to your weekend.<span class="html">&lt;/p&gt;</span>
} <span class="keyword">^^else</span> {
<span class="html">&lt;p&gt;</span>Have a great day, we're glad you're here.<span class="html">&lt;/p&gt;</span>
}
</code></pre>
<p>File <kbd>app/pages/hello.up</kbd> → <kbd>/hello</kbd> URL path</p>
</section>

<section>
<h2>Features</h2>

<ul id="feature-list">
<li>
<strong>Page-oriented</strong>
<p>Pushup’s .up files are self-contained units of web app development, gluing HTML &amp; Go together with routing logic</p>
</li>
<li>
<strong>File-based routing</strong>
<p>Filesystem path names of Pushup pages map to URL paths, with dynamic escape hatches</p>
</li>
<li>
<strong>World’s first ‟<a href="https://htmx.org/">htmx</a>-first” framework</strong>
<p>Enhanced hypertext support via inline partials for better client-side interactivity with fewer JavaScript sit-ups</p>
</li>
<li>
<strong>Compiled</strong>
<p>Pushup apps compile to pure Go, built on the standard <code>net/http</code> package. Fast static binary executables for easy deployment. Easy to integrate into larger Go apps</p>
</li>
<li>
<strong>Hot reload dev mode</strong>
<p>App is recompiled and reloaded in the browser while files change during development. This is fast thanks to the Go compiler</p>
</li>
</ul>
</section>

<section>
<h2>Getting started</h2>

<ul>
<li><strong>Download Pushup</strong> preview release v0.1
<ul>
<li>Linux
<ul>
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-linux-arm64.zip">Linux AArch64</a></li>
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-linux-amd64.zip">Linux x86-64</a></li>
</ul>
</li>
<li>macOS
<ul>
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-darwin-arm64.zip">macOS Apple silicon</a></li>
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-darwin-amd64.zip">macOS x86-64</a></li>
</ul>
</li>
<li>OpenBSD
<ul>
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-openbsd-arm64.zip">OpenBSD AArch64</a></li>
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-openbsd-amd64.zip">OpenBSD x86-64</a></li>
</ul>
</li>
</ul>
<p>Download Pushup for more platforms on the <a href="https://github.com/adhocteam/pushup/releases">official releases page</a>.
</li>
<li><strong>Read the documentation</strong>
<p><a hx-boost="true" href="/docs/">Pushup docs</a></p>
</li>
<li><strong>Read the source &amp; join the community</strong>
<p><a href="https://github.com/adhocteam/pushup">GitHub repo</a></p>
</li>
</ul>
</section>
16 changes: 16 additions & 0 deletions app/pkg/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package build

import (
"bytes"
"html/template"

"github.com/yuin/goldmark"
)

func convertMarkdown(text []byte) template.HTML {
var buf bytes.Buffer
if err := goldmark.Convert(text, &buf); err != nil {
panic(err)
}
return template.HTML(buf.String())
}
Binary file added app/static/adhoc-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions app/static/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Getting started

To make a new Pushup app, first install the main Pushup executable.

### Installing Pushup

#### Prerequisites

- go 1.18 or later

Make sure the directory where the go tool installs executables is in your
`$PATH`. It is `$(go env GOPATH)/bin`. You can check if this is the case with:

```shell
echo $PATH | grep $(go env GOPATH)/bin > /dev/null && echo yes || echo no
```

#### Install via official release

Binary executables for multiple platforms are available for download on the
[project releases page](https://github.com/adhocteam/pushup/releases).

#### Install via git

```shell
git clone https://github.com/adhocteam/pushup
cd pushup
make
```

#### Install via `go install`

Make sure you have Go installed (at least version 1.18), and type:

```shell
go install github.com/adhocteam/pushup@latest
```

#### Install via `homebrew`

Coming soon.

#### Install via Linux package managers

Coming soon.

### Creating a new Pushup project

To create a new Pushup project, use the `pushup new` command.

```shell
pushup new
```

Without any additional arguments, it will attempt to create a scaffolded new
project in the current directory. However, the directory must be completely
empty, or the command will abort. To simulataneously make a new directory
and generate a scaffolded project, pass a relative path as argument:

```shell
pushup new myproject
```

The scaffolded new project directory consists of a directory structure for
.up files and auxiliary project Go code, and a go.mod file.

Change to the new project directory if necessary, then do a `pushup run`,
which compiles the Pushup project to Go code, builds the app, and starts up
the server.

```shell
pushup run
```

If all goes well, you should see a message on the terminal that the Pushup app
is running and listening on a port:

```
↑↑ Pushup ready and listening on 0.0.0.0:8080 ↑↑
```

By default it listens on port 8080, but with the `-port` or `-unix-socket`
flags you can pick your own listener.

Open [http://localhost:8080/](http://localhost:8080/) in your browser to see
the default layout and a welcome index page.

### Listing routes

You can print a list of all the routes in your Pushup project with the command
`pushup routes`.

The lefthand column is the URL route, where any dynamic path segments are
denoted with a leading `:` colon. The righthand column is the corresponding
Pushup page.

For example:

```shell
$ pushup routes
/about about.up
/album/:id album/$id.up
/album/delete/:id album/delete/$id.up
/album/edit/:id album/edit/$id.up
/album/new album/new.up
/album/ album/index.up
/dyn/:name dyn/$name.up
/htmx/active-search htmx/active-search.up
/htmx/click-to-load htmx/click-to-load.up
/htmx/ htmx/index.up
/htmx/value-select htmx/value-select.up
/ index.up
/projects/:pid/users/:uid projects/$pid/users/$uid.up
```
24 changes: 24 additions & 0 deletions app/static/docs/guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Guides

_Coming soon_

## Enhanced hypermedia

- How to use htmx with Pushup

## Deployment

- How to deploy a Pushup app using fly.io
- How to deploy a Pushup app using Netlify
- How to deploy a Pushup app using Render
- How to deploy a Pushup app using AWS

## Databases

- How to make Pushup app with SQLite
- How to make Pushup app with PostgreSQL

## App types

- How to make a CRUD app with Pushup
- How to make a static site with Pushup
Loading

0 comments on commit dbe26cb

Please sign in to comment.