Complete guide for building beautiful apps with Expo Router. Covers fundamentals, styling, components, navigation, animations, patterns, and native tabs.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Make a user an admin in NowStack Mobile's Convex backend by email. Use for "set admin", "make me admin", "ns set-admin", "/admin access denied", "This account does not have admin access", or the infinite /admin loader.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Three gates, all must pass — this is also the loader/denial root cause:
site-config.ts (auth.adminEmails) and convex/admin/auth.ts (ADMIN_EMAILS constant, line ~5). They drift independently; a mismatch is the #1 cause of /admin problems.users row has isAdmin === true (schema: convex/schema.ts, users.isAdmin).npx convex dev --once, or --prod for production).Loader/denial symptoms → cause:
ADMIN_EMAILS (gate 1). ensureAdminUser threw Not an admin./admin → ensureAdminUser never resolves: functions not deployed to this deployment, or the users row doesn't exist yet (signed in but ensureUser never ran). See web-app/app/routes/admin/route.tsx (adminReady).Use the email the user gives. If none, default to the first entry in site-config.ts auth.adminEmails. Lowercase it — the backend compares lowercased.
Ensure the email is present in BOTH:
site-config.ts → auth.adminEmails (keep the /** @type {string[]} */ ([...]) JSDoc cast wrapping — do not let Prettier strip the parens; see .agents/rules/mobile-app.md).convex/admin/auth.ts → const ADMIN_EMAILS = [...] (line ~5).Keeping them in sync is required even when you flip isAdmin directly: ensureAdminUser re-runs on every /admin mount and would never remove admin, but other checks read the allowlist.
Add an internalMutation to convex/admin/auth.ts so admin can be granted by email from the CLI. Add internalMutation to the existing _generated/server import, then append:
// Dev/ops utility: grant admin by email from the CLI (npx convex run).
// internalMutation = not callable from any client, only the CLI/server.
export const setAdminByEmail = internalMutation({
args: { email: v.string() },
handler: async (ctx, { email }) => {
const target = email.trim().toLowerCase();
const users = await ctx.db.query("users").collect();
const user = users.find((u) => u.email.trim().toLowerCase() === target);
if (!user) {
throw new Error(
`No users row for ${target}. Sign in once on /app or /admin first so the row is created, then re-run.`,
);
}
if (user.isAdmin) return { ok: true as const, alreadyAdmin: true, userId: user._id };
await ctx.db.patch(user._id, { isAdmin: true });
return { ok: true as const, alreadyAdmin: false, userId: user._id };
},
});
The .collect() scan matches the existing admin/queries.ts:listUsers pattern and is fine for this low-frequency ops utility.
npx convex dev --once # local/dev deployment
# or, to target production:
npx convex dev --once && npx convex deploy
npx convex run admin/auth:setAdminByEmail '{"email":"USER@EXAMPLE.COM"}'
# production deployment:
npx convex run --prod admin/auth:setAdminByEmail '{"email":"USER@EXAMPLE.COM"}'
If it throws "No users row" → the person must sign in once (web /app or /admin, or the mobile app) so ensureUser/ensureAdminUser creates the row, then re-run.
alreadyAdmin: true (idempotent)./admin in the browser: the spinner should resolve to the admin shell.npx convex run users/account:internalCheckAdmin '{"tokenIdentifier":"..."}' or inspect the users row in the Convex dashboard.--prod.npx convex dev --once # backend compiles + deploys
cd web-app && npm run typecheck # if you touched site-config / web admin
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Complete guide for building beautiful apps with Expo Router. Covers fundamentals, styling, components, navigation, animations, patterns, and native tabs.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Routes general Convex requests to the right project skill. Use when the user asks which Convex skill to use or gives an underspecified Convex app task.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when optimizing Convex database read bandwidth, documents-read cost, query indexes, full-table scans, function-level usage dashboard findings, or code that uses .filter(), unbounded .collect(), N+1 reads, or expensive reactive Convex queries.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Build reusable Convex components with isolated tables and app-facing wrappers. Use for defineComponent, app.use, ComponentApi, or shared backend modules.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Plan safe Convex schema and data migrations. Use for widen-migrate-narrow rollouts, backfills, breaking field changes, table splits, or failed schema deploys.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Audit Convex performance for hot reads, write contention, subscriptions, function limits, OCC conflicts, latency, read amplification, and expensive reactive queries.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.