Skip to content

Commit 645b071

Browse files
committed
Initial import from superstack repo
0 parents  commit 645b071

File tree

11 files changed

+603
-0
lines changed

11 files changed

+603
-0
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ⚠️ This workflow deploys docs to explodinglabs.com
2+
# It is active only in the official repo. Forks won't trigger deployment.
3+
name: Build and Deploy MkDocs
4+
5+
on:
6+
push:
7+
branches:
8+
- main # or your main development branch
9+
10+
jobs:
11+
deploy:
12+
if: github.repository == 'explodinglabs/superstack'
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout source repo
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.x
23+
24+
- name: Install dependencies
25+
run: pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin
26+
27+
- name: Build MkDocs site
28+
run: mkdocs build
29+
30+
- name: Clone target repo
31+
run: |
32+
git clone https://x-access-token:${{ secrets.TARGET_REPO_PAT }}@github.com/explodinglabs/explodinglabs.com.git target-repo
33+
rm -rf target-repo/$(basename "$GITHUB_REPOSITORY")
34+
mkdir -p target-repo/$(basename "$GITHUB_REPOSITORY")
35+
cp -a site/. target-repo/$(basename "$GITHUB_REPOSITORY")/
36+
env:
37+
GIT_AUTHOR_NAME: GitHub Actions
38+
GIT_COMMITTER_NAME: GitHub Actions
39+
GIT_AUTHOR_EMAIL: [email protected]
40+
GIT_COMMITTER_EMAIL: [email protected]
41+
42+
- name: Commit and push
43+
run: |
44+
cd target-repo
45+
git config user.name "Exploding Labs Bot"
46+
git config user.email "[email protected]"
47+
git add .
48+
git commit -m "Update site from docs source repo" || echo "No changes to commit"
49+
git push

docs/assets/getting-started.mp4

31.8 MB
Binary file not shown.

docs/assets/logo.png

68.1 KB
Loading

docs/deploying.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# ☁️ Deploying to Remote Environments
2+
3+
SuperStack is Docker-native, so deployment is simple and portable. Here's
4+
how to deploy it to a remote server.
5+
6+
## ✅ 1. Set Your Image Names
7+
8+
Change the image names to your own (e.g. using your Docker Hub or GitHub
9+
Container Registry account) in `compose.yaml`, for example:
10+
11+
```yaml
12+
postgres:
13+
image: ghcr.io/youruser/yourapp-postgres
14+
caddy:
15+
image: ghcr.io/youruser/yourapp-caddy
16+
```
17+
18+
## 🛠️ 2. Build and Push your Images
19+
20+
Build your images locally and push to your registry:
21+
22+
```sh
23+
docker compose build
24+
docker compose push
25+
```
26+
27+
## 📦 3. Deploy the Compose File
28+
29+
The only file needed for SuperStack to work on the remote server is
30+
`compose.yaml`.
31+
32+
Copy it to your server:
33+
34+
```sh
35+
scp compose.yaml youruser@yourserver:
36+
```
37+
38+
## 🚀 4. Launch your Stack
39+
40+
SSH into your server and bring up the stack.
41+
42+
For production, avoid using `.env` files. Instead, set secrets directly:
43+
44+
```sh
45+
CADDY_PORT=80 \
46+
PG_USER=admin \
47+
PG_PASS=supersecret \
48+
POSTGREST_AUTHENTICATOR_PASS=supersecret \
49+
JWT_SECRET=your-secret \
50+
docker compose up -d
51+
```
52+
53+
> 💡 Avoid leaking secrets by disabling shell history.
54+
55+
Alternatively, use environment injection in your CI/CD.
56+
57+
---
58+
59+
That’s it — your backend is live.
60+
61+
If this is the first time bringing up your stack, the migrations will run
62+
automatically. Subsequently, to upgrade your app you should:
63+
64+
```sh
65+
docker compose pull
66+
docker compose up -d
67+
docker compose exec postgres migrate
68+
```

