Communitygithub.com

evalix098/tiktoklive

이 TanStack Start 앱에 사용자 계정과 로그인을 추가합니다. 앱에 인증, 로그인, 사용자 계정, 보호된 라우트 또는 사용자별 데이터가 필요할 때 사용합니다.

tiktoklive란 무엇인가요?

이 기술은 Better Auth를 기반으로 TanStack Start 애플리케이션에 인증 시스템을 구축합니다. Google, X(트위터), 이메일/비밀번호의 세 가지 로그인 방식만 지원하며, 다른 OAuth 제공자나 매직 링크, OTP 등의 방식은 사용할 수 없습니다. 기본적으로 로그인이 비활성화되어 있으며, 필요한 경우 플래그를 켜고 데이터베이스 마이그레이션과 라우트 파일을 추가하여 활성화합니다. 사용자별 데이터 보호를 위해 모든 서버 함수는 authMiddleware를 사용하고, user_id로 범위를 지정하여 쿼리하도록 강제합니다. 미리 구성된 gates 컴포넌트(SignedIn, SignedOut, UserButton 등)를 제공하며, 보안 모델은 헤드리스 브로커와 HttpOnly 쿠키를 사용합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/evalix098/tiktoklive/tree/HEAD/.grok/skills/auth

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Auth

