Prettier format pending files

This commit is contained in:
Builder.io 2025-11-05 02:45:56 +00:00
parent dea4a6c9ed
commit 7fcc818a1c
15 changed files with 395 additions and 157 deletions

View file

@ -1,29 +1,47 @@
import { VercelRequest, VercelResponse } from '@vercel/node'; import { VercelRequest, VercelResponse } from "@vercel/node";
import { readFileSync } from 'fs'; import { readFileSync } from "fs";
import { join } from 'path'; import { join } from "path";
const GITBOOK_API_TOKEN = process.env.GITBOOK_API_TOKEN || 'gb_api_jORqpp2qlvg7pwlPiIKHAbgcFIDJBIJ1pz09WpIg'; const GITBOOK_API_TOKEN =
const GITBOOK_SPACE_ID = process.env.GITBOOK_SPACE_ID || '37ITJTgjD56eN3ZI5qtt'; process.env.GITBOOK_API_TOKEN ||
"gb_api_jORqpp2qlvg7pwlPiIKHAbgcFIDJBIJ1pz09WpIg";
const GITBOOK_SPACE_ID = process.env.GITBOOK_SPACE_ID || "37ITJTgjD56eN3ZI5qtt";
const PAGES = [ const PAGES = [
{ title: 'Welcome to AeThex Documentation', slug: 'overview', file: '01-overview.md' }, {
{ title: 'Getting Started', slug: 'getting-started', file: '02-getting-started.md' }, title: "Welcome to AeThex Documentation",
{ title: 'Platform Guide', slug: 'platform', file: '03-platform.md' }, slug: "overview",
{ title: 'API Reference', slug: 'api-reference', file: '04-api-reference.md' }, file: "01-overview.md",
{ title: 'Tutorials', slug: 'tutorials', file: '05-tutorials.md' }, },
{ title: 'CLI Tools', slug: 'cli', file: '06-cli.md' }, {
{ title: 'Code Examples', slug: 'examples', file: '07-examples.md' }, title: "Getting Started",
{ title: 'Integrations', slug: 'integrations', file: '08-integrations.md' }, slug: "getting-started",
{ title: 'Curriculum', slug: 'curriculum', file: '09-curriculum.md' }, file: "02-getting-started.md",
},
{ title: "Platform Guide", slug: "platform", file: "03-platform.md" },
{
title: "API Reference",
slug: "api-reference",
file: "04-api-reference.md",
},
{ title: "Tutorials", slug: "tutorials", file: "05-tutorials.md" },
{ title: "CLI Tools", slug: "cli", file: "06-cli.md" },
{ title: "Code Examples", slug: "examples", file: "07-examples.md" },
{ title: "Integrations", slug: "integrations", file: "08-integrations.md" },
{ title: "Curriculum", slug: "curriculum", file: "09-curriculum.md" },
]; ];
async function makeRequest(method: string, path: string, body?: any): Promise<any> { async function makeRequest(
method: string,
path: string,
body?: any,
): Promise<any> {
const response = await fetch(`https://api.gitbook.com/v1${path}`, { const response = await fetch(`https://api.gitbook.com/v1${path}`, {
method, method,
headers: { headers: {
Authorization: `Bearer ${GITBOOK_API_TOKEN}`, Authorization: `Bearer ${GITBOOK_API_TOKEN}`,
'Content-Type': 'application/json', "Content-Type": "application/json",
'User-Agent': 'AeThex-Docs-Sync', "User-Agent": "AeThex-Docs-Sync",
}, },
body: body ? JSON.stringify(body) : undefined, body: body ? JSON.stringify(body) : undefined,
}); });
@ -36,13 +54,10 @@ async function makeRequest(method: string, path: string, body?: any): Promise<an
return response.json(); return response.json();
} }
export default async function handler( export default async function handler(req: VercelRequest, res: VercelResponse) {
req: VercelRequest,
res: VercelResponse,
) {
// Only allow POST requests // Only allow POST requests
if (req.method !== 'POST') { if (req.method !== "POST") {
return res.status(405).json({ error: 'Method not allowed' }); return res.status(405).json({ error: "Method not allowed" });
} }
try { try {
@ -52,8 +67,8 @@ export default async function handler(
for (const page of PAGES) { for (const page of PAGES) {
try { try {
const filePath = join(process.cwd(), 'docs-migration', page.file); const filePath = join(process.cwd(), "docs-migration", page.file);
const content = readFileSync(filePath, 'utf-8'); const content = readFileSync(filePath, "utf-8");
const body = { const body = {
title: page.title, title: page.title,
@ -63,12 +78,17 @@ export default async function handler(
}, },
}; };
await makeRequest('POST', `/spaces/${GITBOOK_SPACE_ID}/pages`, body); await makeRequest("POST", `/spaces/${GITBOOK_SPACE_ID}/pages`, body);
results.push({ page: page.title, status: 'success' }); results.push({ page: page.title, status: "success" });
successful++; successful++;
} catch (error) { } catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error'; const errorMessage =
results.push({ page: page.title, status: 'failed', error: errorMessage }); error instanceof Error ? error.message : "Unknown error";
results.push({
page: page.title,
status: "failed",
error: errorMessage,
});
failed++; failed++;
} }
@ -77,13 +97,14 @@ export default async function handler(
} }
return res.status(200).json({ return res.status(200).json({
message: 'Sync complete', message: "Sync complete",
successful, successful,
failed, failed,
results, results,
}); });
} catch (error) { } catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error'; const errorMessage =
error instanceof Error ? error.message : "Unknown error";
return res.status(500).json({ error: errorMessage }); return res.status(500).json({ error: errorMessage });
} }
} }

View file

