Skip to content

Commit 33a2bac

Browse files
authored
Merge pull request #72 from techdiary-dev/main
merge from prod(main)
2 parents 48c7a41 + 6381a51 commit 33a2bac

File tree

238 files changed

+24298
-17154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+24298
-17154
lines changed

.dev.vars

Whitespace-only changes.

.github/persistence-context.md

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@beta
37+
with:
38+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
39+
40+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
41+
# model: "claude-opus-4-20250514"
42+
43+
# Direct prompt for automated review (no @claude mention needed)
44+
direct_prompt: |
45+
Please review this pull request and provide feedback on:
46+
- Code quality and best practices
47+
- Potential bugs or issues
48+
- Performance considerations
49+
- Security concerns
50+
- Test coverage
51+
52+
Be constructive and helpful in your feedback.
53+
54+
# Optional: Customize review based on file types
55+
# direct_prompt: |
56+
# Review this PR focusing on:
57+
# - For TypeScript files: Type safety and proper interface usage
58+
# - For API endpoints: Security, input validation, and error handling
59+
# - For React components: Performance, accessibility, and best practices
60+
# - For tests: Coverage, edge cases, and test quality
61+
62+
# Optional: Different prompts for different authors
63+
# direct_prompt: |
64+
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
65+
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
66+
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
67+
68+
# Optional: Add specific tools for running tests or linting
69+
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
70+
71+
# Optional: Skip review for certain conditions
72+
# if: |
73+
# !contains(github.event.pull_request.title, '[skip-review]') &&
74+
# !contains(github.event.pull_request.title, '[WIP]')
75+

.github/workflows/claude.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 1
31+
32+
- name: Run Claude Code
33+
id: claude
34+
uses: anthropics/claude-code-action@beta
35+
with:
36+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
37+
38+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
39+
# model: "claude-opus-4-20250514"
40+
41+
# Optional: Customize the trigger phrase (default: @claude)
42+
# trigger_phrase: "/claude"
43+
44+
# Optional: Trigger when specific user is assigned to an issue
45+
# assignee_trigger: "claude-bot"
46+
47+
# Optional: Allow Claude to run specific commands
48+
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
49+
50+
# Optional: Add custom instructions for Claude to customize its behavior for your project
51+
# custom_instructions: |
52+
# Follow our coding standards
53+
# Ensure all new code has tests
54+
# Use TypeScript for new files
55+
56+
# Optional: Custom environment variables for Claude
57+
# claude_env: |
58+
# NODE_ENV: test
59+

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pnpm-lock.yaml
1010
bun.lockb
1111
bun.lock
1212
.yarn/install-state.gz
13+
package-lock.json
1314

1415
# testing
1516
/coverage
@@ -32,10 +33,15 @@ yarn-error.log*
3233

3334
# local env files
3435
.env*.local
36+
.env
37+
.dev.vars
3538

3639
# vercel
3740
.vercel
3841

3942
# typescript
4043
*.tsbuildinfo
4144
next-env.d.ts
45+
.vscode/mcp.json
46+
# Sentry Config File
47+
.env.sentry-build-plugin

.idea/.gitignore

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/prettier.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.todo

Lines changed: 0 additions & 5 deletions
This file was deleted.

