Communitygithub.com

evalix098/tiktoklive

Adicionar contas de usuário e login a este aplicativo TanStack Start. Use quando o aplicativo precisar de autenticação, login, contas de usuário, rotas protegidas ou dados por usuário. Ativado por 'auth', 'login', 'log in', 'sign in', 'sign up', 'account', 'users', 'authentication', 'protected', 'who is logged in', 'current user', 'per-user'.

O que é tiktoklive?

Esta skill configura autenticação completa em aplicativos TanStack Start usando Better Auth, com suporte a login via Google, X e email/senha. Ela integra um broker de autenticação centralizado (Grok auth broker) via plugin genérico OAuth, permitindo que o aplicativo gerencie contas de usuário, rotas protegidas e dados por usuário de forma real—sem usuários mock ou demo. A skill é compatível com o ecossistema TanStack Start, incluindo Vite e React, e fornece componentes prontos como UserButton, SignedIn, SignedOut e middleware de autenticação (authMiddleware) para controle de acesso e escopo de dados a nível de servidor. O funcionamento é baseado em um sistema de tokens bearer e cookies seguros, com isolamento entre sessões de portão (gate) e usuários reais, e inclui instruções detalhadas para ativar a autenticação (que vem desligada por padrão) e para construir funcionalidades como login, logout e proteção de dados por usuário sem enfraquecer a segurança.

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

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Auth