@ -197,18 +197,26 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
const hasAuthTokens = () => { const hasAuthTokens = () => {
if (typeof window === "undefined") return false; if (typeof window === "undefined") return false;
const keys = Object.keys(window.localStorage); const keys = Object.keys(window.localStorage);
return keys.some((key) => key.includes("auth-token") || key.includes("sb-") && key.includes("-auth")); return keys.some(
(key) =>
key.includes("auth-token") ||
(key.includes("sb-") && key.includes("-auth")),
);
}; };
// Get initial session with persistence recovery // Get initial session with persistence recovery
const initializeAuth = async () => { const initializeAuth = async () => {
try { try {
const { data: { session } } = await supabase.auth.getSession(); const {
data: { session },
} = await supabase.auth.getSession();
// If no session but tokens exist, the session might not have restored yet // If no session but tokens exist, the session might not have restored yet
// Wait a bit for onAuthStateChange to trigger // Wait a bit for onAuthStateChange to trigger
if (!session && hasAuthTokens()) { if (!session && hasAuthTokens()) {
console.log("Tokens exist in storage but session not yet restored, waiting..."); console.log(
"Tokens exist in storage but session not yet restored, waiting...",
);
// Don't set loading to false yet - wait for onAuthStateChange // Don't set loading to false yet - wait for onAuthStateChange
return; return;
} }

View file

@ -1,13 +1,19 @@
import { useState } from 'react'; import { useState } from "react";
import Layout from '@/components/Layout'; import Layout from "@/components/Layout";
import { Button } from '@/components/ui/button'; import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import {
import { Badge } from '@/components/ui/badge'; Card,
import { CheckCircle2, AlertCircle, Loader2, BookOpen } from 'lucide-react'; CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { CheckCircle2, AlertCircle, Loader2, BookOpen } from "lucide-react";
interface SyncResult { interface SyncResult {
page: string; page: string;
status: 'success' | 'failed'; status: "success" | "failed";
error?: string; error?: string;
} }
@ -28,10 +34,10 @@ export default function DocsSync() {
setError(null); setError(null);
try { try {
const response = await fetch('/api/sync-docs-gitbook', { const response = await fetch("/api/sync-docs-gitbook", {
method: 'POST', method: "POST",
headers: { headers: {
'Content-Type': 'application/json', "Content-Type": "application/json",
}, },
}); });
@ -42,7 +48,7 @@ export default function DocsSync() {
const data: SyncResponse = await response.json(); const data: SyncResponse = await response.json();
setResult(data); setResult(data);
} catch (err) { } catch (err) {
setError(err instanceof Error ? err.message : 'Unknown error'); setError(err instanceof Error ? err.message : "Unknown error");
} finally { } finally {
setLoading(false); setLoading(false);
} }
@ -56,19 +62,25 @@ export default function DocsSync() {
<div className="mb-12"> <div className="mb-12">
<div className="flex items-center gap-3 mb-4"> <div className="flex items-center gap-3 mb-4">
<BookOpen className="h-8 w-8 text-purple-400" /> <BookOpen className="h-8 w-8 text-purple-400" />
<h1 className="text-4xl font-bold text-white">Documentation Sync</h1> <h1 className="text-4xl font-bold text-white">
Documentation Sync
</h1>
</div> </div>
<p className="text-gray-300 text-lg max-w-2xl"> <p className="text-gray-300 text-lg max-w-2xl">
Sync your AeThex documentation to Gitbook. Click the button below to push all 9 documentation pages to your Gitbook workspace. Sync your AeThex documentation to Gitbook. Click the button below
to push all 9 documentation pages to your Gitbook workspace.
</p> </p>
</div> </div>
{/* Sync Card */} {/* Sync Card */}
<Card className="bg-slate-800/50 border-slate-700 mb-8"> <Card className="bg-slate-800/50 border-slate-700 mb-8">
<CardHeader> <CardHeader>
<CardTitle className="text-white">Sync Documentation to Gitbook</CardTitle> <CardTitle className="text-white">
Sync Documentation to Gitbook
</CardTitle>
<CardDescription className="text-gray-400"> <CardDescription className="text-gray-400">
This will push all 9 documentation pages to your Gitbook workspace This will push all 9 documentation pages to your Gitbook
workspace
</CardDescription> </CardDescription>
</CardHeader> </CardHeader>
<CardContent className="space-y-6"> <CardContent className="space-y-6">
@ -127,19 +139,25 @@ export default function DocsSync() {
{/* Results */} {/* Results */}
{result && ( {result && (
<Card className={`${result.failed === 0 ? 'bg-emerald-900/20 border-emerald-500/40' : 'bg-slate-800/50 border-slate-700'} mb-8`}> <Card
className={`${result.failed === 0 ? "bg-emerald-900/20 border-emerald-500/40" : "bg-slate-800/50 border-slate-700"} mb-8`}
>
<CardHeader> <CardHeader>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<CardTitle className="text-white">Sync Results</CardTitle> <CardTitle className="text-white">Sync Results</CardTitle>
<div className="flex gap-4"> <div className="flex gap-4">
<div className="text-right"> <div className="text-right">
<p className="text-sm text-gray-400">Successful</p> <p className="text-sm text-gray-400">Successful</p>
<p className="text-2xl font-bold text-emerald-400">{result.successful}</p> <p className="text-2xl font-bold text-emerald-400">
{result.successful}
</p>
</div> </div>
{result.failed > 0 && ( {result.failed > 0 && (
<div className="text-right"> <div className="text-right">
<p className="text-sm text-gray-400">Failed</p> <p className="text-sm text-gray-400">Failed</p>
<p className="text-2xl font-bold text-red-400">{result.failed}</p> <p className="text-2xl font-bold text-red-400">
{result.failed}
</p>
</div> </div>
)} )}
</div> </div>
@ -148,9 +166,12 @@ export default function DocsSync() {
<CardContent> <CardContent>
<div className="space-y-2"> <div className="space-y-2">
{result.results.map((item, index) => ( {result.results.map((item, index) => (
<div key={index} className="flex items-center justify-between p-3 bg-slate-900/50 rounded-lg"> <div
key={index}
className="flex items-center justify-between p-3 bg-slate-900/50 rounded-lg"
>
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
{item.status === 'success' ? ( {item.status === "success" ? (
<CheckCircle2 className="h-5 w-5 text-emerald-400" /> <CheckCircle2 className="h-5 w-5 text-emerald-400" />
) : ( ) : (
<AlertCircle className="h-5 w-5 text-red-400" /> <AlertCircle className="h-5 w-5 text-red-400" />
@ -159,9 +180,9 @@ export default function DocsSync() {
</div> </div>
<Badge <Badge
className={ className={
item.status === 'success' item.status === "success"
? 'bg-emerald-500/20 text-emerald-200' ? "bg-emerald-500/20 text-emerald-200"
: 'bg-red-500/20 text-red-200' : "bg-red-500/20 text-red-200"
} }
> >
{item.status} {item.status}
@ -173,7 +194,8 @@ export default function DocsSync() {
{result.failed === 0 && ( {result.failed === 0 && (
<div className="mt-6 p-4 bg-emerald-500/10 border border-emerald-500/40 rounded-lg"> <div className="mt-6 p-4 bg-emerald-500/10 border border-emerald-500/40 rounded-lg">
<p className="text-emerald-200 text-sm"> <p className="text-emerald-200 text-sm">
All documentation successfully synced to Gitbook! Your docs are now available at https://docs.aethex.tech All documentation successfully synced to Gitbook! Your
docs are now available at https://docs.aethex.tech
</p> </p>
</div> </div>
)} )}
@ -190,13 +212,21 @@ export default function DocsSync() {
<div> <div>
<p className="font-semibold text-white mb-2">Before syncing:</p> <p className="font-semibold text-white mb-2">Before syncing:</p>
<ol className="list-decimal list-inside space-y-1 text-sm"> <ol className="list-decimal list-inside space-y-1 text-sm">
<li>Verify Vercel environment variables are set: <li>
<code className="bg-black/40 px-2 py-1 rounded text-purple-200 ml-2">GITBOOK_API_TOKEN</code> Verify Vercel environment variables are set:
<code className="bg-black/40 px-2 py-1 rounded text-purple-200 ml-2">
GITBOOK_API_TOKEN
</code>
and and
<code className="bg-black/40 px-2 py-1 rounded text-purple-200 ml-2">GITBOOK_SPACE_ID</code> <code className="bg-black/40 px-2 py-1 rounded text-purple-200 ml-2">
GITBOOK_SPACE_ID
</code>
</li> </li>
<li>Ensure your Gitbook workspace "AeThex Docs" is ready</li> <li>Ensure your Gitbook workspace "AeThex Docs" is ready</li>
<li>Have pages created in Gitbook (Overview, Getting Started, etc.)</li> <li>
Have pages created in Gitbook (Overview, Getting Started,
etc.)
</li>
</ol> </ol>
</div> </div>

View file

@ -18,28 +18,36 @@ Everything you need to build, deploy, and scale amazing projects with AeThex. Ge
## Documentation Sections ## Documentation Sections
### Getting Started ### Getting Started
Quick start guides and tutorials for beginners Quick start guides and tutorials for beginners
- Installation - Installation
- First Steps - First Steps
- Basic Concepts - Basic Concepts
- Hello World - Hello World
### API Reference ### API Reference
Complete API documentation with examples Complete API documentation with examples
- Authentication - Authentication
- Endpoints - Endpoints
- SDKs - SDKs
- Rate Limits - Rate Limits
### Tutorials ### Tutorials
Step-by-step guides for common use cases Step-by-step guides for common use cases
- Game Development - Game Development
- Web Apps - Web Apps
- Mobile Apps - Mobile Apps
- AI Integration - AI Integration
### CLI Tools ### CLI Tools
Command-line interface documentation Command-line interface documentation
- Installation - Installation
- Commands - Commands
- Configuration - Configuration
@ -48,15 +56,19 @@ Command-line interface documentation
## Learning Resources ## Learning Resources
### Video Tutorials ### Video Tutorials
Visual learning with step-by-step walkthroughs (50+ videos) Visual learning with step-by-step walkthroughs (50+ videos)
### Podcast Series ### Podcast Series
Deep dives into AeThex technology and strategy (20+ episodes) Deep dives into AeThex technology and strategy (20+ episodes)
### Code Examples ### Code Examples
Production-ready snippets maintained by the platform team (100+ repos) Production-ready snippets maintained by the platform team (100+ repos)
### Downloads ### Downloads
SDKs, design kits, and tooling for every platform SDKs, design kits, and tooling for every platform
## Need Help? ## Need Help?

View file

@ -5,20 +5,27 @@
### Prerequisites ### Prerequisites
#### AeThex Account #### AeThex Account
You will need an active AeThex account to access the dashboard, API console, and deployment tools. You will need an active AeThex account to access the dashboard, API console, and deployment tools.
- [Create account](/get-started) - [Create account](/get-started)
#### Node.js 18+ & npm #### Node.js 18+ & npm
The AeThex CLI relies on modern Node runtimes. Verify your local toolchain before continuing. The AeThex CLI relies on modern Node runtimes. Verify your local toolchain before continuing.
- [Verify environment](https://nodejs.org/en/download) - [Verify environment](https://nodejs.org/en/download)
#### Project Workspace #### Project Workspace
Choose an empty directory for your new AeThex project or clone an existing team template. Choose an empty directory for your new AeThex project or clone an existing team template.
- [Browse templates](/projects/new) - [Browse templates](/projects/new)
## Setup Steps ## Setup Steps
### 1. Install the CLI ### 1. Install the CLI
The CLI bootstraps local projects, provisions cloud environments, and manages deployments. The CLI bootstraps local projects, provisions cloud environments, and manages deployments.
```bash ```bash
@ -26,6 +33,7 @@ npm install -g aethex
``` ```
### 2. Authenticate ### 2. Authenticate
Log in with your AeThex credentials or paste a personal access token from the dashboard. Log in with your AeThex credentials or paste a personal access token from the dashboard.
```bash ```bash
@ -33,6 +41,7 @@ aethex login
``` ```
### 3. Initialize a Project ### 3. Initialize a Project
Scaffold configuration, environment files, and example services for your team. Scaffold configuration, environment files, and example services for your team.
```bash ```bash
@ -40,6 +49,7 @@ aethex init studio-hub
``` ```
### 4. Start the Dev Server ### 4. Start the Dev Server
Run the local environment with hot reloading, mocked services, and seeded sample data. Run the local environment with hot reloading, mocked services, and seeded sample data.
```bash ```bash
@ -49,26 +59,33 @@ npm run dev
## Deployment Checklist ## Deployment Checklist
### Configure Environments ### Configure Environments
Define staging and production targets, secrets, and automated health probes in aethex.config.ts. Define staging and production targets, secrets, and automated health probes in aethex.config.ts.
### Provision Resources ### Provision Resources
Use `aethex deploy --preview` to create sandbox infrastructure before promoting to production. Use `aethex deploy --preview` to create sandbox infrastructure before promoting to production.
### Enable Safeguards ### Enable Safeguards
Turn on role-based access controls, audit logging, and automated rollbacks from the dashboard. Turn on role-based access controls, audit logging, and automated rollbacks from the dashboard.
## Platform Highlights ## Platform Highlights
### Unified Dashboard ### Unified Dashboard
Monitor deployments, review incidents, and share announcements with stakeholders from a single console. Monitor deployments, review incidents, and share announcements with stakeholders from a single console.
### Passport Identity ### Passport Identity
Give every builder a portable profile that aggregates achievements, verified skills, and mentorship history. Give every builder a portable profile that aggregates achievements, verified skills, and mentorship history.
### Community and Mentorship ### Community and Mentorship
Pair emerging studios with advisors, host showcase events, and recruit collaborators through the community hub. Pair emerging studios with advisors, host showcase events, and recruit collaborators through the community hub.
### Live Ops Analytics ### Live Ops Analytics
Track real-time KPIs, automate status updates, and route alerts into your team's notification channels. Track real-time KPIs, automate status updates, and route alerts into your team's notification channels.
## Next Steps ## Next Steps

View file

@ -7,34 +7,45 @@ The AeThex platform provides comprehensive tools for building, deploying, and sc
## Platform Pillars ## Platform Pillars
### Unified Dashboard ### Unified Dashboard
Monitor deployments, live metrics, and release health from a single control surface. Jump into incidents, approvals, and audit trails without leaving the workspace. Monitor deployments, live metrics, and release health from a single control surface. Jump into incidents, approvals, and audit trails without leaving the workspace.
- [Visit dashboard](/dashboard) - [Visit dashboard](/dashboard)
### AeThex Passport ### AeThex Passport
Give builders portable identity with verified skills, achievements, and cross-product progress synced to their Passport profile. Give builders portable identity with verified skills, achievements, and cross-product progress synced to their Passport profile.
- [Open passport](/passport/me) - [Open passport](/passport/me)
### Collaboration ### Collaboration
Coordinate teams with realms, role-based access, and shared project templates. Invite talent directly from the community directory. Coordinate teams with realms, role-based access, and shared project templates. Invite talent directly from the community directory.
- [Meet the community](/community) - [Meet the community](/community)
### Live Operations ### Live Operations
Run live experiences with analytics, status pages, and automated incident workflows wired into AeThex services. Run live experiences with analytics, status pages, and automated incident workflows wired into AeThex services.
- [Check status](/status) - [Check status](/status)
## Collaboration Workflows ## Collaboration Workflows
### Onboard & Align ### Onboard & Align
Welcome teammates through the guided onboarding flow, capture their interests, and assign the right mentorship programs from day one. Welcome teammates through the guided onboarding flow, capture their interests, and assign the right mentorship programs from day one.
Onboarding modules cover personal info, interests, and project preferences so teams ramp quickly. Onboarding modules cover personal info, interests, and project preferences so teams ramp quickly.
### Build Together ### Build Together
Kick off projects with shared canvases, synced task boards, and CLI-generated environments. Use the realm switcher to target the correct workspace. Kick off projects with shared canvases, synced task boards, and CLI-generated environments. Use the realm switcher to target the correct workspace.
In-app toasts notify collaborators when schema changes, deployments, or reviews need attention. In-app toasts notify collaborators when schema changes, deployments, or reviews need attention.
### Launch & Iterate ### Launch & Iterate
Promote builds through AeThex Deploy, track KPIs in the analytics feed, and publish release notes via the changelog tools. Promote builds through AeThex Deploy, track KPIs in the analytics feed, and publish release notes via the changelog tools.
Community announcements and blog posts keep players and stakeholders in the loop automatically. Community announcements and blog posts keep players and stakeholders in the loop automatically.
@ -42,30 +53,41 @@ Community announcements and blog posts keep players and stakeholders in the loop
## Experience Modules ## Experience Modules
### Social Feed ### Social Feed
Share updates, prototypes, and patch notes in the feed. The composer supports media, Markdown, and rollout tags for targeted audiences. Share updates, prototypes, and patch notes in the feed. The composer supports media, Markdown, and rollout tags for targeted audiences.
- [Visit feed](/feed) - [Visit feed](/feed)
### Mentorship Programs ### Mentorship Programs
Match emerging studios with veteran advisors. Outline project goals, track sessions, and graduate mentors into full collaborators. Match emerging studios with veteran advisors. Outline project goals, track sessions, and graduate mentors into full collaborators.
- [Explore mentorship](/mentorship) - [Explore mentorship](/mentorship)
### Community Showcases ### Community Showcases
Highlight standout creators, publish case studies, and route interested partners to booking forms right from the community page. Highlight standout creators, publish case studies, and route interested partners to booking forms right from the community page.
- [View community](/community) - [View community](/community)
### Profile Passport ### Profile Passport
Curate public achievements, experience levels, and verified skill badges. Use the passport summary widget across marketing surfaces. Curate public achievements, experience levels, and verified skill badges. Use the passport summary widget across marketing surfaces.
- [View profile](/profile) - [View profile](/profile)
## Analytics and Operations ## Analytics and Operations
### Realtime Insights ### Realtime Insights
Project metrics stream into dashboards with per-environment filters. Combine ingestion data with custom signals exposed via the REST API. Project metrics stream into dashboards with per-environment filters. Combine ingestion data with custom signals exposed via the REST API.
### Governed Data ### Governed Data
Role-aware views ensure sensitive dashboards only appear for authorized users. Export snapshots or schedule recurring digests. Role-aware views ensure sensitive dashboards only appear for authorized users. Export snapshots or schedule recurring digests.
### Operational History ### Operational History
Every deployment, incident, and advisory event lands in the shared timeline so teams can audit changes months later. Every deployment, incident, and advisory event lands in the shared timeline so teams can audit changes months later.
## Governance and Security ## Governance and Security

View file

@ -7,6 +7,7 @@ The REST API exposes every core capability of the AeThex platform. Authenticate
## Authentication ## Authentication
### OAuth Client Credentials Grant ### OAuth Client Credentials Grant
Use the OAuth client credentials grant for service-to-service integrations: Use the OAuth client credentials grant for service-to-service integrations:
```bash ```bash
@ -19,6 +20,7 @@ curl -X POST https://api.aethex.dev/v1/auth/token \
Prefer user-scoped access? Direct builders through the hosted OAuth consent screen and exchange their authorization code using the same endpoint. Prefer user-scoped access? Direct builders through the hosted OAuth consent screen and exchange their authorization code using the same endpoint.
### Request Example ### Request Example
Call the Projects endpoint with your Bearer token and inspect pagination headers for large result sets. Call the Projects endpoint with your Bearer token and inspect pagination headers for large result sets.
```javascript ```javascript
@ -38,7 +40,7 @@ Responses include `X-RateLimit-Remaining` and `X-Request-ID` headers. Share the
## Core Endpoints ## Core Endpoints
| Method | Path | Description | | Method | Path | Description |
|--------|------|-------------| | ------ | -------------------------------- | ----------------------------------------------- |
| POST | /v1/auth/token | Exchange client credentials for an access token | | POST | /v1/auth/token | Exchange client credentials for an access token |
| GET | /v1/projects | List projects the current identity can access | | GET | /v1/projects | List projects the current identity can access |
| POST | /v1/projects | Create a project with environment defaults | | POST | /v1/projects | Create a project with environment defaults |
@ -59,7 +61,7 @@ Subscribe to webhooks to react to changes in real time.
## Error Handling ## Error Handling
| Code | Label | Hint | | Code | Label | Hint |
|------|-------|------| | ---- | ------------------- | -------------------------------------------------------------------------------------- |
| 401 | Unauthorized | Verify the Bearer token and ensure it has not expired. | | 401 | Unauthorized | Verify the Bearer token and ensure it has not expired. |
| 403 | Forbidden | The identity lacks the required scope. Request the project-admin role. | | 403 | Forbidden | The identity lacks the required scope. Request the project-admin role. |
| 429 | Too Many Requests | Respect the rate limit headers or enable adaptive backoff via the SDK. | | 429 | Too Many Requests | Respect the rate limit headers or enable adaptive backoff via the SDK. |
@ -68,6 +70,7 @@ Subscribe to webhooks to react to changes in real time.
## SDK Documentation ## SDK Documentation
Available SDKs: Available SDKs:
- JavaScript/TypeScript - JavaScript/TypeScript
- Python - Python
- Go - Go

View file

@ -7,7 +7,9 @@ Step-by-step guides for common use cases and advanced topics.
## Featured Tutorials ## Featured Tutorials
### AeThex Platform Quick Start ### AeThex Platform Quick Start
Get up and running with AeThex in under 10 minutes. Learn the basics of project creation, navigation, and core features. Get up and running with AeThex in under 10 minutes. Learn the basics of project creation, navigation, and core features.
- **Type:** Video - **Type:** Video
- **Duration:** 8 min - **Duration:** 8 min
- **Difficulty:** Beginner - **Difficulty:** Beginner
@ -15,7 +17,9 @@ Get up and running with AeThex in under 10 minutes. Learn the basics of project
- **Rating:** 4.9/5 (5,420 views) - **Rating:** 4.9/5 (5,420 views)
### Project Setup and Configuration ### Project Setup and Configuration
Deep dive into project configuration, environment setup, and best practices for organizing your AeThex projects. Deep dive into project configuration, environment setup, and best practices for organizing your AeThex projects.
- **Type:** Article - **Type:** Article
- **Duration:** 15 min - **Duration:** 15 min
- **Difficulty:** Beginner - **Difficulty:** Beginner
@ -23,7 +27,9 @@ Deep dive into project configuration, environment setup, and best practices for
- **Rating:** 4.8/5 (3,240 views) - **Rating:** 4.8/5 (3,240 views)
### Working with the AeThex API ### Working with the AeThex API
Comprehensive guide to integrating with AeThex APIs, authentication, rate limiting, and error handling. Comprehensive guide to integrating with AeThex APIs, authentication, rate limiting, and error handling.
- **Type:** Interactive - **Type:** Interactive
- **Duration:** 25 min - **Duration:** 25 min
- **Difficulty:** Intermediate - **Difficulty:** Intermediate
@ -31,7 +37,9 @@ Comprehensive guide to integrating with AeThex APIs, authentication, rate limiti
- **Rating:** 4.7/5 (2,156 views) - **Rating:** 4.7/5 (2,156 views)
### Building Games with AeThex Tools ### Building Games with AeThex Tools
Step-by-step tutorial for creating your first game using AeThex development tools and frameworks. Step-by-step tutorial for creating your first game using AeThex development tools and frameworks.
- **Type:** Video - **Type:** Video
- **Duration:** 45 min - **Duration:** 45 min
- **Difficulty:** Intermediate - **Difficulty:** Intermediate
@ -39,7 +47,9 @@ Step-by-step tutorial for creating your first game using AeThex development tool
- **Rating:** 4.9/5 (4,567 views) - **Rating:** 4.9/5 (4,567 views)
### Advanced Database Patterns ### Advanced Database Patterns
Learn advanced database design patterns, optimization techniques, and performance tuning for AeThex applications. Learn advanced database design patterns, optimization techniques, and performance tuning for AeThex applications.
- **Type:** Article - **Type:** Article
- **Duration:** 35 min - **Duration:** 35 min
- **Difficulty:** Advanced - **Difficulty:** Advanced
@ -47,7 +57,9 @@ Learn advanced database design patterns, optimization techniques, and performanc
- **Rating:** 4.6/5 (1,876 views) - **Rating:** 4.6/5 (1,876 views)
### AI Integration Workshop ### AI Integration Workshop
Hands-on workshop for integrating AI and machine learning capabilities into your AeThex projects. Hands-on workshop for integrating AI and machine learning capabilities into your AeThex projects.
- **Type:** Interactive - **Type:** Interactive
- **Duration:** 60 min - **Duration:** 60 min
- **Difficulty:** Advanced - **Difficulty:** Advanced
@ -72,18 +84,21 @@ Hands-on workshop for integrating AI and machine learning capabilities into your
Follow structured learning paths based on your experience level and goals: Follow structured learning paths based on your experience level and goals:
### Beginner Track ### Beginner Track
1. Platform Quick Start 1. Platform Quick Start
2. Project Setup and Configuration 2. Project Setup and Configuration
3. First Project Launch 3. First Project Launch
4. Basic API Integration 4. Basic API Integration
### Intermediate Track ### Intermediate Track
1. Advanced Configuration 1. Advanced Configuration
2. API Deep Dive 2. API Deep Dive
3. Database Patterns 3. Database Patterns
4. Real-time Features 4. Real-time Features
### Advanced Track ### Advanced Track
1. Microservices Architecture 1. Microservices Architecture
2. Performance Optimization 2. Performance Optimization
3. Security Best Practices 3. Security Best Practices

View file

@ -7,7 +7,7 @@ The AeThex CLI automates local development, environment management, and producti
## Command Catalog ## Command Catalog
| Command | Description | Usage Notes | | Command | Description | Usage Notes |
|---------|-------------|------------| | ---------------------- | ------------------------------------------------ | ---------------------------------------------------------------------- |
| `aethex init [name]` | Scaffold a new project with opinionated defaults | Creates configuration, environments, and starter services | | `aethex init [name]` | Scaffold a new project with opinionated defaults | Creates configuration, environments, and starter services |
| `aethex login` | Authenticate the CLI with your AeThex identity | Support for browser-based login and personal access tokens | | `aethex login` | Authenticate the CLI with your AeThex identity | Support for browser-based login and personal access tokens |
| `aethex deploy` | Build and deploy the current project | Runs tests, packages artifacts, and promotes to the target environment | | `aethex deploy` | Build and deploy the current project | Runs tests, packages artifacts, and promotes to the target environment |
@ -25,6 +25,7 @@ aethex dev
``` ```
Features: Features:
- Live reload on file changes - Live reload on file changes
- Mock API responses for testing - Mock API responses for testing
- Local database snapshots - Local database snapshots
@ -47,6 +48,7 @@ aethex deploy
``` ```
Features: Features:
- Automated testing - Automated testing
- Build artifact caching - Build artifact caching
- Transactional deployments - Transactional deployments
@ -55,12 +57,15 @@ Features:
## Automation Tips ## Automation Tips
### GitHub Actions ### GitHub Actions
Use the official AeThex GitHub Action to authenticate, run smoke tests, and deploy on every pull request merge. Use the official AeThex GitHub Action to authenticate, run smoke tests, and deploy on every pull request merge.
### Audit Trails ### Audit Trails
Every CLI deployment emits audit events. Stream them into your SIEM through the webhooks integration. Every CLI deployment emits audit events. Stream them into your SIEM through the webhooks integration.
### Rollbacks ### Rollbacks
Instantly revert to the previous stable release and notify collaborators: Instantly revert to the previous stable release and notify collaborators:
```bash ```bash
@ -68,6 +73,7 @@ aethex deploy --rollback latest
``` ```
### Preview Environments ### Preview Environments
Spin up disposable stacks tied to feature branches for stakeholder reviews: Spin up disposable stacks tied to feature branches for stakeholder reviews:
```bash ```bash
@ -85,13 +91,13 @@ export default {
runtime: "node18", runtime: "node18",
environments: { environments: {
staging: { staging: {
domain: "staging.example.com" domain: "staging.example.com",
}, },
production: { production: {
domain: "app.example.com" domain: "app.example.com",
} },
} },
} };
``` ```
## Troubleshooting ## Troubleshooting

View file

@ -7,6 +7,7 @@ Explore curated examples covering backend services, realtime overlays, automatio
## Featured Examples ## Featured Examples
### Server-side Matchmaking ### Server-side Matchmaking
Quickly assemble a matchmaking service that uses AeThex queues, weighting rules, and player telemetry streams. Quickly assemble a matchmaking service that uses AeThex queues, weighting rules, and player telemetry streams.
**Language:** TypeScript **Language:** TypeScript
@ -41,6 +42,7 @@ export async function enqueuePlayer(player) {
``` ```
### Realtime Activity Overlays ### Realtime Activity Overlays
Broadcast live deployment and incident updates to your in-game HUD or operations dashboard using AeThex events. Broadcast live deployment and incident updates to your in-game HUD or operations dashboard using AeThex events.
**Language:** React **Language:** React
@ -66,7 +68,10 @@ export function ActivityOverlay() {
<h3 className="text-sm font-semibold text-purple-200">Live activity</h3> <h3 className="text-sm font-semibold text-purple-200">Live activity</h3>
<ul className="mt-3 space-y-2 text-xs text-gray-200"> <ul className="mt-3 space-y-2 text-xs text-gray-200">
{events.map((evt) => ( {events.map((evt) => (
<li key={evt.id} className="rounded border border-purple-500/20 bg-purple-900/20 p-2"> <li
key={evt.id}
className="rounded border border-purple-500/20 bg-purple-900/20 p-2"
>
<span className="font-mono text-purple-300">{evt.type}</span> <span className="font-mono text-purple-300">{evt.type}</span>
<span className="ml-2 text-gray-400">{evt.payload.summary}</span> <span className="ml-2 text-gray-400">{evt.payload.summary}</span>
</li> </li>
@ -78,6 +83,7 @@ export function ActivityOverlay() {
``` ```
### Workshop Automation ### Workshop Automation
Automate the packaging and publishing of custom workshop content across AeThex environments using the CLI. Automate the packaging and publishing of custom workshop content across AeThex environments using the CLI.
**Language:** Shell **Language:** Shell
@ -101,19 +107,27 @@ echo "Workshop build published"
## Integration Ideas ## Integration Ideas
### Commerce Hooks ### Commerce Hooks
Sync AeThex purchase events into your billing or CRM system using the webhook relay template. Sync AeThex purchase events into your billing or CRM system using the webhook relay template.
- [View guide](/docs/api) - [View guide](/docs/api)
### Live Operations Dashboard ### Live Operations Dashboard
Combine project metrics, incident response playbooks, and player sentiment into a single React dashboard. Combine project metrics, incident response playbooks, and player sentiment into a single React dashboard.
- [View guide](/docs/tutorials) - [View guide](/docs/tutorials)
### Cross-platform Presence ### Cross-platform Presence
Mirror AeThex voice and party status with your Discord or Slack community using the presence bridge sample. Mirror AeThex voice and party status with your Discord or Slack community using the presence bridge sample.
- [View community](/community) - [View community](/community)
### Analytics Pipeline ### Analytics Pipeline
Export gameplay events to your data warehouse with the managed streaming connectors. Export gameplay events to your data warehouse with the managed streaming connectors.
- [View guide](/docs/getting-started) - [View guide](/docs/getting-started)
## Getting Started ## Getting Started

View file

@ -7,11 +7,13 @@ AeThex Integrations wrap third-party analytics, identity, payments, and live-ops
## Architecture Overview ## Architecture Overview
### Runtime Flow ### Runtime Flow
Integration manifests are stored in the AeThex Integrations service and synced across the dashboard and runtime. Client components resolve connector metadata through the shared API helpers, ensuring credentials and capability flags stay consistent with server state. Integration manifests are stored in the AeThex Integrations service and synced across the dashboard and runtime. Client components resolve connector metadata through the shared API helpers, ensuring credentials and capability flags stay consistent with server state.
During hydration the runtime mounts partner SDKs behind AeThex loaders, applying sandboxed execution where required. Use lifecycle hooks to emit analytics, hydrate widgets with scoped credentials, and gate access through the same role-based policies used elsewhere in the platform. During hydration the runtime mounts partner SDKs behind AeThex loaders, applying sandboxed execution where required. Use lifecycle hooks to emit analytics, hydrate widgets with scoped credentials, and gate access through the same role-based policies used elsewhere in the platform.
### Theming Hook ### Theming Hook
Use the integration theming utilities to adapt partner widgets to AeThex gradients, typography, and focus states. Tokens flow through CSS variables defined in `global.css`, so embeds stay visually aligned with dashboards and consumer apps. Use the integration theming utilities to adapt partner widgets to AeThex gradients, typography, and focus states. Tokens flow through CSS variables defined in `global.css`, so embeds stay visually aligned with dashboards and consumer apps.
## Connector Configuration ## Connector Configuration
@ -19,7 +21,7 @@ Use the integration theming utilities to adapt partner widgets to AeThex gradien
### Required Fields ### Required Fields
| Field | Description | Default Value | | Field | Description | Default Value |
|-------|-------------|----------------| | ----------------- | -------------------------------------------------------------------- | ------------------------------------------------ |
| `key` | Unique identifier referenced across dashboards, APIs, and audit logs | "analytics-segment" | | `key` | Unique identifier referenced across dashboards, APIs, and audit logs | "analytics-segment" |
| `category` | Integration taxonomy (analytics, identity, commerce, ops) | "analytics" | | `category` | Integration taxonomy (analytics, identity, commerce, ops) | "analytics" |
| `capabilities` | Feature flags that unlock widgets, hooks, and pipelines | ['metrics', 'webhooks'] | | `capabilities` | Feature flags that unlock widgets, hooks, and pipelines | ['metrics', 'webhooks'] |
@ -30,36 +32,44 @@ Use the integration theming utilities to adapt partner widgets to AeThex gradien
## Common Integrations ## Common Integrations
### Analytics ### Analytics
Connect your analytics platform to track KPIs and user behavior. Connect your analytics platform to track KPIs and user behavior.
Supported platforms: Supported platforms:
- Segment - Segment
- Mixpanel - Mixpanel
- Amplitude - Amplitude
- Custom webhooks - Custom webhooks
### Identity & Auth ### Identity & Auth
Integrate third-party identity providers for single sign-on. Integrate third-party identity providers for single sign-on.
Supported platforms: Supported platforms:
- Auth0 - Auth0
- Okta - Okta
- Azure AD - Azure AD
- Custom OAuth - Custom OAuth
### Payments & Commerce ### Payments & Commerce
Sync purchase events and manage subscriptions. Sync purchase events and manage subscriptions.
Supported platforms: Supported platforms:
- Stripe - Stripe
- Paddle - Paddle
- Gumroad - Gumroad
- Custom webhooks - Custom webhooks
### Live Operations ### Live Operations
Connect incident management and status page services. Connect incident management and status page services.
Supported platforms: Supported platforms:
- PagerDuty - PagerDuty
- OpsGenie - OpsGenie
- Datadog - Datadog
@ -68,17 +78,21 @@ Supported platforms:
## Troubleshooting ## Troubleshooting
### OAuth Handshake Fails ### OAuth Handshake Fails
Confirm the integration's redirect URI matches the value registered in the partner console. AeThex surfaces expose the required callback under Settings → Integrations. Confirm the integration's redirect URI matches the value registered in the partner console. AeThex surfaces expose the required callback under Settings → Integrations.
### Webhook Retries Exhausted ### Webhook Retries Exhausted
Inspect delivery attempts in the Integrations dashboard. Update retry policies or verify your endpoint responds with a 2xx status within 10 seconds. Inspect delivery attempts in the Integrations dashboard. Update retry policies or verify your endpoint responds with a 2xx status within 10 seconds.
### Embedded Widget Styling ### Embedded Widget Styling
Override component tokens through the integration theme utilities or wrap the widget in a container that inherits AeThex gradient variables. Override component tokens through the integration theme utilities or wrap the widget in a container that inherits AeThex gradient variables.
## Building Custom Integrations ## Building Custom Integrations
### Step 1: Register Connector ### Step 1: Register Connector
Create a manifest in your integration service: Create a manifest in your integration service:
```json ```json
@ -91,12 +105,15 @@ Create a manifest in your integration service:
``` ```
### Step 2: Implement OAuth Flow ### Step 2: Implement OAuth Flow
Handle the OAuth handshake to securely store credentials. Handle the OAuth handshake to securely store credentials.
### Step 3: Create UI Components ### Step 3: Create UI Components
Build dashboard cards or modal embeds using the AeThex component library. Build dashboard cards or modal embeds using the AeThex component library.
### Step 4: Setup Webhooks ### Step 4: Setup Webhooks
Configure event forwarding for real-time data sync. Configure event forwarding for real-time data sync.
## Best Practices ## Best Practices
@ -111,6 +128,7 @@ Configure event forwarding for real-time data sync.
## Support ## Support
For integration support and questions: For integration support and questions:
- [View API documentation](/docs/api) - [View API documentation](/docs/api)
- [Explore examples](/docs/examples) - [Explore examples](/docs/examples)
- [Join community](/community) - [Join community](/community)

View file

@ -9,80 +9,87 @@ Progress through sequenced modules that combine documentation, interactive labs,
### Foundation Level ### Foundation Level
#### AeThex Foundations #### AeThex Foundations
Establish core mastery of the AeThex platform, from environment setup to shipping your first interactive experience. Establish core mastery of the AeThex platform, from environment setup to shipping your first interactive experience.
**Duration:** 2.5 hours **Duration:** 2.5 hours
**Level:** Foundation **Level:** Foundation
**Focus Areas:** **Focus Areas:**
- Workspace onboarding - Workspace onboarding
- Project scaffolding - Project scaffolding
- Passport + identity - Passport + identity
**Learning Goals:** **Learning Goals:**
- Configure a production-ready AeThex project - Configure a production-ready AeThex project
- Understand AeThex Passport, identity, and role models - Understand AeThex Passport, identity, and role models
- Publish your first interactive deployment - Publish your first interactive deployment
**Lessons:** **Lessons:**
1. **Platform Orientation** (Video - 20 min) 1. **Platform Orientation** (Video - 20 min)
- Tour the AeThex workspace, dashboards, and navigation patterns - Tour the AeThex workspace, dashboards, and navigation patterns
2. **Project Blueprint Setup** (Article - 35 min) 2. **Project Blueprint Setup** (Article - 35 min)
- Create a new AeThex project, connect Supabase, and configure environments - Create a new AeThex project, connect Supabase, and configure environments
3. **Passport Fundamentals** (Interactive Lab - 40 min) 3. **Passport Fundamentals** (Interactive Lab - 40 min)
- Implement profiles, achievements, and realm roles using AeThex Passport APIs - Implement profiles, achievements, and realm roles using AeThex Passport APIs
4. **Launch Checklist** (Assignment - 35 min) 4. **Launch Checklist** (Assignment - 35 min)
- Deploy to Netlify/Vercel and validate observability before inviting users - Deploy to Netlify/Vercel and validate observability before inviting users
**Capstone:** Foundations Launch Sprint **Capstone:** Foundations Launch Sprint
- Ship a small but complete AeThex experience showcasing authentication, feed updates, and deployment - Ship a small but complete AeThex experience showcasing authentication, feed updates, and deployment
- Assemble a two-week plan outlining features, success metrics, and deployment artifacts - Assemble a two-week plan outlining features, success metrics, and deployment artifacts
### Builder Level ### Builder Level
#### Product Builder Track #### Product Builder Track
Design and scale collaborative communities with AeThex real-time tooling, automations, and membership flows. Design and scale collaborative communities with AeThex real-time tooling, automations, and membership flows.
**Duration:** 3 hours **Duration:** 3 hours
**Level:** Builder **Level:** Builder
**Focus Areas:** **Focus Areas:**
- Community feed - Community feed
- Workflow automations - Workflow automations
- Admin control center - Admin control center
**Learning Goals:** **Learning Goals:**
- Compose a modular community feed that reacts to Supabase events - Compose a modular community feed that reacts to Supabase events
- Automate onboarding with roles, achievements, and curriculum progression - Automate onboarding with roles, achievements, and curriculum progression
- Operate with observability dashboards and admin tooling - Operate with observability dashboards and admin tooling
**Lessons:** **Lessons:**
1. **Community Signal Architecture** (Article - 45 min) 1. **Community Signal Architecture** (Article - 45 min)
- Use AeThex feed primitives and Supabase realtime to orchestrate community updates - Use AeThex feed primitives and Supabase realtime to orchestrate community updates
2. **Role & Realm Automation** (Interactive Lab - 50 min) 2. **Role & Realm Automation** (Interactive Lab - 50 min)
- Configure workflows that auto-assign mentors, progress members, and trigger cascading events - Configure workflows that auto-assign mentors, progress members, and trigger cascading events
3. **Admin Operations** (Assignment - 45 min) 3. **Admin Operations** (Assignment - 45 min)
- Build dashboards for moderation, analytics, and bulk member management - Build dashboards for moderation, analytics, and bulk member management
### Advanced Level ### Advanced Level
#### Advanced Integration Track #### Advanced Integration Track
Master complex architectures combining multiple AeThex services with custom backends and third-party platforms. Master complex architectures combining multiple AeThex services with custom backends and third-party platforms.
**Duration:** 4+ hours **Duration:** 4+ hours
**Level:** Advanced **Level:** Advanced
**Focus Areas:** **Focus Areas:**
- Microservices patterns - Microservices patterns
- Performance optimization - Performance optimization
- Security hardening - Security hardening
**Learning Goals:** **Learning Goals:**
- Design scalable event-driven systems - Design scalable event-driven systems
- Implement security controls and compliance workflows - Implement security controls and compliance workflows
- Optimize for cost and performance - Optimize for cost and performance
@ -90,18 +97,22 @@ Master complex architectures combining multiple AeThex services with custom back
## Certification Paths ## Certification Paths
### AeThex Certified Builder ### AeThex Certified Builder
Complete Foundation and Builder modules + 2 capstone projects Complete Foundation and Builder modules + 2 capstone projects
**Benefits:** **Benefits:**
- Verified badge on Passport - Verified badge on Passport
- Exclusive community recognition - Exclusive community recognition
- Priority access to new features - Priority access to new features
- Direct connection with the AeThex team - Direct connection with the AeThex team
### AeThex Certified Architect ### AeThex Certified Architect
Complete all modules + Advanced capstone + architecture review Complete all modules + Advanced capstone + architecture review
**Benefits:** **Benefits:**
- Premium Passport badge - Premium Passport badge
- Speaking opportunities at AeThex events - Speaking opportunities at AeThex events
- Consulting partnership eligibility - Consulting partnership eligibility
@ -110,15 +121,19 @@ Complete all modules + Advanced capstone + architecture review
## Learning Format Options ## Learning Format Options
### Article ### Article
Self-paced written guides with code examples and references Self-paced written guides with code examples and references
### Video Walkthrough ### Video Walkthrough
Visual step-by-step tutorials with screen recordings Visual step-by-step tutorials with screen recordings
### Interactive Lab ### Interactive Lab
Hands-on environment with pre-configured infrastructure and guided challenges Hands-on environment with pre-configured infrastructure and guided challenges
### Hands-on Assignment ### Hands-on Assignment
Real-world project that builds on previous lessons Real-world project that builds on previous lessons
## Progress Tracking ## Progress Tracking

View file

@ -50,12 +50,14 @@ code/docs-migration/
## Step 2: Import Markdown Content ## Step 2: Import Markdown Content
### Option A: Manual Import ### Option A: Manual Import
1. Open each Markdown file 1. Open each Markdown file
2. Copy the content 2. Copy the content
3. Paste into corresponding Gitbook page 3. Paste into corresponding Gitbook page
4. Format as needed (Gitbook handles most Markdown automatically) 4. Format as needed (Gitbook handles most Markdown automatically)
### Option B: Gitbook Import API ### Option B: Gitbook Import API
Use the Gitbook API to programmatically import content: Use the Gitbook API to programmatically import content:
```bash ```bash
@ -145,11 +147,13 @@ For automated updates, set up periodic syncs using the Gitbook API and GitHub Ac
## Step 8: Monitor and Adjust ## Step 8: Monitor and Adjust
1. **Week 1-2:** Keep both systems active 1. **Week 1-2:** Keep both systems active
- Local React docs as primary - Local React docs as primary
- Gitbook as secondary - Gitbook as secondary
- Gather user feedback - Gather user feedback
2. **Week 3-4:** Switch primary to Gitbook 2. **Week 3-4:** Switch primary to Gitbook
- Update all links to point to Gitbook - Update all links to point to Gitbook
- Keep local docs as fallback redirect - Keep local docs as fallback redirect
@ -169,6 +173,7 @@ If issues arise, you can quickly rollback:
## API Credentials ## API Credentials
Your Gitbook API token has been provided: Your Gitbook API token has been provided:
- **API Token:** gb_api_jORqpp2qlvg7pwlPiIKHAbgcFIDJBIJ1pz09WpIg - **API Token:** gb_api_jORqpp2qlvg7pwlPiIKHAbgcFIDJBIJ1pz09WpIg
- **Space Name:** AeThex Docs - **Space Name:** AeThex Docs

View file

@ -5,43 +5,57 @@
* via the Gitbook API. * via the Gitbook API.
*/ */
const fs = require('fs'); const fs = require("fs");
const path = require('path'); const path = require("path");
const https = require('https'); const https = require("https");
const API_TOKEN = process.env.GITBOOK_API_TOKEN; const API_TOKEN = process.env.GITBOOK_API_TOKEN;
const SPACE_ID = process.env.GITBOOK_SPACE_ID; const SPACE_ID = process.env.GITBOOK_SPACE_ID;
const PAGES = [ const PAGES = [
{ title: 'Welcome to AeThex Documentation', slug: 'overview', file: '01-overview.md' }, {
{ title: 'Getting Started', slug: 'getting-started', file: '02-getting-started.md' }, title: "Welcome to AeThex Documentation",
{ title: 'Platform Guide', slug: 'platform', file: '03-platform.md' }, slug: "overview",
{ title: 'API Reference', slug: 'api-reference', file: '04-api-reference.md' }, file: "01-overview.md",
{ title: 'Tutorials', slug: 'tutorials', file: '05-tutorials.md' }, },
{ title: 'CLI Tools', slug: 'cli', file: '06-cli.md' }, {
{ title: 'Code Examples', slug: 'examples', file: '07-examples.md' }, title: "Getting Started",
{ title: 'Integrations', slug: 'integrations', file: '08-integrations.md' }, slug: "getting-started",
{ title: 'Curriculum', slug: 'curriculum', file: '09-curriculum.md' }, file: "02-getting-started.md",
},
{ title: "Platform Guide", slug: "platform", file: "03-platform.md" },
{
title: "API Reference",
slug: "api-reference",
file: "04-api-reference.md",
},
{ title: "Tutorials", slug: "tutorials", file: "05-tutorials.md" },
{ title: "CLI Tools", slug: "cli", file: "06-cli.md" },
{ title: "Code Examples", slug: "examples", file: "07-examples.md" },
{ title: "Integrations", slug: "integrations", file: "08-integrations.md" },
{ title: "Curriculum", slug: "curriculum", file: "09-curriculum.md" },
]; ];
async function makeRequest(method, path, body = null) { async function makeRequest(method, path, body = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const options = { const options = {
hostname: 'api.gitbook.com', hostname: "api.gitbook.com",
port: 443, port: 443,
path: `/v1${path}`, path: `/v1${path}`,
method, method,
headers: { headers: {
Authorization: `Bearer ${API_TOKEN}`, Authorization: `Bearer ${API_TOKEN}`,
'Content-Type': 'application/json', "Content-Type": "application/json",
'User-Agent': 'AeThex-Docs-Migration', "User-Agent": "AeThex-Docs-Migration",
}, },
}; };
const req = https.request(options, (res) => { const req = https.request(options, (res) => {
let data = ''; let data = "";
res.on('data', (chunk) => { data += chunk; }); res.on("data", (chunk) => {
res.on('end', () => { data += chunk;
});
res.on("end", () => {
try { try {
resolve({ resolve({
status: res.statusCode, status: res.statusCode,
@ -54,17 +68,19 @@ async function makeRequest(method, path, body = null) {
}); });
}); });
req.on('error', reject); req.on("error", reject);
if (body) req.write(JSON.stringify(body)); if (body) req.write(JSON.stringify(body));
req.end(); req.end();
}); });
} }
async function syncDocs() { async function syncDocs() {
console.log('🚀 Starting documentation sync to Gitbook...\n'); console.log("🚀 Starting documentation sync to Gitbook...\n");
if (!API_TOKEN || !SPACE_ID) { if (!API_TOKEN || !SPACE_ID) {
console.error('❌ Missing environment variables: GITBOOK_API_TOKEN or GITBOOK_SPACE_ID'); console.error(
"❌ Missing environment variables: GITBOOK_API_TOKEN or GITBOOK_SPACE_ID",
);
process.exit(1); process.exit(1);
} }
@ -80,7 +96,7 @@ async function syncDocs() {
continue; continue;
} }
const content = fs.readFileSync(filePath, 'utf-8'); const content = fs.readFileSync(filePath, "utf-8");
console.log(` Updating page: ${page.title}...`); console.log(` Updating page: ${page.title}...`);
const body = { const body = {
@ -88,7 +104,11 @@ async function syncDocs() {
description: `AeThex Documentation - ${page.title}`, description: `AeThex Documentation - ${page.title}`,
}; };
const response = await makeRequest('POST', `/spaces/${SPACE_ID}/pages`, body); const response = await makeRequest(
"POST",
`/spaces/${SPACE_ID}/pages`,
body,
);
if (response.status >= 200 && response.status < 300) { if (response.status >= 200 && response.status < 300) {
console.log(`${page.title} updated successfully`); console.log(`${page.title} updated successfully`);
@ -105,9 +125,11 @@ async function syncDocs() {
} }
} }
console.log(`\n✅ Sync complete: ${successful} successful, ${failed} failed\n`); console.log(
`\n✅ Sync complete: ${successful} successful, ${failed} failed\n`,
);
process.exit(failed > 0 ? 1 : 0); process.exit(failed > 0 ? 1 : 0);
} }
const action = process.argv[2] || 'sync'; const action = process.argv[2] || "sync";
if (action === 'sync') syncDocs(); if (action === "sync") syncDocs();

View file

@ -1,29 +1,47 @@
import { Handler } from '@netlify/functions'; import { Handler } from "@netlify/functions";
import { readFileSync } from 'fs'; import { readFileSync } from "fs";
import { join } from 'path'; import { join } from "path";
const GITBOOK_API_TOKEN = process.env.GITBOOK_API_TOKEN || 'gb_api_jORqpp2qlvg7pwlPiIKHAbgcFIDJBIJ1pz09WpIg'; const GITBOOK_API_TOKEN =
const GITBOOK_SPACE_ID = process.env.GITBOOK_SPACE_ID || '37ITJTgjD56eN3ZI5qtt'; process.env.GITBOOK_API_TOKEN ||
"gb_api_jORqpp2qlvg7pwlPiIKHAbgcFIDJBIJ1pz09WpIg";
const GITBOOK_SPACE_ID = process.env.GITBOOK_SPACE_ID || "37ITJTgjD56eN3ZI5qtt";
const PAGES = [ const PAGES = [
{ title: 'Welcome to AeThex Documentation', slug: 'overview', file: '01-overview.md' }, {
{ title: 'Getting Started', slug: 'getting-started', file: '02-getting-started.md' }, title: "Welcome to AeThex Documentation",
{ title: 'Platform Guide', slug: 'platform', file: '03-platform.md' }, slug: "overview",
{ title: 'API Reference', slug: 'api-reference', file: '04-api-reference.md' }, file: "01-overview.md",
{ title: 'Tutorials', slug: 'tutorials', file: '05-tutorials.md' }, },
{ title: 'CLI Tools', slug: 'cli', file: '06-cli.md' }, {
{ title: 'Code Examples', slug: 'examples', file: '07-examples.md' }, title: "Getting Started",
{ title: 'Integrations', slug: 'integrations', file: '08-integrations.md' }, slug: "getting-started",
{ title: 'Curriculum', slug: 'curriculum', file: '09-curriculum.md' }, file: "02-getting-started.md",
},
{ title: "Platform Guide", slug: "platform", file: "03-platform.md" },
{
title: "API Reference",
slug: "api-reference",
file: "04-api-reference.md",
},
{ title: "Tutorials", slug: "tutorials", file: "05-tutorials.md" },
{ title: "CLI Tools", slug: "cli", file: "06-cli.md" },
{ title: "Code Examples", slug: "examples", file: "07-examples.md" },
{ title: "Integrations", slug: "integrations", file: "08-integrations.md" },
{ title: "Curriculum", slug: "curriculum", file: "09-curriculum.md" },
]; ];
async function makeRequest(method: string, path: string, body?: any): Promise<any> { async function makeRequest(
method: string,
path: string,
body?: any,
): Promise<any> {
const response = await fetch(`https://api.gitbook.com/v1${path}`, { const response = await fetch(`https://api.gitbook.com/v1${path}`, {
method, method,
headers: { headers: {
Authorization: `Bearer ${GITBOOK_API_TOKEN}`, Authorization: `Bearer ${GITBOOK_API_TOKEN}`,
'Content-Type': 'application/json', "Content-Type": "application/json",
'User-Agent': 'AeThex-Docs-Sync', "User-Agent": "AeThex-Docs-Sync",
}, },
body: body ? JSON.stringify(body) : undefined, body: body ? JSON.stringify(body) : undefined,
}); });
@ -37,13 +55,13 @@ async function makeRequest(method: string, path: string, body?: any): Promise<an
const handler: Handler = async (event, context) => { const handler: Handler = async (event, context) => {
// Basic auth check // Basic auth check
const authHeader = event.headers['authorization']; const authHeader = event.headers["authorization"];
const expectedAuth = `Bearer ${process.env.SYNC_TOKEN || 'aethex-docs-sync'}`; const expectedAuth = `Bearer ${process.env.SYNC_TOKEN || "aethex-docs-sync"}`;
if (authHeader !== expectedAuth) { if (authHeader !== expectedAuth) {
return { return {
statusCode: 401, statusCode: 401,
body: JSON.stringify({ error: 'Unauthorized' }), body: JSON.stringify({ error: "Unauthorized" }),
}; };
} }
@ -55,20 +73,31 @@ const handler: Handler = async (event, context) => {
for (const page of PAGES) { for (const page of PAGES) {
try { try {
// Read markdown file from docs-migration directory // Read markdown file from docs-migration directory
const filePath = join(process.cwd(), '..', '..', 'docs-migration', page.file); const filePath = join(
const content = readFileSync(filePath, 'utf-8'); process.cwd(),
"..",
"..",
"docs-migration",
page.file,
);
const content = readFileSync(filePath, "utf-8");
const body = { const body = {
title: page.title, title: page.title,
description: `AeThex Documentation - ${page.title}`, description: `AeThex Documentation - ${page.title}`,
}; };
await makeRequest('POST', `/spaces/${GITBOOK_SPACE_ID}/pages`, body); await makeRequest("POST", `/spaces/${GITBOOK_SPACE_ID}/pages`, body);
results.push({ page: page.title, status: 'success' }); results.push({ page: page.title, status: "success" });
successful++; successful++;
} catch (error) { } catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error'; const errorMessage =
results.push({ page: page.title, status: 'failed', error: errorMessage }); error instanceof Error ? error.message : "Unknown error";
results.push({
page: page.title,
status: "failed",
error: errorMessage,
});
failed++; failed++;
} }
} }
@ -76,14 +105,15 @@ const handler: Handler = async (event, context) => {
return { return {
statusCode: 200, statusCode: 200,
body: JSON.stringify({ body: JSON.stringify({
message: 'Sync complete', message: "Sync complete",
successful, successful,
failed, failed,
results, results,
}), }),
}; };
} catch (error) { } catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error'; const errorMessage =
error instanceof Error ? error.message : "Unknown error";
return { return {
statusCode: 500, statusCode: 500,
body: JSON.stringify({ error: errorMessage }), body: JSON.stringify({ error: errorMessage }),