Skip to content

Commit 912ff4f

Browse files
committed
chore: setting up pipeline to deploy docs
1 parent ef8a175 commit 912ff4f

61 files changed

Lines changed: 6438 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/.dockerignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.next
3+
.source
4+
.git
5+
*.tsbuildinfo
6+
.env*

‎docs/.gitignore‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
.next/
3+
.source/
4+
out/
5+
*.tsbuildinfo
6+
.env*.local
7+
public/brand/
8+
!lib/
9+
!lib/**

‎docs/.nvmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

‎docs/Dockerfile‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build context is docs/, not the repository root.
2+
FROM node:22-alpine AS build
3+
WORKDIR /app
4+
ENV NEXT_TELEMETRY_DISABLED=1
5+
RUN npm install --global pnpm@9.8.0
6+
COPY package.json pnpm-lock.yaml source.config.ts ./
7+
RUN pnpm install --frozen-lockfile
8+
COPY . .
9+
RUN pnpm check && pnpm build
10+
11+
FROM node:22-alpine AS runner
12+
WORKDIR /app
13+
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 HOSTNAME=0.0.0.0 PORT=3000
14+
COPY --from=build --chown=node:node /app/.next/standalone ./
15+
COPY --from=build --chown=node:node /app/.next/static ./.next/static
16+
COPY --from=build --chown=node:node /app/public ./public
17+
USER node
18+
EXPOSE 3000
19+
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 CMD node -e "fetch('http://127.0.0.1:3000/superstac').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
20+
CMD ["node", "server.js"]

‎docs/README.md‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# SuperSTAC documentation
2+
3+
A Fumadocs / Next.js site for **https://spatialnode.com/superstac**, with the approved logo, a custom landing page, search, light/dark themes, and Python/Rust/CLI guides. Source content lives in `content/docs`; branding originals stay in `assets` for the repository READMEs.
4+
5+
## Develop
6+
7+
Use Node **22.19+** (the latest Node 22 LTS patch is recommended).
8+
9+
```bash
10+
cd docs
11+
nvm use
12+
npm install --global pnpm@9.8.0
13+
pnpm install --frozen-lockfile
14+
pnpm dev
15+
```
16+
17+
Open **http://localhost:3000/superstac**. The reference pages start at `/superstac/docs`. The `/superstac` base path is intentionally enabled in development so broken asset and search URLs can be caught before deployment.
18+
19+
```bash
20+
pnpm check
21+
pnpm build
22+
pnpm start
23+
# In another terminal, while the production server is running:
24+
pnpm test:links
25+
```
26+
27+
`test:links` visits all authored docs routes, checks rendered internal links and assets, and exercises the search endpoint. Set `DOCS_TEST_ORIGIN` if the server is on another port.
28+
29+
## Authoring
30+
31+
- Add Markdown or MDX pages in `content/docs`.
32+
- Set `title` and `description` in frontmatter and order pages in each folder's `meta.json`.
33+
- Link between docs using `/docs/...`. Next.js adds `/superstac` for these links.
34+
- Public asset/download URLs use `/superstac/...` explicitly; plain image URLs do not receive Next.js base-path handling.
35+
- Edit the complete downloadable YAML in `public/examples/superstac.yml` and keep the quickstart snippet in sync.
36+
- Build hooks copy the two approved SVGs from `assets` to `public/brand`. Do not edit generated copies.
37+
- The Spatialnode footer badge is in `public/powered-by-spatialnode.svg`; its dark variant preserves the paths with white lettering and a dark background. Both follow the site's theme toggle.
38+
- The runnable Python notebook lives in `public/notebooks/superstac-python-quickstart.ipynb`, served at `/superstac/notebooks/superstac-python-quickstart.ipynb`. Keep this single source of truth free of saved outputs, execution counts, credentials, and personal runtime metadata. Its documentation page is `content/docs/python/notebook.mdx`.
39+
- Verify examples against the source when the alpha API changes. The docs record current implementation behavior, including limitations; they do not promise future features.
40+
41+
Commit `pnpm-lock.yaml` whenever dependencies change. The Docker build uses pnpm 9.8.0 with `--frozen-lockfile`; dependency drift fails the build.
42+
43+
## Python notebook
44+
45+
Download [the notebook](public/notebooks/superstac-python-quickstart.ipynb) and upload it to Colab, or open it locally with Jupyter. Its cells install the Python dependencies when the reader runs them, search two public catalogs, show a footprint map, and export a ZIP of the results. They have not been executed against live catalogs here.
46+
47+
The direct **Open in Colab** links target this file on GitHub's `main` branch and become usable after it is pushed there. Before publishing an updated notebook, run all cells in a fresh runtime, check the diagnostics and downloaded results, then clear outputs and execution counts before saving it back to the repository.
48+
49+
## GitHub deployment automation
50+
51+
[Deploy docs](../.github/workflows/docs-deploy.yml) runs on **published GitHub releases**, including prereleases, and through **Actions → Deploy docs → Run workflow**. Ordinary pushes and tag creation alone do not deploy. Publish a release only when its corresponding package is available; the workflow does not publish packages or wait for a separate package-publishing workflow.
52+
53+
The workflow checks out the release tag or the manually supplied Git ref. It builds an AMD64 image, runs the Dockerfile's type check and production build, starts the resulting container, and checks pages, links, assets, search, and the 404 response. Only then does it publish to GHCR and deploy through the Coolify API. Use an x86-64 Coolify server for this workflow; an ARM server needs a matching runner/image platform.

‎docs/app/api/search/route.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { source } from '@/lib/source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
export const { GET } = createFromSource(source, { language: 'english' });

‎docs/app/docs/[[...slug]]/page.tsx‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { source } from '@/lib/source';
2+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page';
3+
import { notFound } from 'next/navigation';
4+
import { getMDXComponents } from '@/mdx-components';
5+
import type { Metadata } from 'next';
6+
import { PoweredBySpatialnode } from '@/components/powered-by-spatialnode';
7+
8+
type Props = { params: Promise<{ slug?: string[] }> };
9+
export default async function Page({ params }: Props) {
10+
const { slug } = await params;
11+
const page = source.getPage(slug);
12+
if (!page) notFound();
13+
const MDX = page.data.body;
14+
return (
15+
<DocsPage toc={page.data.toc}>
16+
<DocsTitle>{page.data.title}</DocsTitle>
17+
<DocsDescription>{page.data.description}</DocsDescription>
18+
<DocsBody><MDX components={getMDXComponents()} /></DocsBody>
19+
<div className="doc-endnote">
20+
<PoweredBySpatialnode/>
21+
<a href={`https://github.com/spatialnode/superstac/edit/main/docs/content/docs/${page.path}`}>Edit this page ↗</a>
22+
</div>
23+
</DocsPage>
24+
);
25+
}
26+
export function generateStaticParams() { return source.generateParams(); }
27+
export async function generateMetadata({ params }: Props): Promise<Metadata> {
28+
const page = source.getPage((await params).slug);
29+
if (!page) notFound();
30+
return { title: page.data.title, description: page.data.description, alternates: { canonical: `/superstac${page.url}` } };
31+
}

‎docs/app/docs/layout.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
2+
import { source } from '@/lib/source';
3+
import { baseOptions } from '@/lib/layout.shared';
4+
5+
export default function Layout({ children }: { children: React.ReactNode }) {
6+
return (
7+
<DocsLayout {...baseOptions()} tree={source.getPageTree()} sidebar={{ banner: <div className="sidebar-version"><span className="tiny-dot" /> v0.1 · Alpha</div> }}>
8+
{children}
9+
</DocsLayout>
10+
);
11+
}

‎docs/app/global.css‎

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/app/layout.tsx‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { Metadata } from 'next';
2+
import { RootProvider } from 'fumadocs-ui/provider/next';
3+
import './global.css';
4+
5+
export const metadata: Metadata = {
6+
metadataBase: new URL('https://spatialnode.com'),
7+
title: { default: 'SuperSTAC — Many catalogs. One search.', template: '%s | SuperSTAC' },
8+
description: 'Search across STAC catalogs through one interface, with Python, Rust, or the command line. A Spatialnode open-source project.',
9+
icons: { icon: '/superstac/favicon.svg' },
10+
};
11+
12+
export default function RootLayout({ children }: { children: React.ReactNode }) {
13+
return (
14+
<html lang="en" suppressHydrationWarning>
15+
<body>
16+
<RootProvider theme={{ storageKey: 'superstac-theme' }} search={{ options: { api: '/superstac/api/search' } }}>
17+
{children}
18+
</RootProvider>
19+
</body>
20+
</html>
21+
);
22+
}

0 commit comments

Comments
 (0)