-
Notifications
You must be signed in to change notification settings - Fork 501
[Docs][Content] Github install, UI changes, platform selection #1098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7ff2cc5
Update github instructions for github app/github oauth app
madster456 e704363
New self host code examples
madster456 03d596e
Add warning to self hosting, and update for new codeblocks
madster456 8887abe
Update for shell/docker/pnpm/ code examples single line
madster456 f995d9c
Updated for warning, and updated styling for more modern look
madster456 4c49f73
migrate sign in examples to code-examples
madster456 6b9d490
fix date
madster456 fd4619b
updates pages to use code examples
madster456 f3520f5
fix self-host lastModified date
madster456 e26321c
move last modified date to top
madster456 5c99355
Merge branch 'dev' into docs/content/github-install
madster456 2cea456
spelling, and fix platform codeblock
madster456 699b93e
Merge branch 'dev' into docs/content/github-install
madster456 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,207 @@ | ||
| import { CodeExample } from '../lib/code-examples'; | ||
|
|
||
| export const customizationExamples = { | ||
| 'sign-in': { | ||
| 'default': [ | ||
| { | ||
| language: 'JavaScript', | ||
| framework: 'Next.js', | ||
| code: `'use client'; | ||
| import { SignIn } from "@stackframe/stack"; | ||
|
|
||
| export default function DefaultSignIn() { | ||
| // optionally redirect to some other page if the user is already signed in | ||
| // const user = useUser(); | ||
| // if (user) { redirect to some other page } | ||
| return <SignIn fullPage />; | ||
| }`, | ||
| highlightLanguage: 'tsx', | ||
| filename: 'app/handler/sign-in/page.tsx', | ||
| }, | ||
| ] as CodeExample[], | ||
|
|
||
| 'custom-oauth': [ | ||
| { | ||
| language: 'JavaScript', | ||
| framework: 'Next.js', | ||
| code: `'use client'; | ||
| import { useStackApp } from "@stackframe/stack"; | ||
|
|
||
| export default function CustomOAuthSignIn() { | ||
| const app = useStackApp(); | ||
|
|
||
| return ( | ||
| <div> | ||
| <h1>My Custom Sign In page</h1> | ||
| <button onClick={async () => { | ||
| // This will redirect to the OAuth provider's login page. | ||
| await app.signInWithOAuth('google'); | ||
| }}> | ||
| Sign In with Google | ||
| </button> | ||
| </div> | ||
| ); | ||
| }`, | ||
| highlightLanguage: 'tsx', | ||
| filename: 'app/handler/sign-in/page.tsx', | ||
| }, | ||
| ] as CodeExample[], | ||
|
|
||
| 'custom-credential': [ | ||
| { | ||
| language: 'JavaScript', | ||
| framework: 'Next.js', | ||
| code: `'use client'; | ||
| import { useStackApp } from "@stackframe/stack"; | ||
| import { useState } from "react"; | ||
|
|
||
| export default function CustomCredentialSignIn() { | ||
| const [email, setEmail] = useState(''); | ||
| const [password, setPassword] = useState(''); | ||
| const [error, setError] = useState(''); | ||
| const app = useStackApp(); | ||
|
|
||
| const onSubmit = async () => { | ||
| if (!password) { | ||
| setError('Please enter your password'); | ||
| return; | ||
| } | ||
| // This will redirect to app.urls.afterSignIn if successful. | ||
| // You can customize the redirect URL in the StackServerApp constructor. | ||
| const result = await app.signInWithCredential({ email, password }); | ||
| // It's better to handle each error code separately, but for simplicity, | ||
| // we'll just display the error message directly here. | ||
| if (result.status === 'error') { | ||
| setError(result.error.message); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <form onSubmit={(e) => { e.preventDefault(); onSubmit(); } }> | ||
| {error} | ||
| <input type='email' placeholder="email@example.com" value={email} onChange={(e) => setEmail(e.target.value)} /> | ||
| <input type='password' placeholder="password" value={password} onChange={(e) => setPassword(e.target.value)} /> | ||
| <button type='submit'>Sign In</button> | ||
| </form> | ||
| ); | ||
| }`, | ||
| highlightLanguage: 'tsx', | ||
| filename: 'app/handler/sign-in/page.tsx', | ||
| }, | ||
| ] as CodeExample[], | ||
|
|
||
| 'custom-magic-link': [ | ||
| { | ||
| language: 'JavaScript', | ||
| framework: 'Next.js', | ||
| code: `'use client'; | ||
|
|
||
| import { useStackApp } from "@stackframe/stack"; | ||
| import { useState } from "react"; | ||
|
|
||
| export default function CustomMagicLinkSignIn() { | ||
| const [email, setEmail] = useState(''); | ||
| const [error, setError] = useState(''); | ||
| const [message, setMessage] = useState(''); | ||
| const app = useStackApp(); | ||
|
|
||
| const onSubmit = async () => { | ||
| if (!email) { | ||
| setError('Please enter your email address'); | ||
| return; | ||
| } | ||
|
|
||
| // This will send a magic link email to the user's email address. | ||
| // When they click the link, they will be redirected to your application. | ||
| const result = await app.sendMagicLinkEmail(email); | ||
| // It's better to handle each error code separately, but for simplicity, | ||
| // we'll just display the error message directly here. | ||
| if (result.status === 'error') { | ||
| setError(result.error.message); | ||
| } else { | ||
| setMessage('Magic link sent! Please check your email.'); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <form onSubmit={(e) => { e.preventDefault(); onSubmit(); } }> | ||
| {error} | ||
| {message ? | ||
| <div>{message}</div> : | ||
| <> | ||
| <input type='email' placeholder="email@example.com" value={email} onChange={(e) => setEmail(e.target.value)} /> | ||
| <button type='submit'>Send Magic Link</button> | ||
| </>} | ||
| </form> | ||
| ); | ||
| }`, | ||
| highlightLanguage: 'tsx', | ||
| filename: 'app/handler/sign-in/page.tsx', | ||
| }, | ||
| ] as CodeExample[], | ||
| }, | ||
|
|
||
| 'sign-up': { | ||
| 'default': [ | ||
| { | ||
| language: 'JavaScript', | ||
| framework: 'Next.js', | ||
| code: `'use client'; | ||
| import { SignUp } from "@stackframe/stack"; | ||
|
|
||
| export default function DefaultSignUp() { | ||
| // optionally redirect to some other page if the user is already signed in | ||
| // const user = useUser(); | ||
| // if (user) { redirect to some other page } | ||
| return <SignUp fullPage />; | ||
| }`, | ||
| highlightLanguage: 'tsx', | ||
| filename: 'app/handler/sign-up/page.tsx', | ||
| }, | ||
| ] as CodeExample[], | ||
|
|
||
| 'custom-credential': [ | ||
| { | ||
| language: 'JavaScript', | ||
| framework: 'Next.js', | ||
| code: `'use client'; | ||
|
|
||
| import { useStackApp } from "@stackframe/stack"; | ||
| import { useState } from "react"; | ||
|
|
||
| export default function CustomCredentialSignUp() { | ||
| const [email, setEmail] = useState(''); | ||
| const [password, setPassword] = useState(''); | ||
| const [error, setError] = useState(''); | ||
| const app = useStackApp(); | ||
|
|
||
| const onSubmit = async () => { | ||
| if (!password) { | ||
| setError('Please enter your password'); | ||
| return; | ||
| } | ||
| // This will redirect to app.urls.afterSignUp if successful. | ||
| // You can customize the redirect URL in the StackServerApp constructor. | ||
| const result = await app.signUpWithCredential({ email, password }); | ||
| // It's better to handle each error code separately, but for simplicity, | ||
| // we'll just display the error message directly here. | ||
| if (result.status === 'error') { | ||
| setError(result.error.message); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <form onSubmit={(e) => { e.preventDefault(); onSubmit(); } }> | ||
| {error} | ||
| <input type='email' placeholder="email@example.com" value={email} onChange={(e) => setEmail(e.target.value)} /> | ||
| <input type='password' placeholder="password" value={password} onChange={(e) => setPassword(e.target.value)} /> | ||
| <button type='submit'>Sign Up</button> | ||
| </form> | ||
| ); | ||
| }`, | ||
| highlightLanguage: 'tsx', | ||
| filename: 'app/handler/sign-up/page.tsx', | ||
| }, | ||
| ] as CodeExample[], | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| 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[], | ||
| } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.