Skip to content

Commit 5915c6c

Browse files
authored
feat: support reactpress v2
feat: support reactpress v2
2 parents 3b1838f + a6147ae commit 5915c6c

Some content is hidden

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

73 files changed

+23844
-582
lines changed

README-zh_CN.md

Lines changed: 267 additions & 99 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 269 additions & 90 deletions
Large diffs are not rendered by default.

client/README.md

Lines changed: 341 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
# @fecommunity/reactpress-client
2+
3+
ReactPress Client - Next.js 14 frontend for ReactPress CMS with modern UI and responsive design.
4+
5+
[![NPM Version](https://img.shields.io/npm/v/@fecommunity/reactpress-client.svg)](https://www.npmjs.com/package/@fecommunity/reactpress-client)
6+
[![License](https://img.shields.io/npm/l/@fecommunity/reactpress-client.svg)](https://github.com/fecommunity/reactpress/blob/master/client/LICENSE)
7+
[![Node Version](https://img.shields.io/node/v/@fecommunity/reactpress-client.svg)](https://nodejs.org)
8+
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
9+
[![Next.js](https://img.shields.io/badge/Next.js-14-black)](https://nextjs.org/)
10+
11+
## Overview
12+
13+
ReactPress Client is a responsive frontend application built with Next.js 14 that serves as the user interface for the ReactPress CMS platform. It provides a clean design, intuitive navigation, and content management capabilities.
14+
15+
The client is designed with a component-based architecture that promotes reusability and maintainability. It integrates with the ReactPress backend through the [ReactPress Toolkit](../toolkit), providing type-safe API interactions.
16+
17+
## Quick Start
18+
19+
### Installation & Setup
20+
21+
```bash
22+
# Regular startup
23+
npx @fecommunity/reactpress-client
24+
25+
# PM2 startup for production
26+
npx @fecommunity/reactpress-client --pm2
27+
```
28+
29+
## Features
30+
31+
-**App Router Architecture** with Server Components for optimal SSR
32+
- 🎨 **Theme System** with light/dark mode switching
33+
- 🌍 **Internationalization** - Supports Chinese and English languages
34+
- 🌙 **Theme Switching** with system preference detection
35+
- ✍️ **Markdown Editor** with live preview
36+
- 📊 **Analytics Dashboard** with metrics and visualizations
37+
- 🔍 **Search** with filtering
38+
- 🖼️ **Media Management** with drag-and-drop upload
39+
- 📱 **PWA Support** with offline capabilities
40+
-**Accessibility Compliance** - WCAG 2.1 AA standards
41+
- 🚀 **Performance Optimized** - Code splitting, image optimization, and caching
42+
43+
## Requirements
44+
45+
- Node.js >= 18.20.4
46+
- npm or pnpm package manager
47+
- ReactPress Server running (for API connectivity)
48+
49+
## Usage Scenarios
50+
51+
### Standalone Client
52+
Perfect for:
53+
- Connecting to remote ReactPress API
54+
- Headless CMS implementation
55+
- Custom deployment scenarios
56+
- Microfrontend architecture
57+
58+
### Full ReactPress Stack
59+
Use with ReactPress server for complete CMS solution:
60+
```bash
61+
# Start server first
62+
npx @fecommunity/reactpress-server
63+
64+
# In another terminal, start client
65+
npx @fecommunity/reactpress-client
66+
```
67+
68+
## Core Components
69+
70+
ReactPress Client includes a comprehensive set of UI components:
71+
72+
- **Admin Dashboard** - Content management interface with role-based access
73+
- **Article Editor** - Advanced markdown editor with media embedding
74+
- **Comment System** - Moderation tools with spam detection
75+
- **Media Library** - File management
76+
- **User Management** - Account and profile settings with 2FA
77+
- **Analytics Views** - Data visualization components with export capabilities
78+
- **Theme Switcher** - Light/dark mode toggle with system preference detection
79+
- **Language Selector** - Internationalization controls with RTL support
80+
81+
## PM2 Support
82+
83+
ReactPress client supports PM2 process management for production deployments:
84+
85+
```bash
86+
# Start with PM2
87+
npx @fecommunity/reactpress-client --pm2
88+
```
89+
90+
PM2 features:
91+
- Automatic process restart on crash
92+
- Memory monitoring
93+
- Log management with rotation
94+
- Process management
95+
- Health checks
96+
97+
## Configuration
98+
99+
The client connects to the ReactPress server via environment variables:
100+
101+
```env
102+
# Server API URL
103+
SERVER_API_URL=https://api.yourdomain.com
104+
105+
# Client URL
106+
CLIENT_URL=https://yourdomain.com
107+
CLIENT_PORT=3001
108+
109+
# Analytics
110+
GOOGLE_ANALYTICS_ID=your_ga_id
111+
112+
# Security
113+
NEXT_PUBLIC_CRYPTO_KEY=your_encryption_key
114+
```
115+
116+
## Development
117+
118+
```bash
119+
# Clone repository
120+
git clone https://github.com/fecommunity/reactpress.git
121+
cd reactpress/client
122+
123+
# Install dependencies
124+
pnpm install
125+
126+
# Start development server with hot reload
127+
pnpm run dev
128+
129+
# Start with PM2 (development)
130+
pnpm run pm2
131+
132+
# Build for production
133+
pnpm run build
134+
135+
# Start production server
136+
pnpm run start
137+
```
138+
139+
## Project Structure
140+
141+
```
142+
client/
143+
├── app/ # Next.js 14 App Router
144+
│ ├── (admin)/ # Admin dashboard routes
145+
│ ├── (public)/ # Public facing routes
146+
│ └── api/ # API routes
147+
├── components/ # Reusable UI components
148+
├── lib/ # Business logic and utilities
149+
├── providers/ # React context providers
150+
├── hooks/ # Custom React hooks
151+
├── styles/ # Global styles and design tokens
152+
├── public/ # Static assets
153+
└── bin/ # CLI entry points
154+
```
155+
156+
## Environment Variables
157+
158+
| Variable | Description | Default |
159+
|----------|-------------|---------|
160+
| `SERVER_API_URL` | ReactPress server API URL | `http://localhost:3002` |
161+
| `CLIENT_URL` | Client site URL | `http://localhost:3001` |
162+
| `CLIENT_PORT` | Client port | `3001` |
163+
| `NEXT_PUBLIC_GA_ID` | Google Analytics ID | - |
164+
| `NEXT_PUBLIC_SITE_TITLE` | Site title | `ReactPress` |
165+
| `NEXT_PUBLIC_CRYPTO_KEY` | Encryption key for sensitive data | - |
166+
167+
## CLI Commands
168+
169+
```bash
170+
# Show help
171+
npx @fecommunity/reactpress-client --help
172+
173+
# Start client
174+
npx @fecommunity/reactpress-client
175+
176+
# Start with PM2
177+
npx @fecommunity/reactpress-client --pm2
178+
179+
# Specify port
180+
npx @fecommunity/reactpress-client --port 3001
181+
182+
# Enable verbose logging
183+
npx @fecommunity/reactpress-client --verbose
184+
```
185+
186+
## Integration with ReactPress Toolkit
187+
188+
The client seamlessly integrates with the ReactPress Toolkit for API interactions:
189+
190+
```typescript
191+
import { api, types } from '@fecommunity/reactpress-toolkit';
192+
193+
// Fetch articles with proper typing
194+
const articles: types.IArticle[] = await api.article.findAll();
195+
196+
// Create new article
197+
const newArticle = await api.article.create({
198+
title: 'My New Article',
199+
content: 'Article content here...',
200+
// ... other properties
201+
});
202+
```
203+
204+
The toolkit provides:
205+
- Strongly-typed API clients for all modules
206+
- TypeScript definitions for all data models
207+
- Utility functions for common operations
208+
- Built-in authentication and error handling
209+
- Automatic retry mechanisms for failed requests
210+
211+
## Theme Customization
212+
213+
ReactPress Client supports advanced theme customization:
214+
215+
### Design Token System
216+
```typescript
217+
// Custom theme tokens
218+
const customTokens = {
219+
colors: {
220+
primary: '#0070f3',
221+
secondary: '#7928ca',
222+
background: '#ffffff',
223+
text: '#000000'
224+
},
225+
typography: {
226+
fontFamily: 'Inter, sans-serif',
227+
fontSize: {
228+
small: '12px',
229+
medium: '16px',
230+
large: '20px'
231+
}
232+
}
233+
};
234+
```
235+
236+
### Component-Level Customization
237+
```typescript
238+
// Extend existing components
239+
import { Button } from '@fecommunity/reactpress-components';
240+
241+
const CustomButton = styled(Button)`
242+
background-color: ${props => props.theme.colors.primary};
243+
border-radius: 8px;
244+
padding: 12px 24px;
245+
`;
246+
```
247+
248+
## Performance Optimization
249+
250+
- **App Router Architecture** - Server Components for optimal SSR
251+
- **Automatic Code Splitting** - Route-based code splitting
252+
- **Image Optimization** - Next.js built-in image optimization with automatic format selection
253+
- **Lazy Loading** - Component and route lazy loading
254+
- **Caching Strategies** - HTTP caching and in-memory caching
255+
- **Bundle Analysis** - Built-in bundle analysis tools
256+
257+
## PWA Support
258+
259+
ReactPress Client is a Progressive Web App with:
260+
- Offline support with service workers
261+
- Installable on devices with native app experience
262+
- Push notifications (coming soon)
263+
- App-like experience with splash screens
264+
265+
## Testing
266+
267+
```bash
268+
# Run unit tests with Vitest
269+
pnpm run test
270+
271+
# Run integration tests with Playwright
272+
pnpm run test:e2e
273+
274+
# Run linting
275+
pnpm run lint
276+
277+
# Run formatting
278+
pnpm run format
279+
280+
# Run type checking
281+
pnpm run type-check
282+
283+
# Run bundle analysis
284+
pnpm run analyze
285+
```
286+
287+
## Templates
288+
289+
ReactPress Client can be used with various professional templates:
290+
291+
### Hello World Template
292+
```bash
293+
npx @fecommunity/reactpress-template-hello-world my-blog
294+
```
295+
296+
### Twenty Twenty Five Template
297+
```bash
298+
npx @fecommunity/reactpress-template-twentytwentyfive my-blog
299+
```
300+
301+
### Custom Templates
302+
Create your own templates by extending the client with custom components and pages.
303+
304+
## Deployment
305+
306+
### Vercel Deployment (Recommended)
307+
308+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/fecommunity/reactpress)
309+
310+
### Custom Deployment
311+
312+
```bash
313+
# Build for production
314+
pnpm run build
315+
316+
# Start production server
317+
pnpm run start
318+
```
319+
320+
## Support
321+
322+
- 📖 [Documentation](https://github.com/fecommunity/reactpress)
323+
- 🐛 [Issues](https://github.com/fecommunity/reactpress/issues)
324+
- 💬 [Discussions](https://github.com/fecommunity/reactpress/discussions)
325+
- 📧 [Support](mailto:[email protected])
326+
327+
## Contributing
328+
329+
1. Fork the repository
330+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
331+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
332+
4. Push to the branch (`git push origin feature/AmazingFeature`)
333+
5. Open a pull request
334+
335+
## License
336+
337+
MIT License - see [LICENSE](LICENSE) file for details.
338+
339+
---
340+
341+
Built with ❤️ by [FECommunity](https://github.com/fecommunity)

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fecommunity/reactpress-client",
3-
"version": "1.0.0-beta.22",
3+
"version": "1.0.0",
44
"bin": {
55
"reactpress-client": "./bin/reactpress-client.js"
66
},
@@ -85,4 +85,4 @@
8585
"tsconfig-paths-webpack-plugin": "^3.5.2",
8686
"typescript": "4.6.2"
8787
}
88-
}
88+
}

client/public/sitemap.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
3-
<url><loc>http://localhost:3001</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-20T12:37:06.121Z</lastmod></url>
4-
<url><loc>http://localhost:3001/archives</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-20T12:37:06.121Z</lastmod></url>
5-
<url><loc>http://localhost:3001/knowledge</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-20T12:37:06.121Z</lastmod></url>
6-
<url><loc>http://localhost:3001/login</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-20T12:37:06.121Z</lastmod></url>
7-
<url><loc>http://localhost:3001/nav</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-20T12:37:06.121Z</lastmod></url>
8-
<url><loc>http://localhost:3001/rss</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-20T12:37:06.121Z</lastmod></url>
3+
<url><loc>http://localhost:3001</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-21T15:49:52.619Z</lastmod></url>
4+
<url><loc>http://localhost:3001/archives</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-21T15:49:52.619Z</lastmod></url>
5+
<url><loc>http://localhost:3001/knowledge</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-21T15:49:52.619Z</lastmod></url>
6+
<url><loc>http://localhost:3001/login</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-21T15:49:52.619Z</lastmod></url>
7+
<url><loc>http://localhost:3001/nav</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-21T15:49:52.619Z</lastmod></url>
8+
<url><loc>http://localhost:3001/rss</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2025-09-21T15:49:52.619Z</lastmod></url>
99
</urlset>

0 commit comments

Comments
 (0)