Skip to content

Commit b364cd0

Browse files
committed
feat: add Auth HI! documentation site with Nextra
- Set up Nextra 4 docs site with GitHub Pages deployment - Add comprehensive guides (getting started, patterns, examples, troubleshooting) - Include privacy policy and support pages for Chrome Web Store
1 parent d35f510 commit b364cd0

20 files changed

+5356
-6
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/deploy-docs.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: 'pages'
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v6
33+
with:
34+
node-version: 22
35+
cache: 'pnpm'
36+
cache-dependency-path: 'docs/pnpm-lock.yaml'
37+
38+
- name: Install dependencies
39+
working-directory: docs
40+
run: pnpm install
41+
42+
- name: Build
43+
working-directory: docs
44+
run: pnpm build
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: docs/out
50+
51+
deploy:
52+
runs-on: ubuntu-latest
53+
needs: build
54+
permissions:
55+
pages: write
56+
id-token: write
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: deploy-pages@v4
64+

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Next.js
5+
.next/
6+
out/
7+
8+
# Build output
9+
*.tsbuildinfo
10+
11+
# TypeScript
12+
next-env.d.ts
13+
14+
# Logs
15+
*.log
16+
npm-debug.log*
17+
18+
# OS
19+
.DS_Store
20+

docs/app/[[...mdxPath]]/page.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { useMDXComponents } from 'nextra-theme-docs';
2+
import { generateStaticParamsFor, importPage } from 'nextra/pages';
3+
4+
export const generateStaticParams = generateStaticParamsFor('mdxPath');
5+
6+
export async function generateMetadata(props: { params: Promise<{ mdxPath?: string[] }> }) {
7+
const params = await props.params;
8+
const { metadata } = await importPage(params.mdxPath);
9+
return metadata;
10+
}
11+
12+
export default async function Page(props: { params: Promise<{ mdxPath?: string[] }> }) {
13+
const params = await props.params;
14+
const result = await importPage(params.mdxPath);
15+
const { default: MDXContent, ...rest } = result;
16+
const { wrapper: Wrapper } = useMDXComponents();
17+
18+
return (
19+
<Wrapper {...rest}>
20+
<MDXContent />
21+
</Wrapper>
22+
);
23+
}

docs/app/globals.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:root {
2+
--nextra-primary-hue: 263deg;
3+
--nextra-primary-saturation: 70%;
4+
}
5+

docs/app/layout.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Footer, Layout, Navbar } from 'nextra-theme-docs';
2+
import { Head } from 'nextra/components';
3+
import { getPageMap } from 'nextra/page-map';
4+
import 'nextra-theme-docs/style.css';
5+
import './globals.css';
6+
7+
export const metadata = {
8+
title: {
9+
default: 'Auth HI!',
10+
template: '%s | Auth HI!',
11+
},
12+
description:
13+
'Chrome extension for injecting authentication headers into requests. Say hi to hassle-free auth headers.',
14+
};
15+
16+
const logo = (
17+
<span style={{ fontWeight: 'bold' }}>
18+
<span style={{ color: '#7c3aed' }}>Auth</span> <span style={{ color: '#10b981' }}>HI!</span>
19+
</span>
20+
);
21+
22+
export default async function RootLayout({ children }: { children: React.ReactNode }) {
23+
const pageMap = await getPageMap();
24+
25+
return (
26+
<html lang="en" dir="ltr" suppressHydrationWarning>
27+
<Head faviconGlyph="🔐" />
28+
<body>
29+
<Layout
30+
pageMap={pageMap}
31+
docsRepositoryBase="https://github.com/prosdevlab/auth-header-injector/tree/main/docs/content"
32+
editLink="Edit this page on GitHub"
33+
sidebar={{ defaultMenuCollapseLevel: 1 }}
34+
navbar={
35+
<Navbar logo={logo} projectLink="https://github.com/prosdevlab/auth-header-injector" />
36+
}
37+
footer={<Footer>MIT {new Date().getFullYear()} © prosdevlab</Footer>}
38+
>
39+
{children}
40+
</Layout>
41+
</body>
42+
</html>
43+
);
44+
}

docs/content/_meta.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
index: 'Home',
3+
'getting-started': 'Getting Started',
4+
guide: 'Guide',
5+
privacy: 'Privacy Policy',
6+
support: 'Support',
7+
};