이 앱은 genericOAuth 플러그인을 통해 공유 Grok 인증 브로커(auth.grok.me)에 연합하는 자체 Better Auth를 /api/auth/*에서 실행합니다. 이 템플릿은 Google 및 X를 연결합니다.

지원되는 로그인 방식 — 다음 세 가지 방식만 사용하십시오. 다른 방식은 지원되지 않습니다: Google, X, 이메일/비밀번호. 다른 소셜/OAuth 제공자(GitHub, Apple, Discord 등), 매직 링크, 패스키, OTP, 전화/SMS, 익명 로그인은 사용할 수 없습니다. GROK_PROVIDERS에 항목을 추가하지 마십시오. 방식 세부 정보 및 이메일/비밀번호 전환 (src/lib/auth/email-password.ts만 편집): references/sign-in-methods.md 예외 — 게이트 뷰어는 이미 로그인되어 있습니다. 이들을 위해 로그인/재인증 버튼을 절대 렌더링하지 마십시오. 커넥터/앱-데이터 앱: Google/X 버튼 없이 'Continue with Grok' 게이트만 사용: references/grok-identity.md

로그인은 기본적으로 비활성화되어 있습니다. — 템플릿은 .grok/app-env.json에 {"VITE_AUTH_ENABLED": "false"}를 포함하여 배포되므로, 요청이 계정을 요구할 때만 계정을 추가하십시오(AGENTS.md §0.5). 활성화는 아래 "로그인 켜기"를 따르십시오.

켜지면 로그인은 실제입니다. — 샌드박스 라이브 미리보기에서도 마찬가지입니다. 데모/모의/하드코딩된 사용자를 생성하지 마십시오. 미리보기: 팝업 + 내장 미리보기 클라이언트; 배포됨: 앱별 클라이언트 + DATABASE_URL + 제로 클릭 게이트 로그인(references/prewired-and-env.md)

비활성화 상태에서(VITE_AUTH_ENABLED=false) 개발 사용자가 반환되어 인증이 없는 앱이 로그인된 방문자 없이 렌더링됩니다. dev 및 미리보기 전용입니다. 배포되면 이 플래그는 플랫폼의 값(항상 "true")이므로 requireUserId는 모든 방문자를 거부합니다. 인증이 꺼진 앱은 requireUserId나 authMiddleware를 사용하지 않습니다.

모든 것은 src/lib/auth/ 에 사전 설치 및 사전 연결되어 있습니다. — npm install을 수행하지 마십시오. better-auth가 유일한 인증 패키지입니다(@neondatabase/*, @stackframe/*, @clerk/* 사용 금지). src/lib/auth/ 아래의 파일을 편집하거나 다시 작성하지 마십시오. — 특히 server.ts 파일은 절대 건드리지 말고, email-password.ts의 플래그만 편집하십시오. 파일별 맵: references/prewired-and-env.md

/auth/popup 은 템플릿 Vite 플러그인(vite.config.ts → popup.server.ts)이 이미 처리합니다. React 앱을 렌더링하지 않습니다. src/routes/auth/popup.tsx (또는 해당 경로의 React 페이지/클라이언트 OAuth)를 생성하지 마십시오. — 팝업 안에 전체 앱이 표시되어 일반적인 오류 모드가 발생합니다.

이 샌드박스에서 .env / .env.local / .env.example을 절대 작성하지 마십시오: 라이브 미리보기에는 환경 변수 구성이 전혀 필요하지 않으며, 배포된 앱은 플랫폼에서 변수를 주입합니다. 존재하는 노브(knob)는 references/prewired-and-env.md에 있습니다. — 클라이언트에 VITE_가 아닌 변수를 노출하지 마십시오.

migrations/auth/0001_auth.sql은 Better Auth 스키마입니다. — 편집하지 마십시오. 이 파일은 glob 패턴의 migrations/ 디렉토리 밖에 있으므로(어느 applier도 하강하지 않음) 로그인이 없는 앱에는 적용되지 않습니다. "로그인 켜기"에서 이 파일을 복사합니다.

로그인 켜기

다음 모든 단계를 수행하십시오. 라우트만으로 비활성화 분기가 렌더링됩니다.

  1. 플래그: .grok/app-env.json에서 VITE_AUTH_ENABLED 키를 삭제하고 dev 서버를 재시작하십시오. Vite는 시작 시 env를 읽으므로 HMR이 이를 감지하지 못합니다. npm run dev, npm run build 및 npm run preview는 모두 scripts/with-app-env.mjs를 통해 해당 파일을 읽으므로 미리보기와 빌드 출력이 함께 전환됩니다. Vite를 직접 시작하지 마십시오.
  2. 스키마: cp migrations/auth/0001_auth.sql migrations/0001_auth.sql을 실행한 후 재시작하여 적용합니다. 이 파일은 _migrations에서 기본 이름으로 추적되므로 이미 있는 데이터베이스에서는 다시 실행되지 않습니다.
  3. 라우트: src/routes/api/auth/$.ts + src/routes/login.tsx를 추가합니다. — 두 파일 모두 references/wiring.md에서 복사하십시오(포괄적인 API 라우트는 /api/auth/*와 브로커 콜백을 작동하게 합니다).
  4. 로그아웃: 로그인이 가능하면서 로그아웃이 없는 것은 완료된 것이 아닙니다. — @/lib/auth/gates에서 <UserButton />을 렌더링하십시오(signOut()을 연결하며, 게이트 세션에 대해 로그아웃을 숨깁니다).
  5. 기존 데이터: 앱의 서버 함수를 authMiddleware로 감싸십시오(인증이 꺼진 앱은 이 미들웨어를 사용하지 않았어야 합니다. — neon 기술 참조). 로그인 이전에 존재했던 행은 개발 데이터입니다. 사용자가 달리 명시하지 않는 한 이를 삭제하고 다시 생성하십시오. 누가 먼저 로그인하는지에 관계없이 전달하지 마십시오.

켜진 후 구축하기

  • 로그인/로그아웃: @/lib/auth/client의 signIn(providerId) 및 signOut(); GROK_PROVIDERS가 버튼을 렌더링합니다. 팝업, 베어러 토큰 핸드오프 및 요청 첨부는 내부적으로 처리되므로 그대로 두십시오. <UserButton />을 선호하십시오(대기 및 실패 상태를 처리합니다). 배포 시 서버가 확인하지 않으면 signOut()이 거부됩니다. 이를 catch하십시오. authClient.signOut()을 사용하지 마십시오. 미리보기 베어러 토큰이 이후의 모든 요청에 첨부되어 방문자가 로그인 상태로 유지됩니다.
  • 사용자 읽기: useCurrentUser()는 표시 전용입니다(null은 로딩 중 OR 로그아웃을 의미하므로 이 값만으로 리디렉션하지 마십시오). 대신 useCurrentUserState()의 isPending을 기준으로 가드하십시오. 게이트(SignedIn, SignedOut, SignInGate, RedirectToSignIn, UserButton)는 @/lib/auth/gates에 있습니다. CTA 하드 규칙, 스켈레톤 및 쿠키-SSR 제로 플래시: references/session-ui.md
  • 사용자별 데이터 (필수): 사용자별 데이터에 접근하는 모든 서버 함수는 사전 연결된 authMiddleware를 사용하고 모든 읽기 및 쓰기를 context.userId로 범위를 지정해야 합니다. Postgres 드라이버는 전체 DB 액세스 권한을 가지므로 다른 것은 쿼리를 제한하지 않습니다. user_id 열은 TEXT로 유지하십시오. 클라이언트가 제공한 사용자 ID를 절대 신뢰하지 마십시오. 로그아웃된 상태에서 미들웨어는 UnauthorizedError(401)를 throw합니다. 코드 및 비활성화 모드 의미론: references/per-user-data.md
  • 보안 모델: 헤드리스 브로커, __Host- 쿠키 + trustedOrigins, 그리고 Fetch-Metadata 형제 격리는 이미 연결되어 있습니다. 오류를 없애기 위해 이를 약화시키지 마십시오(references/sign-in-methods.md에서 모델과 "Invalid origin" 수정 방법을 다룹니다).

Individual skills in this repo

This repo contains 17 individual skills — each has its own dedicated page.

evalix098/tiktoklive

Build browser games and interactive/canvas/3D experiences in this TanStack Start + React app. Use for any game, simulation, or WebGL/Canvas experience — 2D or 3D, single-player. Covers the game loop & timing, 3D orientation/camera conventions, collision, performance, assets, audio, save, game feel, and per-genre playbooks. For WASD / vehicle / flight **input signs and inverted A/D**, open the **`controls`** skill — do not rely on this file or racing-kart alone. Triggers on "game", "minecraft", "fps", "platformer", "racing", "tetris", "snake", "shooter", "3d", "three.js", "canvas", "voxel", "physics".

evalix098/tiktoklive

Player-facing input signs for browser games: WASD, vehicles, flight, FPS mouse-look, and the #1 failure mode (inverted A/D). Mandatory control self-tests and a tiny test interface so you can verify A turns left before shipping. Load for ANY game with movement, steering, flying, driving, tanks, boats, mechs, drones, planes, karts, third-person follow cams — not only racing. Triggers on "controls", "WASD", "inverted", "steer", "flight", "airplane", "kart", "vehicle", "yaw", "roll", "pitch", "mouse look", "A/D".

evalix098/tiktoklive

Design and build polished, non-generic UI for this TanStack Start + React + Tailwind v4 + shadcn/Radix app. Use whenever you create or restyle any interface surface — pages, landing pages, dashboards, forms, modals, nav, and game overlays (start screens, HUD, menus). Covers design tokens, layout, typography, color, spacing, motion, and the anti-"AI-slop" rules that keep output from looking generic. Triggers on "design", "UI", "make it look good", "polish", "landing page", "theme", "style", "redesign", "ugly", "clean up".

evalix098/tiktoklive

Deep guide for game ANIMATION assets: motion cycles, action keyframes, effect sequences, and animation sprite sheets — built around a video-first pipeline. In this app-builder sandbox, execute via the video2dsprite / generate2dsprite skills (magenta + scripts), not ad-hoc ffmpeg. Use whenever generating anything that moves: walk/run cycles, attacks, idles, FX, flags, fire, animation sheets. Complements game-asset-core.

evalix098/tiktoklive

Core discipline for ANY game-asset generation with Imagine tools: the engine-ready defaults users don't state, spec checklists, style anchoring, read-back verification, honest defect flagging. Use whenever generating any game art (sprites, sheets, animations, tiles, UI, FX) — then ALSO load the matching specialist skill: game-animation-frames for anything that moves, game-tilesets for tiles/terrain, game-character-consistency for recurring characters, game-ui-icons for UI and icons.

evalix098/tiktoklive

Deep guide for CHARACTER IDENTITY across images: turnarounds (front/side/ back), state and damage variants, palette swaps, equipment changes, and same-character-in-context sets. Use whenever generating character turnarounds, character sheets, variants of an existing sprite, or any same-subject multi-image set. Complements game-asset-core.

evalix098/tiktoklive

Deep guide for game TILE assets: seamless tileable textures, terrain transition tilesets, autotiles, and ground/platform tiles. Use whenever generating tileable textures, tilesets, terrain transitions, or seamless patterns. Complements game-asset-core.

evalix098/tiktoklive

Deep guide for game UI assets: buttons with interaction states, panels, bars, wordmark logos, and icon sets. Use whenever generating game UI elements, HUD assets, inventory icons, icon sets, buttons, or title logos. Complements game-asset-core.

evalix098/tiktoklive

Generate production-oriented 2D game maps with `imagine_text_to_image`: RPG/top-down maps, side-scroller parallax stages, tilemaps, layered raster maps, prop packs, collision zones, and walkable areas. Use when building browser games that need real map art (not pure code-drawn tiles), layered props, or map collision metadata. Triggers on "map", "level", "stage", "tilemap", "overworld", "dungeon", "side scroller background", "prop pack", "2D map".

evalix098/tiktoklive

Generate and postprocess 2D game sprites and animation sheets: pixel-art characters, NPCs, creatures, spells, projectiles, impacts, props, summons, and transparent PNG/GIF exports. Use when building browser games that need real sprite sheets (not code-drawn placeholders), matching a map art style, or producing magenta-background sheets for chroma-key cleanup. Triggers on "sprite", "sprite sheet", "animation sheet", "pixel art character", "walk cycle", "attack animation", "projectile sprite", "2D game asset".

evalix098/tiktoklive

How to use the Imagine tools in Grok Build: imagine_text_to_image, imagine_image_to_image, imagine_reference_to_image, imagine_text_to_video, imagine_image_to_video, imagine_reference_to_video, and render_file for chat previews. When to build a visual with code instead of generating it, prompt-craft, reference-first handling of real people, factual grounding, and asset-consistency. Load this whenever generating or editing an image or video is on the table. Tool-usage-driven, not triggered by a user merely mentioning images.

evalix098/tiktoklive

Peer-to-peer realtime multiplayer over WebRTC data channels: every user of the deployed app connects directly to every other user (full mesh), the server only brokers the handshake at /api/rtc. Lowest possible latency, zero per-message server cost. Use for 2-8 player co-op/casual realtime: shared cursors, drawing, party games, casual action. Triggers: p2p, peer to peer, webrtc, low latency multiplayer, direct connection.

evalix098/tiktoklive

Use Neon Postgres (the database) in this TanStack Start app. Use when the app needs to store or query data, persist state, or keep per-user data. Triggers on "database", "Postgres", "Neon", "save data", "store data", "persist", "tables", "SQL", "query", "migrations".

evalix098/tiktoklive

Share-link previews and app identity for apps on *.grok.me: the injector-owned og:image card, the SVG favicon, and PWA icons for installable apps. Use when scaffolding, renaming, or restyling the app — and for share / unfurl / OG / Twitter card questions. A custom 1200×630 card from the app's own art is the default — games of every kind (DOM board/word games included), whimsical apps, creative tools, and brand-forward pages; only plain utilities keep the placeholder. Always run the brand-asset pass as a `task` subagent and never wait for it. Triggers on "share", "rename", "app name", "OG", "Open Graph", "twitter card", "unfurl", "og:image", "og:type", "x:game:image", "x-banner", "link preview", "social card", "thumbnail", "preview image", "favicon", "app icon", "PWA", "manifest", "installable", "home screen", "SEO", "meta description".

evalix098/tiktoklive

Official Three.js API and TSL (Three.js Shading Language) reference for LLM code generation. Load when writing or debugging three.js / WebGL / WebGPU / custom materials / shaders / GLTF / advanced three APIs beyond basic game loop/controls. Prefer building-games for game correctness (loop, WASD, camera, orientation); use this skill for full API/TSL depth. Triggers on "three.js", "threejs", "WebGPU", "TSL", "NodeMaterial", "shader", "GLTF", "MeshStandard", "OrbitControls", "WebGLRenderer".

evalix098/tiktoklive

Grok Build only. Turn a 2D character still into denser animation sprites via imagine_text_to_image base → imagine_image_to_video (6s/10s run-in-place) → ffmpeg frames → magenta chroma-key → dense sampled strips/grids/GIFs. Use when the user wants video-to-sprite, smoother run/walk cycles, or denser intermediate poses. Prefer generate2dsprite for crisp production pixel sheets. Triggers on "video to sprite", "imagine_image_to_video sprite", "dense walk cycle", "smooth run animation from video".

evalix098/tiktoklive

Call the xAI API (Grok) from this app's server code using the injected XAI_API_KEY: chat/LLM features, image and video generation (Imagine), and voice (text-to-speech). Use when the app needs any "AI" / "assistant" / "chatbot" / "Grok" functionality, runtime image/video generation, or speech. Triggers on "AI", "LLM", "chatbot", "assistant", "Grok", "xAI", "generate text", "summarize", "generate image", "AI video", "voice", "text to speech", "TTS", "OpenAI" (use xAI instead).

관련 스킬