This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Do not modify files that are not relevant to your task
- Do not make "while we're here" edits
- Please observe and adhere to existing formatting and code style
- Each of the services can be tested by modifying test.ts and running
bun ./src/test.ts
- Start development server:
bun run dev(with hot reload) - Start production server:
bun run start - Lint and format:
bun run lint(uses Biome and runs typecheck) - Type checking:
bun run typecheck - Install dependencies:
bun install
Copy .env-example to .env and configure required environment variables before starting development.
This is Ethereum Follow Protocol (EFP) Services - a service-based application that processes and caches data for the EFP ecosystem.
- Service Manager Pattern: The application uses a centralized
ServiceManagerclass insrc/index.tsthat orchestrates multiple background services running at configurable intervals - Database Layer: PostgreSQL with Kysely query builder and automatic reconnection handling
- Path Aliases: Uses
#/prefix for imports (configured in tsconfig.json)
The application runs these background services:
- recentFollows (
src/services/recentFollows/) - Tracks recent follow activity - leaderboard (
src/services/leaderboard/) - Generates user ranking data - recommended (
src/services/recommended/) - Manages recommendation algorithms - ensMetadata (
src/services/ensMetadata/) - Fetches ENS metadata - heartbeat (
src/services/heartbeat/) - Health monitoring - efpCache (
src/services/efpCache/) - Builds address cache for performance - mutuals (
src/services/mutuals/) - Processes mutual connections
- Connection: Robust PostgreSQL connection with automatic reconnection logic in
src/database/index.ts - Schema: Generated types in
src/database/generated/index.ts(likely auto-generated from database schema) - Error Handling: Database operations wrapped with connection failure recovery
- Chunked Processing: Services use
arrayToChunksutility for batch processing - SQL Integration: Direct SQL queries using Kysely's
sqltemplate function - Logging: Structured logging with
consolalibrary - Environment Management: Centralized environment variable handling in
src/env.ts
- Uses Bun runtime and package manager
- TypeScript with strict mode enabled
- Biome for linting and formatting
- Recent Follows: 2850s
- Leaderboard: 960s
- Recommended: 4260s
- ENS Metadata: 21600s
- Heartbeat: 290s
- EFP Cache: 3600s
- Mutuals: 973s