docs/content/getting-started.mdx

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Getting Started
2+
3+
Get up and running with Auth HI! in minutes.
4+
5+
## Installation
6+
7+
### From Chrome Web Store
8+
9+
> 🚀 **Coming Soon** - Extension is currently in review
10+
11+
Once published, click "Add to Chrome" from the Chrome Web Store listing.
12+
13+
### From Source
14+
15+
If you want to build from source or contribute:
16+
17+
```bash
18+
# Clone the repository
19+
git clone https://github.com/prosdevlab/auth-header-injector.git
20+
cd auth-header-injector
21+
22+
# Install dependencies
23+
pnpm install
24+
25+
# Build the extension
26+
pnpm build
27+
28+
# Load in Chrome
29+
# 1. Open chrome://extensions/
30+
# 2. Enable "Developer mode"
31+
# 3. Click "Load unpacked"
32+
# 4. Select the `dist` folder
33+
```
34+
35+
## First Steps
36+
37+
### 1. Open the Side Panel
38+
39+
Click the extension icon in your Chrome toolbar. The side panel will open on the right side of your browser.
40+
41+
### 2. Enable the Extension
42+
43+
Toggle the "Enable extension" switch at the top of the panel.
44+
45+
### 3. Add Your First Rule
46+
47+
Click "Add Rule" and fill in:
48+
49+
- **Pattern**: URL pattern to match (e.g., `*.api.example.com`)
50+
- **Token**: Your Bearer token (just the token, not "Bearer ...")
51+
- **Label**: Optional friendly name (e.g., "Staging API")
52+
53+
Click "Save" and you're done!
54+
55+
### 4. Verify It's Working
56+
57+
1. Navigate to a page that makes API calls matching your pattern
58+
2. Check the "Context Bar" at the top - it shows matched rules
59+
3. See request counts increase as API calls are intercepted
60+
4. Open DevTools → Network tab → Check request headers
61+
62+
## Example: GitHub API
63+
64+
Let's set up auth for GitHub's API:
65+
66+
**Pattern**: `*github.com`
67+
**Token**: `ghp_yourPersonalAccessToken`
68+
**Label**: `GitHub API`
69+
70+
Now any requests to `github.com` or `api.github.com` will include your auth token automatically!
71+
72+
## Next Steps
73+
74+
- Learn about [URL Pattern Matching](/guide/patterns)
75+
- Explore [Common Use Cases](/guide/examples)
76+
- Check out [Troubleshooting](/guide/troubleshooting) if something's not working
77+
78+
## Need Help?
79+
80+
- [GitHub Issues](https://github.com/prosdevlab/auth-header-injector/issues) - Report bugs
81+
- [GitHub Discussions](https://github.com/prosdevlab/auth-header-injector/discussions) - Ask questions
82+

docs/content/guide/_meta.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
patterns: 'URL Patterns',
3+
examples: 'Examples',
4+
troubleshooting: 'Troubleshooting',
5+
};

docs/content/guide/examples.mdx

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Examples
2+
3+
Real-world examples of Auth HI! configurations.
4+
5+
## Multi-Environment API
6+
7+
Configure different tokens for dev, staging, and production:
8+
9+
```
10+
# Development
11+
Pattern: api.dev.example.com
12+
Token: dev_token_here
13+
Label: Dev API
14+
15+
# Staging
16+
Pattern: api.staging.example.com
17+
Token: staging_token_here
18+
Label: Staging API
19+
20+
# Production
21+
Pattern: api.example.com
22+
Token: prod_token_here
23+
Label: Production API
24+
```
25+
26+
## GitHub Personal Access Token
27+
28+
Access GitHub APIs with your PAT:
29+
30+
```
31+
Pattern: *github.com
32+
Token: ghp_yourPersonalAccessToken
33+
Label: GitHub API
34+
```
35+
36+
This covers:
37+
- `github.com/api/...`
38+
- `api.github.com/...`
39+
- `raw.githubusercontent.com/...`
40+
41+
## Internal Company Services
42+
43+
Match multiple internal services:
44+
45+
```
46+
Pattern: *.company.internal
47+
Token: your_internal_token
48+
Label: Internal Services
49+
```
50+
51+
Matches all internal subdomains but not the base domain.
52+
53+
## Third-Party API with Multiple Endpoints
54+
55+
```
56+
Pattern: *://api.service.com/*
57+
Token: your_api_key
58+
Label: Service API
59+
```
60+
61+
Explicit scheme and path matching for precise control.
62+
63+
## Testing Local Development
64+
65+
```
66+
Pattern: localhost:3000
67+
Token: dev_token
68+
Label: Local API
69+
```
70+
71+
Perfect for local development against your own API.
72+
73+
## Multiple Rules for Same Domain
74+
75+
You can have multiple rules that match the same domain. They'll all be applied:
76+
77+
```
78+
# Rule 1: General API access
79+
Pattern: *api.example.com
80+
Token: general_token
81+
Label: Example API
82+
83+
# Rule 2: Specific service
84+
Pattern: auth.api.example.com
85+
Token: auth_service_token
86+
Label: Auth Service
87+
```
88+
89+
Both rules will inject their tokens when matching requests occur.
90+
91+
## Pro Tips
92+
93+
1. **Use labels** - Make it easy to identify rules at a glance
94+
2. **Start broad** - Use `*domain.com` first, then narrow if needed
95+
3. **Test incrementally** - Add one rule, verify it works, then add more
96+
4. **Check the context bar** - Shows which rules are active for the current page
97+

0 commit comments

Comments
 (0)