Source:
ocean/docs/audits/codebase-audit-2025-08-29.md| ✏️ Edit on GitHub
Ocean Codebase Audit — 2025-08-29
Generated at 2025-08-29T11:22:22-04:00
⚠️ DEPRECATED: All issues identified in this audit have been resolved as of 2025-08-29.
See ADR-046: Codebase Audit Remediation for implementation details.
This document is preserved for historical reference only.
Scope
- Dependencies and script ecosystem
- Broken patterns / risky usages
- Duplicate or dead code
- Suggested remediations
Summary of Findings
- Missing dev tools in dependencies:
tsx,ts-node, andconcurrentlyare used inpackage.jsonscripts but not present indevDependencies. - Server-only SDK in src with a hardcoded key:
posthog-nodeis imported insrc/lib/posthog-edge.tswith a default API key value. File is not referenced elsewhere but should be isolated from client code and secrets removed. - Duplicate components: Two OTP component implementations (
src/components/ui/input-otp.tsxandsrc/components/ui/input-otp-custom.tsx) with overlapping responsibility. One appears redundant. - Duplicate data-table columns: Parallel column definitions exist in
src/components/data-table/columns.tsxand an unused variant insrc/components/data-table-columns.tsx. - General setup otherwise consistent: React 19 + Vite 6 + Tailwind 4 + TanStack ecosystem versions are aligned. Sentry and Tailwind plugin configuration look correct.
Evidence & Details
1) Dependencies and Scripts
-
Scripts using missing packages in
package.json:codegen:schema,analyze:bundle,perf:checkusetsx.design:codemodusests-node --transpile-only.dev:fullusesconcurrently.- None of
tsx,ts-node,concurrentlyare declared indevDependenciesofpackage.json(/package.jsonlines ~117–160).
-
Tailwind plugin usage:
@tailwindcss/vitepresent and configured invite.config.ts.tailwindcss-animateis declared and used insrc/styles.cssvia@plugin "tailwindcss-animate".
-
Stripe packages:
@stripe/react-stripe-jsand@stripe/stripe-js(browser) independencies.stripe(server SDK) indevDependenciesonly; no usages found undersrc/(good separation).
2) Server-only SDK in src with default key
- File:
src/lib/posthog-edge.ts- Imports server SDK:
import { PostHog } from 'posthog-node'. - Initializes client with a default API key fallback:
process.env.VITE_POSTHOG_API_KEY || 'phc_…'. - Risks:
- Keeping a default key string in the repo is a security footgun, even if not currently imported elsewhere.
VITE_prefix is meant for Vite-exposed client env vars; Edge/server code should read non-exposed keys (e.g.,POSTHOG_SECRET_KEY).
- Current usage: no in-repo references found to
posthog-edge.ts(appears unused), but its location insrc/lib/increases the chance of accidental client import.
- Imports server SDK:
3) Duplicate / Dead Code
-
OTP components:
src/components/ui/input-otp.tsxandsrc/components/ui/input-otp-custom.tsxboth wrapinput-otpwith similar slot APIs and styling.- Consider consolidating into a single implementation exported with a stable API.
-
Data-table columns:
src/components/data-table/columns.tsx: Active column model used bysrc/components/data-table/index.tsx.src/components/data-table-columns.tsx: Alternate/older column model. No references found; likely dead code.
4) Configuration sanity checks
-
Vite config (
/vite.config.ts):- Plugins: TanStack Router, React, Tailwind, Sentry — ordered and gated properly.
- Manual chunks configured for vendor splitting; aligns with bundle outputs in
/dist/assets/*.
-
Classnames utility (
/src/lib/utils.ts):- Single
cn()helper backed byclsx+tailwind-merge. No duplicatecnfound.
- Single
Mermaid — Dependency Script Usage Map
Mermaid — Analytics Architecture
Recommendations
-
Add missing dev tools to
devDependenciesin/package.json:tsx,ts-node,concurrentlywith pinned versions compatible with Node 18+.
-
Secure and isolate server analytics:
- Remove default API key literal in
src/lib/posthog-edge.ts. - Read a server-only env var (e.g.,
POSTHOG_SECRET_KEY) instead ofVITE_*. - Move file under a server-only directory (e.g.,
server/orsupabase/functions/_shared/), or add an eslint rule/bazel path block to prevent client imports. - If unused, delete the file to reduce risk.
- Remove default API key literal in
-
Deduplicate components:
- Merge
input-otp.tsxandinput-otp-custom.tsxinto a single, themable OTP component. - Delete
src/components/data-table-columns.tsxif truly unused, or integrate its variants into the active table via feature flags/props.
- Merge
-
Add guardrails:
- Add ESLint restriction to forbid importing
posthog-nodefrom anywhere undersrc/. - Add CI check to fail on presence of default secret-like strings (basic regex patterns) in source.
- Add ESLint restriction to forbid importing
Additional Observations
-
Dual icon libraries in use:
lucide-reactand@tabler/icons-reactare both imported across UI components (e.g.,src/components/data-table/columns.tsx,src/components/nav-*).- Not a bug, but consolidating to a single library can reduce bundle size and maintenance overhead.
-
next-themes in a Vite (non-Next) app:
- Referenced in
src/components/ui/sonner.tsx,src/hooks/use-theme.ts, andsrc/routes/__root.tsx. - Acceptable for CSR usage; no concrete issues detected. Keep if it meets theming needs.
- Referenced in
Validation Pass — 2025-08-29 11:26 EDT
- Re-ran targeted searches to confirm all findings:
- Missing dev tools (
tsx,ts-node,concurrently) still not present indevDependencies. src/lib/posthog-edge.tsremains unused, contains default API key fallback, and importsposthog-nodeundersrc/.- Duplicate OTP components confirmed; both wrap
input-otp. src/components/data-table-columns.tsxhas no inbound references; active table usessrc/components/data-table/columns.tsx.- No
stripe(server SDK) imports undersrc/. - Single
cn()utility atsrc/lib/utils.ts; no duplicates.
- Missing dev tools (
- No contradictions found compared to the initial audit.
Citations
package.jsonscripts and deps:/package.json- Vite config:
/vite.config.ts - Tailwind usage:
/src/styles.css - Client analytics wrapper:
/src/lib/posthog.ts - Edge/server analytics (risk):
/src/lib/posthog-edge.ts - Classnames utility:
/src/lib/utils.ts - Data table and columns:
/src/components/data-table/index.tsx,/src/components/data-table/columns.tsx,/src/components/data-table-columns.tsx - OTP components:
/src/components/ui/input-otp.tsx,/src/components/ui/input-otp-custom.tsx