A modern React-based blog platform integrated with Bettermode's GraphQL API. The application features infinite scrolling, real-time reactions, and rich content management.
- Project Overview
- Getting Started
- Architecture
- API Documentation
- Performance Optimizations
- Testing Guide
- Security
- Best Practices
- Frontend Framework: React 18.3.1 + TypeScript 5.6.2
- Build Tool: Vite 5.4.10
- Data Management: Apollo Client 3.11.10
- Styling: TailwindCSS 3.4.14 + Framer Motion 11.11.17
- Routing: React Router DOM 6.28.0
- UI Components: DaisyUI 4.12.14
- API: Bettermode GraphQL API
- Node.js >= 18
- npm or yarn
- Bettermode API access token
-
Create a
.env
file in the root directory:VITE_BETTERMODE_TOKEN=your_api_token_here
-
Install dependencies:
npm install
-
Start development server:
npm run dev
# Production build
npm run build
# Preview build
npm run preview
# Run tests
npm run test
src/
├── components/ # React components
│ ├── blog/ # Blog-specific components
│ └── ui/ # Reusable UI components
├── graphql/ # GraphQL configuration
│ ├── client.ts # Apollo client setup
│ ├── mutations/ # GraphQL mutations
│ └── queries/ # GraphQL queries
├── hooks/ # Custom React hooks
├── pages/ # Route components
├── types/ # TypeScript definitions
└── lib/ # Utility functions
- Production (US):
https://api.bettermode.com/graphql
- Production (EU):
https://api.bettermode.de/graphql
-
Post Management
- Create, read, update posts
- Rich text content support
- Media attachments
- Categories and tags
-
Interaction Features
- Like/React to posts
- Commenting system
- Share functionality
-
User Management
- Authentication
- User profiles
- Role-based permissions
-
Apollo Cache Management
- Field-level cache policies
- Optimistic updates
- Pagination handling
-
Image Optimization
- Lazy loading
- Responsive images
- Multiple size variants
-
Code Splitting
- Route-based splitting
- Component lazy loading
- Dynamic imports
# Run all tests
npm run test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverage
- Unit Tests: Components, hooks, utilities
- Integration Tests: API interactions
- E2E Tests: User flows
- Secure token management
- XSS prevention
- Type-safe implementations
- CORS configuration
- Functional components
- Custom hooks for logic reuse
- Proper error handling
- Performance optimizations
MIT License - see LICENSE file for details