Skip to content

Commit c20e1f6

Browse files
Merge pull request #2 from gardnerjohnson-creator/devin/1756177143-add-react-frontend
Add React Frontend Application for RealWorld API
2 parents e300b6a + e16ea3f commit c20e1f6

31 files changed

Lines changed: 7313 additions & 0 deletions

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ nbbuild/
2424
dist/
2525
nbdist/
2626
.nb-gradle/
27+
28+
### Frontend ###
29+
frontend/node_modules/
30+
frontend/dist/
31+
frontend/.env.local
32+
frontend/.env.development.local
33+
frontend/.env.test.local
34+
frontend/.env.production.local

frontend/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# API Configuration
2+
VITE_API_BASE_URL=http://localhost:8080

frontend/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# API Configuration
2+
# Copy this file to .env and update the values as needed
3+
VITE_API_BASE_URL=http://localhost:8080

frontend/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# RealWorld Frontend
2+
3+
A modern React frontend application that consumes the Spring Boot RealWorld API.
4+
5+
## Features
6+
7+
- **User Authentication** - Registration, login, JWT token management
8+
- **Article Management** - Create, view, edit, delete articles with markdown support
9+
- **Article Feed** - Global feed displaying all articles with pagination
10+
- **User Profiles** - User information and article listings
11+
- **Comments System** - Add and view comments on articles
12+
- **Social Features** - Following users, favoriting articles
13+
- **Tag System** - Article categorization and filtering
14+
- **Responsive Design** - Modern UI built with Tailwind CSS
15+
16+
## Technology Stack
17+
18+
- **React 18** with TypeScript for type safety
19+
- **Vite** for fast development and building
20+
- **Tailwind CSS** for modern, responsive styling
21+
- **React Router** for navigation
22+
- **Axios** for API communication with JWT authentication
23+
24+
## Getting Started
25+
26+
### Prerequisites
27+
28+
- Node.js 16+ and npm
29+
- Spring Boot backend running on http://localhost:8080
30+
31+
### Installation
32+
33+
```bash
34+
cd frontend
35+
npm install
36+
```
37+
38+
### Development
39+
40+
```bash
41+
npm run dev
42+
```
43+
44+
The application will be available at http://localhost:3000
45+
46+
### Build for Production
47+
48+
```bash
49+
npm run build
50+
```
51+
52+
## API Integration
53+
54+
The frontend integrates with the Spring Boot RealWorld API running on localhost:8080:
55+
56+
- **Authentication**: POST /users/login, POST /users
57+
- **Articles**: GET/POST/PUT/DELETE /articles
58+
- **Profiles**: GET /profiles/{username}
59+
- **Comments**: GET/POST/DELETE /articles/{slug}/comments
60+
- **Tags**: GET /tags
61+
62+
All API calls include proper JWT authentication headers in the format: `Authorization: Token {jwt}`
63+
64+
## Project Structure
65+
66+
```
67+
frontend/
68+
├── src/
69+
│ ├── components/ # Reusable UI components
70+
│ ├── pages/ # Page components (Home, Login, Register, etc.)
71+
│ ├── services/ # API integration layer
72+
│ ├── hooks/ # Authentication context and hooks
73+
│ ├── types/ # TypeScript interfaces
74+
│ └── App.tsx # Main application component
75+
├── package.json # Dependencies and scripts
76+
├── vite.config.ts # Vite configuration
77+
├── tailwind.config.js # Tailwind CSS configuration
78+
└── tsconfig.json # TypeScript configuration
79+
```

frontend/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>RealWorld</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)