This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
bun run dev- Start development server with Turbo- Open http://localhost:3000 to view the application
bun run db:generate- Generate database migrations from schema changesbun run db:push- Push schema changes to databasebun run db:studio- Open Drizzle Studio (database GUI)
bun run build- Build for productionbun run start- Start production serverbun run lint- Run ESLint checks
bun run play- Run backend playground script (src/backend/play.ts)
- Frontend: Next.js 15 (App Router), React 19, TypeScript
- Styling: Tailwind CSS, shadcn/ui components
- Backend: Next.js API routes, Drizzle ORM
- Database: PostgreSQL
- Authentication: GitHub OAuth
- Search: MeilSearch
- File Storage: Cloudinary
- State Management: Jotai, React Hook Form with Zod validation
- SQLKit - Very light sql query builder, we are using most of the sql query using this.
- Drizzle ORM - Awesome sql tool but we are only using for migration
- PostgreSQL - Primary database
- Next.js API Routes - Backend API
- Route groups using Next.js App Router:
(home)- Main homepage and article feed(dashboard-editor)- Protected dashboard routes[username]- User profile pages[username]/[articleHandle]- Individual article pages
- API routes in
/api/for OAuth and development
- Domain Models (
/domain/) - Core business logic entities - Persistence (
/persistence/) - Database schemas and repositories - Services (
/services/) - Business logic actions - Input Validation - Zod schemas for type-safe inputs
- UI Components - shadcn/ui based design system
- Feature Components - Domain-specific (Editor, Navbar, etc.)
- Layout Components - Page layouts and providers
Key entities and their relationships:
- Users - User profiles with social authentication
- Articles - Blog posts with markdown content and metadata
- Series - Article collections/sequences
- Comments - Nested commenting system with resource association
- Tags - Article categorization
- Bookmarks - User content saving
- Reactions - Emoji-based reactions (LOVE, FIRE, WOW, etc.)
- User Sessions - Session management
- User Socials - OAuth provider connections
- Rich Text: Markdoc for markdown parsing and rendering
- File Uploads: Cloudinary integration for images/media
- Search: MeilSearch for full-text search capabilities
- Internationalization: Custom i18n implementation (Bengali/English)
- Server State: Drizzle ORM with PostgreSQL
- Client State: Jotai for global state management
- Form State: React Hook Form with Zod validation
- Environment: Type-safe environment variables with @t3-oss/env-nextjs
Server-side:
DATABASE_URL- PostgreSQL connection stringGITHUB_CLIENT_ID- GitHub OAuth client IDGITHUB_CLIENT_SECRET- GitHub OAuth client secretGITHUB_CALLBACK_URL- OAuth callback URLCLOUDINARY_URL- Cloudinary configurationMEILISEARCH_ADMIN_API_KEY- MeilSearch admin API key
Client-side:
NEXT_PUBLIC_MEILISEARCH_API_HOST- MeilSearch API host URLNEXT_PUBLIC_MEILISEARCH_SEARCH_API_KEY- MeilSearch search API key
- GitHub OAuth integration via
/api/auth/github - User sessions managed in
userSessionsTable - Social provider connections in
userSocialsTable
- Rich markdown editor with drag-and-drop support
- Image upload and optimization via Cloudinary
- Article series management for content organization
- Tag-based categorization system
- MeilSearch for full-text search across articles
- Search configuration and indexing handled in backend services
- Client-side search interface with real-time results
- Nested commenting system with resource association
- Emoji-based reactions (LOVE, FIRE, WOW, etc.)
- User following and bookmarking functionality
- Social sharing and user profiles
- Database changes require running
bun run db:generatefollowed bybun run db:push - Backend logic testing can be done via
bun run playplayground script - Type safety is enforced through Zod schemas for all inputs
- UI components follow shadcn/ui patterns and conventions
- All forms use React Hook Form with Zod validation schemas
- When querying data in component always use Tanstack Query.
- When interacting with DB, create a action in
src/backend/servicesand use sqlkit package (https://github.com/sqlkit-dev/sqlkit) - For Database schema reference look here for drizzle schema
src/backend/persistence/schemas.ts
- Bengali Language Support: Custom font loading (Kohinoor Bangla) and i18n
- SEO Optimization: Dynamic sitemaps, Open Graph tags, and schema markup
- Performance: Next.js Image optimization, bundle splitting, and caching
- Security: Input validation via Zod, secure OAuth flow, environment variable validation