CLAUDE.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Development Commands
6+
7+
### Development Server
8+
- `bun run dev` - Start development server with Turbo
9+
- Open http://localhost:3000 to view the application
10+
11+
### Database Operations
12+
- `bun run db:generate` - Generate database migrations from schema changes
13+
- `bun run db:push` - Push schema changes to database
14+
- `bun run db:studio` - Open Drizzle Studio (database GUI)
15+
16+
### Build & Deployment
17+
- `bun run build` - Build for production
18+
- `bun run start` - Start production server
19+
- `bun run lint` - Run ESLint checks
20+
21+
### Backend Development
22+
- `bun run play` - Run backend playground script (`src/backend/play.ts`)
23+
24+
## Architecture Overview
25+
26+
### Technology Stack
27+
- **Frontend**: Next.js 15 (App Router), React 19, TypeScript
28+
- **Styling**: Tailwind CSS, shadcn/ui components
29+
- **Backend**: Next.js API routes, Drizzle ORM
30+
- **Database**: PostgreSQL
31+
- **Authentication**: GitHub OAuth
32+
- **Search**: MeilSearch
33+
- **File Storage**: Cloudinary
34+
- **State Management**: Jotai, React Hook Form with Zod validation
35+
36+
### Backend & Database
37+
- **[SQLKit](https://github.com/sqlkit-dev/sqlkit)** - Very light sql query builder, we are using most of the sql query using this.
38+
- **[Drizzle ORM](https://orm.drizzle.team/)** - Awesome sql tool but we are only using for migration
39+
- **[PostgreSQL](https://www.postgresql.org/)** - Primary database
40+
- **[Next.js API Routes](https://nextjs.org/docs/api-routes/introduction)** - Backend API
41+
42+
### Core Directory Structure
43+
44+
#### Frontend (`/src/app/`)
45+
- Route groups using Next.js App Router:
46+
- `(home)` - Main homepage and article feed
47+
- `(dashboard-editor)` - Protected dashboard routes
48+
- `[username]` - User profile pages
49+
- `[username]/[articleHandle]` - Individual article pages
50+
- API routes in `/api/` for OAuth and development
51+
52+
#### Backend (`/src/backend/`)
53+
- **Domain Models** (`/domain/`) - Core business logic entities
54+
- **Persistence** (`/persistence/`) - Database schemas and repositories
55+
- **Services** (`/services/`) - Business logic actions
56+
- **Input Validation** - Zod schemas for type-safe inputs
57+
58+
#### Component Architecture (`/src/components/`)
59+
- **UI Components** - shadcn/ui based design system
60+
- **Feature Components** - Domain-specific (Editor, Navbar, etc.)
61+
- **Layout Components** - Page layouts and providers
62+
63+
### Database Schema Architecture
64+
65+
Key entities and their relationships:
66+
- **Users** - User profiles with social authentication
67+
- **Articles** - Blog posts with markdown content and metadata
68+
- **Series** - Article collections/sequences
69+
- **Comments** - Nested commenting system with resource association
70+
- **Tags** - Article categorization
71+
- **Bookmarks** - User content saving
72+
- **Reactions** - Emoji-based reactions (LOVE, FIRE, WOW, etc.)
73+
- **User Sessions** - Session management
74+
- **User Socials** - OAuth provider connections
75+
76+
### Content Management
77+
- **Rich Text**: Markdoc for markdown parsing and rendering
78+
- **File Uploads**: Cloudinary integration for images/media
79+
- **Search**: MeilSearch for full-text search capabilities
80+
- **Internationalization**: Custom i18n implementation (Bengali/English)
81+
82+
### State Management Patterns
83+
- **Server State**: Drizzle ORM with PostgreSQL
84+
- **Client State**: Jotai for global state management
85+
- **Form State**: React Hook Form with Zod validation
86+
- **Environment**: Type-safe environment variables with @t3-oss/env-nextjs
87+
88+
## Required Environment Variables
89+
90+
Server-side:
91+
- `DATABASE_URL` - PostgreSQL connection string
92+
- `GITHUB_CLIENT_ID` - GitHub OAuth client ID
93+
- `GITHUB_CLIENT_SECRET` - GitHub OAuth client secret
94+
- `GITHUB_CALLBACK_URL` - OAuth callback URL
95+
- `CLOUDINARY_URL` - Cloudinary configuration
96+
- `MEILISEARCH_ADMIN_API_KEY` - MeilSearch admin API key
97+
98+
Client-side:
99+
- `NEXT_PUBLIC_MEILISEARCH_API_HOST` - MeilSearch API host URL
100+
- `NEXT_PUBLIC_MEILISEARCH_SEARCH_API_KEY` - MeilSearch search API key
101+
102+
## Key Features Implementation
103+
104+
### Authentication Flow
105+
- GitHub OAuth integration via `/api/auth/github`
106+
- User sessions managed in `userSessionsTable`
107+
- Social provider connections in `userSocialsTable`
108+
109+
### Content Creation
110+
- Rich markdown editor with drag-and-drop support
111+
- Image upload and optimization via Cloudinary
112+
- Article series management for content organization
113+
- Tag-based categorization system
114+
115+
### Search Implementation
116+
- MeilSearch for full-text search across articles
117+
- Search configuration and indexing handled in backend services
118+
- Client-side search interface with real-time results
119+
120+
### Community Features
121+
- Nested commenting system with resource association
122+
- Emoji-based reactions (LOVE, FIRE, WOW, etc.)
123+
- User following and bookmarking functionality
124+
- Social sharing and user profiles
125+
126+
## Development Workflow
127+
128+
1. Database changes require running `bun run db:generate` followed by `bun run db:push`
129+
2. Backend logic testing can be done via `bun run play` playground script
130+
3. Type safety is enforced through Zod schemas for all inputs
131+
4. UI components follow shadcn/ui patterns and conventions
132+
5. All forms use React Hook Form with Zod validation schemas
133+
6. When querying data in component always use Tanstack Query.
134+
7. When interacting with DB, create a action in `src/backend/services` and use sqlkit package (https://github.com/sqlkit-dev/sqlkit)
135+
8. For Database schema reference look here for drizzle schema `src/backend/persistence/schemas.ts`
136+
137+
## Special Considerations
138+
139+
- **Bengali Language Support**: Custom font loading (Kohinoor Bangla) and i18n
140+
- **SEO Optimization**: Dynamic sitemaps, Open Graph tags, and schema markup
141+
- **Performance**: Next.js Image optimization, bundle splitting, and caching
142+
- **Security**: Input validation via Zod, secure OAuth flow, environment variable validation

0 commit comments

Comments
 (0)