You are a senior engineering copilot for production-grade TypeScript/Node.js codebases.
Focus on architecture, boundaries, maintainability, and small reviewable changes.
| import { type ClientHint, getHintUtils } from "@epic-web/client-hints"; | |
| import { useEffect } from "react"; | |
| import { useRevalidator } from "react-router"; | |
| const MOBILE_BREAKPOINT = "(max-width: 1023px)"; // lower than lg | |
| const media = { | |
| mobile: "mobile", | |
| desktop: "desktop", | |
| } as const; |
| ARG APP_NAME=my-app | |
| # Base image | |
| FROM node:22-alpine AS base | |
| ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 | |
| ENV PNPM_HOME="/pnpm" | |
| ENV PATH="$PNPM_HOME:$PATH" | |
| RUN addgroup --system --gid 1001 rr && \ | |
| adduser --system --uid 1001 --ingroup rr rr && \ | |
| apk add --no-cache libc6-compat && \ |
| import cachified, { | |
| type CacheEntry, | |
| type Cache, | |
| totalTtl, | |
| } from "@epic-web/cachified"; | |
| import { ImageResponse } from "@vercel/og"; | |
| import { LRUCache } from "lru-cache"; | |
| import { serverDb } from "~/database/.server/db"; | |
| import { type PlaygroundId } from "~/database/types"; |
$ rsync -avn . /dev/shm --exclude-from .dockerignoreWhat this will do, is try to sync your current directory with the empty in-memory folder /dev/shm verbosely and dry-run (don't actually copy anything) the --exclude-from option reads glob patterns in the same format as .gitignore and .dockerignore
| import type { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node'; | |
| import { | |
| ClientActionFunctionArgs, | |
| ClientLoaderFunctionArgs, | |
| useFetcher, | |
| useLoaderData, | |
| } from '@remix-run/react'; | |
| import { enqueueActions, fromPromise, setup } from 'xstate'; | |
| import { useActor } from '@xstate/react'; | |
| import { useEffect, useRef } from 'react'; |
| # | |
| # See https://fly.io/docs/reference/configuration/ for information about how to use this file. | |
| # | |
| app = "my-app" | |
| primary_region = "cdg" | |
| kill_signal = "SIGINT" | |
| kill_timeout = "5s" | |
| swap_size_mb = 256 |
| /* -------------------------------------------------------------------------- */ | |
| /* More here; */ | |
| /* -------------------------------------------------------------------------- */ | |
| // https://gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15 | |
| export function distinctOn<Column extends AnyColumn>(column: Column) { | |
| return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`; | |
| } | |
| export function jsonBuildObject<T extends SelectedFields>(shape: T) { |
| Supabase's RLS Policy functions | PgTransaction config to set | Description |
|---|---|---|
auth.uid() |
set_config('request.jwt.claim.sub', <current_user_uid>, true) |
<current_user_uid> comes from your own way to get the current user uid |
auth.email() |
set_config('request.jwt.claim.email', <current_user_email>, true) |
<current_user_email> The current user email |
auth.role() |
set_config('request.jwt.claim.role', <current_user_role>, true) |
<current_user_role> The current user role |
auth.jwt() |
set_config('request.jwt.claim', <current_user_jwt>, true) |
<current_user_jwt> The current user jwt token. 🚨 I'm note sure about the config name, found nothing in Supabase repo |
| /** | |
| * App Install Manager | |
| * | |
| * Author: @rphlmr | |
| */ | |
| /** | |
| * You will be surprised by the code below. | |
| * | |
| * `beforeinstallprompt` is an event really hard to work with 😵💫 |