docs/extensions.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 🧩 Postgres Extensions
2+
3+
SuperStack supports PostgreSQL extensions, letting you add powerful
4+
features like cryptographic functions or JWT handling.
5+
6+
## 🔌 Loading a Built-In Extension
7+
8+
To load a standard extension (like pgcrypto), create a migration file such
9+
as:
10+
11+
```sql
12+
-- File: postgres/migrations/01-extensions.sql
13+
14+
create extension pgcrypto;
15+
```
16+
17+
> ⚠️ `create extension` is non-transactional, so don’t wrap this file in
18+
> `BEGIN/COMMIT`.
19+
20+
## 🛠️ Building an Extension from Source
21+
22+
Some extensions (like [pgjwt](https://github.com/michelp/pgjwt)) must be
23+
compiled manually.
24+
25+
### 1. Clone the Extension Source
26+
27+
```sh
28+
git clone https://github.com/michelp/pgjwt postgres/pgjwt
29+
```
30+
31+
### 2. Modify the Postgres Dockerfile
32+
33+
Edit `postgres/Dockerfile` to install build tools and compile the
34+
extension:
35+
36+
```
37+
RUN apt-get update && apt-get install -y \
38+
build-essential \
39+
postgresql-server-dev-17
40+
41+
# pgjwt - used by the auth schema
42+
COPY ./pgjwt /pgjwt
43+
WORKDIR /pgjwt
44+
RUN make && make install
45+
46+
# Reset workdir
47+
WORKDIR /var/lib/postgresql
48+
```
49+
50+
> 🧼 Set `WORKDIR` back to the default to avoid unintended effects.
51+
52+
### 3. Rebuild the Container
53+
54+
```sh
55+
docker compose build postgres
56+
```
57+
58+
That’s it — the extension is now available to load in your migrations.

docs/gettingstarted.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# 🚀 Getting Started
2+
3+
<video controls width="100%">
4+
<source src="https://explodinglabs.com/assets/superstack-getting-started.mp4" type="video/mp4">
5+
Your browser does not support the video tag.
6+
Music: https://www.bensound.com
7+
License code: UZG5X7IWWLQOQEU1
8+
Artist: : Lunar Years
9+
</video>
10+
11+
SuperStack uses Docker, so make sure [Docker is
12+
installed](https://docs.docker.com/get-docker/) before you begin.
13+
14+
## 1. Get SuperStack
15+
16+
### Option 1: Use the Template (Recommended)
17+
18+
The easiest way to get started:
19+
20+
Click [Use this template](https://github.com/explodinglabs/superstack/generate)
21+
and create a new repository (e.g. `myapp`) on GitHub.
22+
23+
Clone it to your machine:
24+
25+
```sh
26+
git clone https://github.com/yourname/myapp.git
27+
cd myapp
28+
```
29+
30+
### Option 2: Clone and Track Upstream (Advanced)
31+
32+
If you want to keep SuperStack’s Git history and pull upstream changes later,
33+
clone SuperStack:
34+
35+
```sh
36+
git clone https://github.com/explodinglabs/superstack.git myapp
37+
cd myapp
38+
```
39+
40+
[Create your own repo](https://github.com/new), then:
41+
42+
```sh
43+
git remote rename origin upstream
44+
git remote add origin https://github.com/yourname/myapp.git
45+
git push -u origin main
46+
```
47+
48+
You can now pull upstream changes with:
49+
50+
```sh
51+
git pull upstream main
52+
```
53+
54+
## 2. Configure Environment Variables
55+
56+
Copy the example environment file:
57+
58+
```sh
59+
cp example.env .env
60+
```
61+
62+
This `.env` file is used to configure:
63+
64+
- **Secrets** – Passwords, keys, etc.
65+
- **Ports** – Adjust the exposed ports (specifically, Caddy's) depending on
66+
environment or application (you may bring up multiple).
67+
68+
> ⚠️ Important: The .env file is for local development only. Never store real
69+
> secrets in version control or production. Use CI/CD environment variables or
70+
> a secrets manager instead.
71+
72+
## 3. Start the Stack
73+
74+
```sh
75+
docker compose up -d
76+
```
77+
78+
That's it – your backend is live.
79+
80+
You can now open
81+
[http://localhost:8000/openapi/](http://localhost:8000/openapi/) to explore
82+
your API (assuming 8000 is your Caddy port).
83+
84+
---
85+
86+
## 🧩 What Just Happened?
87+
88+
SuperStack automatically:
89+
90+
1. Starts a fresh Postgres database
91+
2. Applies initial migrations
92+
3. Launches PostgREST and Swagger UI
93+
4. Serves everything through Caddy
94+
95+
```mermaid
96+
flowchart TD
97+
Caddy["Caddy (API Gateway)"]
98+
Caddy --> Services["Services (PostgREST, Swagger UI + more)"]
99+
Services --> Postgres
100+
```
101+
102+
> 💡 Only Caddy exposes a port – all services are routed through it.
103+
104+
## Project Structure
105+
106+
```
107+
📁 bin/ → Helper scripts (e.g. wrappers for CLI tools)
108+
📁 caddy/ → Custom Caddy configuration and certificates
109+
📁 docs/ → Markdown files for SuperStack documentation
110+
📁 postgres/ → SQL migrations and configuration of the postgres container
111+
📄 compose.yaml → Main Docker Compose config
112+
📄 compose.override.yaml → Optional local overrides (development only)
113+
📄 example.env → Example environment variables — copy to `.env`
114+
📄 LICENSE → License file (MIT)
115+
📄 logo.png → SuperStack logo for README/docs
116+
📄 mkdocs.yml → MkDocs configuration for documentation site
117+
📄 README.md → Overview and quick start for the repository
118+
```
119+
120+
## 🔄 Resetting
121+
122+
If you want to start fresh:
123+
124+
```sh
125+
docker compose down --volumes
126+
docker compose up -d
127+
```
128+
129+
This will wipe your database and re-run all migrations from scratch.
130+
131+
## ➕ What's Next?
132+
133+
👉 [Create your database schema with migrations](migrations.md)
134+
👉 [Deploy to a remote environment](deploying.md)

docs/index.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<style>
2+
.logo-responsive {
3+
float: right;
4+
padding-left: 2em;
5+
}
6+
7+
@media (max-width: 768px) {
8+
.logo-responsive {
9+
float: none;
10+
display: block;
11+
margin: 0 auto 2em;
12+
padding: 0;
13+
}
14+
}
15+
</style>
16+
17+
<img src="assets/logo.png" alt="SuperStack Logo" class="logo-responsive" />
18+
19+
# SuperStack
20+
21+
Jump to:
22+
[GitHub](https://github.com/explodinglabs/superstack) | [Developer Wiki](https://github.com/explodinglabs/superstack/wiki)
23+
24+
_SuperStack_ is a minimal, modular backend powered by PostgreSQL — perfect for
25+
indie developers, SaaS builders, and teams who want full rontrol without the
26+
bloat.
27+
28+
Spin up a fully working backend in seconds. Just clone, run, and start
29+
building.
30+
31+
---
32+
33+
## 🚀 What Can I Do with SuperStack?
34+
35+
It's perfect for:
36+
37+
- 🧱 Building SaaS apps
38+
- 💻 Running multiple stacks locally
39+
- 📦 Easy database migrations
40+
- 🔧 Customizing your toolchain
41+
42+
Everything runs inside Docker and routes through a single exposed port (via
43+
Caddy), making it easy to develop locally or deploy remotely.
44+
45+
---
46+
47+
## 📚 What's next?
48+
49+
👉 [Getting Started](gettingstarted.md) – a guide to installing SuperStack and
50+
launching the stack.

0 commit comments

Comments
 (0)