stack/docs/code-examples/self-host.ts
Madison d0173af691
[Docs][Content] Github install, UI changes, platform selection (#1098)
## Summary

This PR improves the documentation for GitHub authentication setup and
self-hosting.

## Changes

### GitHub OAuth/App Setup Guide
- Updated
[github.mdx](cci:7://file:///Users/madison/source/stack-auth/docs/content/docs/%28guides%29/concepts/auth-providers/github.mdx:0:0-0:0)
with clearer instructions differentiating between **GitHub OAuth App**
and **GitHub App** setup
- Added better explanations for when to use each option

### Self-Hosting Documentation
- Added prominent danger warning about self-hosting responsibilities
- Migrated inline shell commands to structured code examples using
[PlatformCodeblock](cci:1://file:///Users/madison/source/stack-auth/docs/src/components/mdx/platform-codeblock.tsx:242:0-673:1)
component
- Created
[docs/code-examples/self-host.ts](cci:7://file:///Users/madison/source/stack-auth/docs/code-examples/self-host.ts:0:0-0:0)
with all self-hosting commands

### Info Component
- Added new `danger` type for critical warnings with red accent styling
- Updated component styling with modern left accent bar and gradient
backgrounds

### PlatformCodeblock Component
- Added `hidePlatformSelector` prop to hide platform dropdown for
single-platform code examples
- Added Shell platform support for terminal commands (Docker, Git, pnpm)
- Filtered Shell platform from user-selectable options in both the
codeblock and header selectors

### Platform Config
- Added Shell platform with Docker, Git, and pnpm frameworks

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added comprehensive self-hosting and authentication customization
example collections for copy-paste use.
  * New "danger" info style with visual accent for important warnings.

* **Documentation**
* GitHub integration guide now centers on GitHub App with an alternate
OAuth path retained.
* Replaced many inline snippets with platform-driven code blocks and
improved platform/framework selector behavior (single-platform
optimization; option to hide selector).
  * Pages now surface "Last updated" above descriptions.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-20 11:49:08 -06:00

107 lines
2.6 KiB
TypeScript

import { CodeExample } from '../lib/code-examples';
export const selfHostExamples = {
'self-host': {
'docker-postgres': [
{
language: 'Shell',
framework: 'Docker',
code: `docker run -d --name db -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=stackframe -p 5432:5432 postgres:latest`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'docker-run': [
{
language: 'Shell',
framework: 'Docker',
code: `docker run --env-file <your-env-file.env> -p 8101:8101 -p 8102:8102 stackauth/server:latest`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'git-clone': [
{
language: 'Shell',
framework: 'Git',
code: `git clone git@github.com:stack-auth/stack-auth.git
cd stack-auth`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'local-dev-setup': [
{
language: 'Shell',
framework: 'pnpm',
code: `pnpm install
# Run build to build everything once
pnpm run build:dev
# reset & start the dependencies (DB, Inbucket, etc.) as Docker containers, seeding the DB with the Prisma schema
pnpm run start-deps
# pnpm run restart-deps
# pnpm run stop-deps
# Start the dev server
pnpm run dev
# For systems with limited resources, you can run a minimal development setup with just the backend and dashboard
# pnpm run dev:basic
# In a different terminal, run tests in watch mode
pnpm run test`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'prisma-studio': [
{
language: 'Shell',
framework: 'pnpm',
code: `pnpm run prisma studio`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'backend-build': [
{
language: 'Shell',
framework: 'pnpm',
code: `pnpm install
pnpm build:backend
pnpm start:backend`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'dashboard-build': [
{
language: 'Shell',
framework: 'pnpm',
code: `pnpm install
pnpm build:dashboard
pnpm start:dashboard`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
'db-init': [
{
language: 'Shell',
framework: 'pnpm',
code: `pnpm db:init`,
highlightLanguage: 'bash',
filename: 'Terminal'
}
] as CodeExample[],
}
};