This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Name: FToolbox
- Description: Full-stack web application delivering analytics and tooling for Fansly creators and consumers with a SvelteKit frontend and Go backend.
- Key notes or warnings:
- Database schema source of truth is
backend-go/models; startup runs AutoMigrate viabackend-go/database/migrate.go. - Backend listens on
PORT(default3000frombackend-go/config/config.go);Taskfile.ymlonly clears3001for the Air loop. - Tag heat is legacy-only in this codebase; API responses currently force
heat = 0. - Fansly API access must go through
backend-go/fansly/client.go, which applies global throttling and retries. - Cloudflare Pages needs
PUBLIC_API_URLconfigured in the Pages dashboard at build time; thewrangler.toml [vars]block is not sufficient for SvelteKit builds.
- Database schema source of truth is
- NEVER use emojis!
- NEVER try to run the dev server unless explicitly asked.
- NEVER try to build in the project directory; always build in the
/tmpdirectory unless explicitly asked to build in the project directory. - NEVER use comments in code - code should be self-explanatory
- NEVER cut corners, don't leave comments like
TODO: Implement X in the future here! Always fully implement everything! - NEVER revert/delete any changes that you don't know about! Always assume that we are in the middle of a task and that the changes are intentional!
- ALWAYS at the end of your turn, ask a follow-up question for the next logical step (DON'T ask questions like "Should I run tests?" or "Should I lint?", only ask questions that are relevant to the task at hand)
After generating or editing code, you must always refactor your changes using well-established software engineering principles. These apply every time, without relying on diff inspection.
- DRY (Don’t Repeat Yourself): Eliminate duplicate or repetitive logic by consolidating shared behavior into common functions or helpers.
- KISS (Keep It Simple, Stupid): Prefer simple, straightforward solutions over unnecessarily complex or abstract designs.
- YAGNI (You Aren’t Gonna Need It): Only implement what is required for the current task; avoid speculative features or abstractions.
- Ensure the intent of your change is clear, explicit, and easy to understand.
- Maintain consistency with existing patterns, naming, and structure in the codebase.
- Remove duplication and merge similar logic following DRY.
- Simplify complex code paths or structures following KISS.
- Avoid adding features, hooks, or abstractions that the current task does not need, following YAGNI.
Principle:
Every change must simplify the codebase, reduce duplication, clarify intent, and make the system easier to maintain.
- Frontend: SvelteKit 2 + Svelte 5 + Vite + Tailwind v4 + shadcn-svelte primitives (
frontend/src/lib/components/ui). App runs withssr = falseinfrontend/src/routes/+layout.ts. - Backend: Go 1.26 Fiber API with Zap logging and GORM (MariaDB/MySQL driver), exposing JSON routes under
/api/*. - Workers: Background jobs are managed through
backend-go/workers/manager.go; worker state is persisted in theworkerstable. - Fansly Integration:
backend-go/fansly/client.goowns auth header usage (FANSLY_AUTH_TOKEN), retries, and global throttling (FANSLY_GLOBAL_RATE_LIMIT,FANSLY_GLOBAL_RATE_LIMIT_WINDOW). - Schema Source of Truth: GORM models in
backend-go/modelswith startup AutoMigrate inbackend-go/database/migrate.go. - Infrastructure:
Taskfile.ymlexists for human workflows and starts dev loops; treat it as reference only in agent work.
- Language: TypeScript
- Framework/runtime: SvelteKit 2 (Svelte 5) on Vite with Cloudflare adapter
- Package manager: pnpm
- Important Packages:
@sveltejs/kit,@sveltejs/adapter-cloudflare,tailwindcss@4,bits-ui,svelte-sonner,chart.js,chartjs-adapter-date-fns - Checks:
- Syntax Check:
pnpm check - Lint:
pnpm lint - Format:
pnpm format - ALWAYS run these after you are done making changes
- Syntax Check:
- Rules / conventions:
- ALWAYS build API requests with
$env/static/public(PUBLIC_API_URL) and use absolute API URLs. - NEVER hardcode backend hosts like
http://localhost:3000in frontend code. - ALWAYS compose UI from
frontend/src/lib/components/uiprimitives before adding new component patterns. - NEVER nest interactive components inside trigger components; the local ESLint rule
local/no-nested-interactiveenforces this. - NEVER run dev loops, previews, builds, or automated tests unless explicitly asked; run only the checks listed above.
- ALWAYS run the listed checks after frontend changes.
- ALWAYS keep Cloudflare Pages env settings aligned with frontend config for deployability.
- ALWAYS build API requests with
- Useful files:
frontend/eslint.config.jsfrontend/eslint-plugin-local/index.jsfrontend/svelte.config.jsfrontend/wrangler.tomlfrontend/.env.example
- Language: Go (1.26+)
- Framework/runtime: Fiber v2 with Zap logging
- Package manager: Go modules
- Important Packages:
github.com/gofiber/fiber/v2,gorm.io/gorm,gorm.io/driver/mysql,go.uber.org/zap,github.com/joho/godotenv - Checks:
- Format:
go fmt ./... - Vet:
go vet ./... - ALWAYS run these after you are done making changes
- Format:
- Rules / conventions:
- ALWAYS load configuration via
config.Load()and pass config into worker/client setup. - ALWAYS implement schema changes in
backend-go/modelsand rely on AutoMigrate. - ALWAYS return JSON errors in
{ "error": string }shape for route-level failures. - ALWAYS use the shared
fansly.Clientfor Fansly API calls so retry/rate-limit behavior stays centralized. - NEVER start Air/dev server/worker loops from agent tasks unless explicitly asked.
- NEVER run automated tests unless explicitly asked; run only
go fmt ./...andgo vet ./.... - ALWAYS run the listed checks after backend changes.
- ALWAYS load configuration via
- Useful files:
backend-go/config/config.gobackend-go/database/connection.gobackend-go/database/migrate.gobackend-go/routes/routes.gobackend-go/fansly/client.gobackend-go/workers/manager.gobackend-go/utils/utils.go
- Language: Mixed (YAML, shell)
- Framework/runtime: Taskfile helpers and repo automation
- Package manager: pnpm (frontend), Go modules (backend)
- Important Packages:
task,pnpm,air - Checks:
- Run frontend checks in
frontend:pnpm check,pnpm lint,pnpm format - Run backend checks in
backend-go:go fmt ./...,go vet ./... - ALWAYS run these after you are done making changes
- Run frontend checks in
- Rules / conventions:
- ALWAYS use
/tmpfor any build artifacts generated by the agent. - ALWAYS treat
Taskfile.ymlandclaude-code-github-bot-*.shscripts as references unless explicitly asked to edit them. - NEVER invoke
task watch-frontend,task watch-backend, or any command that starts a dev server unless explicitly asked. - NEVER search for or execute additional test suites unless explicitly requested.
- ALWAYS run the listed checks after changes.
- ALWAYS use
- Useful files:
Taskfile.ymlclaude-code-github-bot-setup.shclaude-code-github-bot-cleanup.sh
- Schema + Persistence: GORM models (
backend-go/models) are the authoritative schema, applied through AutoMigrate at startup. - HTTP Shape: Backend routes are grouped under
/api; list endpoints return domain data with pagination metadata, and failures return{ "error": string }. - Rate Limiting: Global Fiber limiter wraps all requests, with tighter per-route limiters on sensitive POST endpoints in
backend-go/routes/routes.go. - Worker Orchestration: Register workers via
WorkerManager, persist worker state in DB, and avoid ad-hoc goroutines outside established worker flows. - Ranking + Stats: Rank and statistics calculations are centralized in
backend-go/utils/utils.goand worker implementations, not in handlers. - Frontend Data Flow: Route loaders (
+page.ts) fetch initial page data usingPUBLIC_API_URL; avoid private env access from client-side code. - UI Conventions: Reuse shadcn-svelte primitives and local lint constraints (
local/no-nested-interactive) rather than introducing custom interaction patterns.