Este aplicativo executa seu próprio Better Auth em /api/auth/*, federando ao broker de autenticação Grok compartilhado (auth.grok.me) via o plugin genericOAuth. Este template configura Google e X.

Métodos de login suportados — use APENAS estes três; nada mais é suportado: Google, X e email/senha. Nenhum outro provedor social/OAuth (GitHub, Apple, Discord, …), sem links mágicos, chaves de acesso, OTP, telefone/SMS ou login anônimo. Não adicione entradas a GROK_PROVIDERS. Detalhes do método e a chave de email/senha (edite apenas src/lib/auth/email-password.ts): references/sign-in-methods.md. Exceção — usuários do portão (gate) já estão logados; NUNCA renderize botões de login/reauth para eles. Aplicativos conector / app-data: APENAS portão 'Continuar com Grok', sem botões Google/X: references/grok-identity.md.

O login está DESLIGADO por padrão — o template inclui .grok/app-env.json com {"VITE_AUTH_ENABLED": "false"}, então só adicione contas quando a solicitação pedir por elas (AGENTS.md §0.5). Ativá-lo é 'Ativando o login' abaixo.

Uma vez ativado, o login é REAL — inclusive na pré-visualização ao vivo do sandbox. NÃO crie usuários demo/mock/difíceis. Pré-visualização: pop-up + cliente de pré-visualização embutido; implantado: cliente por aplicativo + DATABASE_URL + login do portão com zero clique (references/prewired-and-env.md).

Enquanto DESLIGADO (VITE_AUTH_ENABLED=false) um usuário de desenvolvimento é retornado para que um aplicativo sem autenticação seja renderizado sem um visitante logado — apenas desenvolvimento e pré-visualização. Implantado, a flag é da plataforma (sempre "true"), então requireUserId rejeita todos os visitantes — aplicativos sem autenticação não usam nem ela nem authMiddleware.

Tudo está pré-instalado e pré-configurado em src/lib/auth/ — não execute npm install em nada; better-auth é o único pacote de autenticação (nunca @neondatabase/*, @stackframe/* ou @clerk/*). Não edite nem reescreva nenhum arquivo em src/lib/auth/ — server.ts menos ainda — exceto email-password.ts para sua única flag. Mapa por arquivo: references/prewired-and-env.md.

/auth/popup já é tratado pelo plugin Vite do template (vite.config.ts → popup.server.ts): ele nunca renderiza o aplicativo React. NÃO crie src/routes/auth/popup.tsx (ou qualquer página React / OAuth do cliente nesse caminho) — isso mostra o aplicativo completo dentro do pop-up, que é o modo comum de falha.

Nunca escreva um .env / .env.local / .env.example neste sandbox: a pré-visualização ao vivo precisa de zero configuração de ambiente e um aplicativo implantado recebe suas variáveis injetadas pela plataforma. Os parâmetros existentes estão em references/prewired-and-env.md — nunca exponha uma var não-VITE_ ao cliente.

migrations/auth/0001_auth.sql é o esquema do Better Auth — não edite. Ele fica fora do diretório globado migrations/ (nenhum aplicador desce até ele), então não é aplicado a aplicativos sem login; 'Ativando o login' o copia para cima.

Ativando o login

Faça tudo isso — as rotas sozinhas renderizam o branch desabilitado:

  1. Flag: remova a chave VITE_AUTH_ENABLED de .grok/app-env.json e reinicie o servidor de desenvolvimento. O Vite lê o ambiente na inicialização, então HMR não vai detectar a mudança. npm run dev, npm run build e npm run preview todos leem esse arquivo através de scripts/with-app-env.mjs, então a pré-visualização e a saída compilada alternam juntos — nunca inicie o Vite diretamente.
  2. Esquema: cp migrations/auth/0001_auth.sql migrations/0001_auth.sql, em seguida reinicie para que seja aplicado. Ele é rastreado pelo nome base em _migrations, então um banco de dados que já o possui não o executará novamente.
  3. Rotas: adicione src/routes/api/auth/$.ts + src/routes/login.tsx — copie ambos de references/wiring.md (a rota de API catch-all é o que torna /api/auth/* e o callback do broker funcionais).
  4. Sair: um login sem saída não está completo — renderize <UserButton /> de @/lib/auth/gates (conecta signOut(); esconde a saída para sessões de portão).
  5. Dados existentes: envolva as funções de servidor do aplicativo em authMiddleware (um aplicativo sem autenticação não deve estar usando isso — veja a skill neon). Linhas de antes do login existir são dados de desenvolvimento: descarte e recrie eles a menos que o usuário diga o contrário — não os entregue a quem fizer login primeiro.

Construindo sobre ele uma vez ativado

  • Entrar / sair: signIn(providerId) e signOut() de @/lib/auth/client; GROK_PROVIDERS renderiza os botões. O pop-up, hand-off do token bearer e anexo de requisição são internos — deixe-os em paz. Prefira <UserButton /> (ele lida com os estados pendente e de falha); signOut() rejeita quando implantado se o servidor nunca confirmar — trate a exceção. Nunca authClient.signOut(): ele deixa o token bearer da pré-visualização anexado a todas as requisições posteriores, então o visitante permanece logado.
  • Lendo o usuário: useCurrentUser() é apenas para exibição (null significa carregando OU deslogado, então nunca redirecione apenas com base nele); proteja-se com useCurrentUserState()'s isPending em vez disso. Portões (SignedIn, SignedOut, SignInGate, RedirectToSignIn, UserButton) estão em @/lib/auth/gates. Regras rígidas de CTA, esqueleto e cookie-SSR sem flash: references/session-ui.md.
  • Dados por usuário (obrigatório): toda função de servidor que acessa dados por usuário deve usar o authMiddleware pré-configurado e escopar toda leitura e escrita a context.userId — um driver Postgres tem acesso completo ao banco, então nada mais limita a consulta. Mantenha colunas user_id como TEXT; nunca confie em um id de usuário fornecido pelo cliente; deslogado, o middleware lança UnauthorizedError (401). Código e semântica do modo desabilitado: references/per-user-data.md.
  • Modelo de segurança: broker headless, cookies __Host- + trustedOrigins e isolamento de irmãos Fetch-Metadata já estão configurados — nunca os enfraqueça para fazer um erro desaparecer (references/sign-in-methods.md cobre o modelo e a correção de 'Origem inválida').

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).

Habilidades Relacionadas