CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
97/100
Scores the file, not the repository.Length
946 words
31 headings · 2 code blocksRepository
89
— · pushed 28 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Project Overview67sedekah.je is a directory of QR codes for mosques, suraus, and other religious institutions in Malaysia. It's a community-driven platform built with Next.js 14, TypeScript, PostgreSQL (Drizzle ORM), and Better Auth.89## Development Commands1011```bash12# Development13bun dev # Start development server14bun build # Production build15bun start # Production server1617# Code Quality18bun run check # Run Biome lint + format19bun run lint # Lint only20bun run format # Format code21bun run type-check # TypeScript checking2223# Database24bun run db:seed # Seed database25bun run db:truncate # Clear database2627# Utilities28bun run clean # Remove node_modules, .next, locks29bun run import:walter-qrs # Bulk QR import from scripts/data (see script header)30bun run match:walter-institutions # Read-only Walter vs existing similarity audit (see script header)31bun run review:walter-medium # GPT-4o-mini review of nameMatchesMedium (OPENAI_API_KEY; see script header)32```3334**Important**: This project uses Bun as the package manager and runtime. Always use `bun` instead of `npm` or `yarn`.3536## Architecture3738### App Router Structure (Next.js 13+)39- `/app/(admin)/` - Admin dashboard with role-based access40- `/app/(user)/` - User-facing features41- `/app/api/` - API routes and server actions42- `/app/[institution]/[slug]/` - Dynamic institution pages4344### Key Directories45- `/components/` - React components (uses shadcn/ui)46- `/lib/` - Utilities, database queries, server actions47- `/db/` - Database schema and migrations (Drizzle ORM)48- `/hooks/` - Custom React hooks4950### Database Schema51Core entities:52- **users** - Authentication and profiles53- **institutions** - QR codes, locations, approval status54- **auth sessions/accounts** - Better Auth tables5556Workflow: Institutions go through Pending → Approved/Rejected states.5758## Technology Stack5960- **Framework**: Next.js 14 with App Router61- **Database**: PostgreSQL with Drizzle ORM62- **Auth**: Better Auth with Google OAuth63- **Styling**: Tailwind CSS + shadcn/ui components64- **Code Quality**: Biome (replaces ESLint + Prettier)65- **State**: TanStack React Query + URL state (nuqs)66- **Storage**: Cloudflare R2 for images67- **Security**: Cloudflare Turnstile6869## Development Guidelines7071### Code Quality72- Use Biome for all formatting and linting (tabs, 80 chars, configured in `biome.json`)73- TypeScript strict mode - NO `any` types, proper inference74- Run `bun run check` before committing75- Follow Malaysian context for UI/UX (Bahasa Malaysia, payment systems)7677### File Organization & Architecture78**Feature-Based Structure** (avoid file type grouping):79```80app/(user)/feature/81├── _lib/82│ ├── queries.ts # Server queries (cached with unstable_cache)83│ ├── actions.ts # Server actions (mutations)84│ ├── validations.ts # Zod schemas85│ └── types.ts # TypeScript types86├── _components/ # Private components87└── page.tsx # Route page88```8990### Key Principles911. **Server Actions First** - Use server actions instead of API routes922. **Avoid pg enums** - Use object constants for easier production management933. **No useEffect for data fetching** - Fetch at server component, pass as props944. **Server Components by Default** - Only use "use client" when needed9596### Authentication (Better Auth)97- Layout-based route protection: `/app/(user)/layout.tsx` and `/app/(admin)/layout.tsx`98- Server-side: `const session = await auth.api.getSession({ headers: headers() })`99- Client-side: `useAuth()` hook for user state100- Roles: "user" (contributors) and "admin" (approval rights)101102### Database Patterns (Drizzle ORM)103- **Performance**: Wrap queries with `unstable_cache` for caching104- **Batch Operations**: Use `inArray()` instead of Promise.all loops105- **Counting**: Use Drizzle `count()` function, not `.length`106- **Cache Invalidation**: Use `revalidateTag()` for targeted invalidation107- **Schema**: Export types with `$inferSelect` and `$inferInsert`108109### Form Handling Pattern1101. Zod schema in `_lib/validations.ts`1112. Server action in `_lib/actions.ts` with proper validation1123. React Hook Form + useFormState for client component1134. Always validate on server, handle authentication1145. Use `revalidatePath()` after mutations115116### Performance Optimizations117- **UI Streaming**: Break complex pages into async components with `<Suspense>`118- **Caching**: Use `unstable_cache` with appropriate TTL (300s for dynamic, 900s for stable)119- **Server Components**: Fetch data at server level, minimize client-side requests120121## Testing122123No formal testing framework is currently set up. Consider this when making changes that require testing.124125## Business Context (Malaysian Focus)126127### Institution Types & Themes128- `mosque` (masjid) - Blue theme color129- `surau` - Green theme color130- `others` (lain-lain) - Violet theme color131132### Payment Methods133- `duitnow` - Malaysian instant payment system134- `tng` - Touch 'n Go eWallet135- `boost` - Boost eWallet136137### Institution Workflow138- `pending` - Awaiting admin approval (default for new submissions)139- `approved` - Approved by admin and visible to public140- `rejected` - Rejected by admin with reason141142### Data Sources143- **Static Data**: Historical institutions in `app/data/institutions.ts`144- **Dynamic Data**: User-contributed institutions in PostgreSQL145- **Combined Display**: Both sources shown together on maps and listings146147## Special Features148149- **QR Code Processing**: Automatic extraction and validation of payment QR codes150- **Geolocation**: Institution mapping with Malaysian state-based filtering151- **PWA**: Progressive Web App configuration152- **Telegram Integration**: Logging for new user registrations and institution submissions153- **Workflow Management**: Institution approval system with admin controls154- **Malaysian States**: All 16 states and federal territories with flag support155156## Common Tasks157158### Adding New Institution Fields1591. Update schema in `/db/schema/institutions.ts`1602. Create migration with Drizzle1613. Update form components in `/components/`1624. Update validation schemas163164### Adding New API Endpoints1651. Create route in `/app/api/`1662. Use server actions for mutations1673. Add queries in `/lib/queries/`1684. Update React Query hooks169170### Database Operations171- Connection configured through `DATABASE_URL`172- Optional `DIRECT_URL` for connection pooling173- Schema changes require migrations via Drizzle174175Remember: This is a community project focused on Malaysian religious institutions. Maintain respect for the cultural context and ensure all QR codes are legitimate donation channels.
Also in khrnchn/sedekah-je
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| khrnchn/sedekah-je.cursor/rules/sedekahje-general-rules.mdc · 89 | Cursor rules | style | 34/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 950 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 950 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | 3 days ago | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago | |
| dotCMS/corecore-web/libs/sdk/client/CLAUDE.md · 950 | CLAUDE.md | setupbuildtestlint-format+9 | 97/100 | 3 days ago | |
| skillrecordings/egghead-nextCLAUDE.md · 1.4k | CLAUDE.md | setupbuildtestlint-format+8 | 97/100 | 3 days ago |
