Ứng dụng blog cá nhân song ngữ Việt-Anh được xây dựng với React, Ant Design và JSON Server.
A bilingual Vietnamese-English personal blog application built with React, Ant Design, and JSON Server.
- 📝 CRUD Operations: Tạo, đọc, cập nhật, xóa bài viết | Create, read, update, delete posts
- 🌏 Bilingual Content: Nội dung song ngữ Việt-Anh | Vietnamese-English bilingual content
- 🔍 Search & Pagination: Tìm kiếm và phân trang | Search and pagination functionality
- 💬 Comments System: Hệ thống bình luận | Comments system
- 📱 Responsive Design: Thiết kế responsive | Mobile-friendly responsive design
- ✨ Modern UI: Giao diện hiện đại với Ant Design | Modern UI with Ant Design
- 📄 Markdown Support: Hỗ trợ viết và hiển thị Markdown | Markdown writing and rendering support
- 🗄️ JSON Server: Lưu trữ dữ liệu với JSON Server | Data persistence with JSON Server
- Frontend: React 19, Redux Toolkit
- UI Library: Ant Design
- Backend: JSON Server (Mock API)
- Styling: CSS3, Ant Design
- Markdown: React Markdown
- Date Handling: date-fns
- ID Generation: UUID
git clone <repository-url>
cd blognpm installnpm run devJSON Server (Port 3001):
npm run json-serverReact App (Port 3000):
npm startJSON Server sẽ chạy trên http://localhost:3001 với các endpoints:
JSON Server runs on http://localhost:3001 with endpoints:
- Posts:
GET, POST, PUT, DELETE /posts - Comments:
GET, POST, DELETE /comments
GET http://localhost:3001/posts
POST http://localhost:3001/posts
Content-Type: application/json
{
"id": "unique-id",
"title": "Tiêu đề bài viết",
"content": "# Nội dung markdown...",
"userId": 1,
"createdAt": "2024-07-28T00:00:00.000Z",
"updatedAt": "2024-07-28T00:00:00.000Z"
}
GET http://localhost:3001/comments?postId=sample-1
src/
├── components/ # Các component tái sử dụng
│ ├── Header.js # Header navigation
│ ├── PostCard.js # Card hiển thị bài viết
│ ├── PostEditor.js # Form tạo/sửa bài viết
│ ├── CommentCard.js # Card hiển thị bình luận
│ └── CommentForm.js # Form thêm bình luận
├── pages/ # Các trang chính
│ ├── HomePage.js # Trang chủ - danh sách bài viết
│ ├── CreatePostPage.js # Trang tạo bài viết
│ ├── EditPostPage.js # Trang sửa bài viết
│ └── PostDetailPage.js # Trang chi tiết bài viết
├── store/ # Redux store
│ ├── index.js # Cấu hình store
│ ├── postsSlice.js # Slice quản lý bài viết
│ └── commentsSlice.js # Slice quản lý bình luận
├── utils/ # Tiện ích
│ ├── helpers.js # Các hàm helper
│ └── sampleData.js # Dữ liệu mẫu
└── App.js # Component chính
- Node.js >= 14
- npm hoặc yarn
- Clone repository:
git clone <repository-url>
cd blog- Cài đặt dependencies:
npm install- Chạy ứng dụng:
npm start- Mở trình duyệt và truy cập:
http://localhost:3000
- Click vào nút "Viết bài mới" trên header
- Nhập tiêu đề và nội dung (hỗ trợ Markdown)
- Sử dụng nút "Xem trước" để preview nội dung
- Click "Tạo bài viết" để lưu
- Trên trang chủ hoặc trang chi tiết, click nút "Sửa"
- Cập nhật thông tin
- Click "Cập nhật" để lưu thay đổi
- Sử dụng thanh tìm kiếm trên trang chủ
- Nhập từ khóa và nhấn Enter
- Kết quả sẽ được lọc theo thời gian thực
- Vào trang chi tiết bài viết
- Cuộn xuống phần bình luận
- Điền thông tin và nội dung bình luận
- Click "Gửi bình luận"
Ứng dụng hỗ trợ đầy đủ cú pháp Markdown:
- Tiêu đề:
# H1,## H2,### H3 - Định dạng:
**bold**,*italic*,~~strikethrough~~ - Danh sách:
- itemhoặc1. item - Liên kết:
[text](url) - Hình ảnh:
 - Code:
\inline`hoặccode block` - Trích dẫn:
> quote - Bảng: Hỗ trợ bảng Markdown
- Tạo component mới trong
src/components/ - Thêm route mới trong
App.js - Cập nhật Redux slice nếu cần
- Cập nhật các async thunk trong
postsSlice.jsvàcommentsSlice.js - Thay đổi URL API endpoint
- Cập nhật theme Ant Design trong
App.js - Thêm CSS custom trong
App.css
npm start: Chạy ứng dụng ở chế độ developmentnpm run build: Build ứng dụng cho productionnpm test: Chạy testsnpm run eject: Eject create-react-app config
npm run build- Build project
- Upload thư mục
build/lên hosting - Cấu hình routing cho SPA
- Authentication & Authorization
- Categories/Tags cho bài viết
- Upload hình ảnh
- Rich text editor (WYSIWYG)
- Social sharing
- SEO optimization
- Offline support (PWA)
- Admin dashboard
- Email notifications
- Like/Unlike posts
- Fork repository
- Tạo branch mới:
git checkout -b feature/new-feature - Commit changes:
git commit -am 'Add new feature' - Push branch:
git push origin feature/new-feature - Tạo Pull Request
MIT License - xem file LICENSE để biết thêm chi tiết.
- Tên tác giả - Initial work
- Ant Design - UI Component Library
- JSONPlaceholder - Fake REST API
- React Markdown - Markdown Renderer
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify