Skip to content

Latest commit

Β 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Blog Application - Full Stack Assessment

A full-stack blog application built with React and Spring Boot, featuring user authentication, blog management, and responsive design.

Blog Application Screenshot

πŸš€ Features

  • User Authentication: Secure JWT-based login and registration
  • Blog Management: Create, read, update, and delete blog posts
  • Public Access: Anyone can view blogs, only authenticated users can create/edit
  • Responsive Design: Works seamlessly on desktop and mobile devices
  • Pagination: Efficient blog listing with pagination support
  • Author Controls: Blog authors can edit and delete their own posts

πŸ›  Technology Stack

Frontend

  • React 18 - Modern UI framework
  • React Router - Client-side routing
  • Tailwind CSS - Utility-first CSS framework
  • Axios - HTTP client for API requests

Backend

  • Spring Boot 3.5.5 - Java web framework
  • Spring Security - Authentication and authorization
  • Spring Data JPA - Database abstraction layer
  • PostgreSQL - Relational database
  • JWT - Stateless authentication tokens

πŸ“‹ Prerequisites

  • Java 21 or higher
  • Node.js 18 or higher
  • PostgreSQL 12 or higher
  • Maven 3.6 or higher

πŸƒβ€β™‚οΈ Quick Start

1. Clone the Repository

git clone <repository-url>
cd BlogApp

2. Database Setup

-- Create database
CREATE DATABASE blogapp;

-- Create user (optional)
CREATE USER blogapp_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE blogapp TO blogapp_user;

3. Backend Setup

cd blogapp

# Update application.properties with your database credentials
# src/main/resources/application.properties

# Run the Spring Boot application
mvn spring-boot:run

The backend will start on http://localhost:8082

4. Frontend Setup

cd blogfront/blogfront

# Install dependencies
npm install

# Start the development server
npm run dev

The frontend will start on http://localhost:5173

πŸ“ Project Structure

BlogApp/
β”œβ”€β”€ blogapp/                 # Spring Boot backend
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   └── com/blogapp/blogapp/
β”‚   β”‚       β”œβ”€β”€ controller/  # REST controllers
β”‚   β”‚       β”œβ”€β”€ service/     # Business logic
β”‚   β”‚       β”œβ”€β”€ entity/      # JPA entities
β”‚   β”‚       β”œβ”€β”€ dto/         # Data transfer objects
β”‚   β”‚       β”œβ”€β”€ config/      # Configuration classes
β”‚   β”‚       └── security/    # Security components
β”‚   └── src/main/resources/
β”‚       β”œβ”€β”€ application.properties
β”‚       └── schema.sql
β”œβ”€β”€ blogfront/blogfront/     # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ contexts/       # React contexts
β”‚   β”‚   └── services/       # API services
β”‚   └── public/
└── README.md

πŸ”— API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout

Blogs

  • GET /api/blogs - Get all blogs (public, paginated)
  • GET /api/blogs/{id} - Get blog by ID (public)
  • POST /api/blogs - Create new blog (authenticated)
  • PUT /api/blogs/{id} - Update blog (author only)
  • DELETE /api/blogs/{id} - Delete blog (author only)

🎨 Pages

  1. Home Page (/) - Public blog listing with pagination
  2. Login Page (/login) - User authentication
  3. Register Page (/register) - User registration
  4. Create Blog (/create) - Blog creation (protected)
  5. Blog Detail (/blog/:id) - Individual blog view (public)
  6. Edit Blog (/edit/:id) - Blog editing (author only)

πŸ” Security Features

  • JWT-based stateless authentication
  • Password encryption using BCrypt
  • Route protection for authenticated users
  • Author-only access for blog editing/deletion
  • CORS configuration for cross-origin requests

πŸ“± Responsive Design

The application is fully responsive and optimized for:

  • Desktop (1024px+)
  • Tablet (768px - 1023px)
  • Mobile (320px - 767px)

πŸš€ Deployment

Backend Deployment

# Build the JAR file
mvn clean package

# Run the JAR
java -jar target/blogapp-0.0.1-SNAPSHOT.jar

Frontend Deployment

# Build for production
npm run build

# The dist/ folder contains the production build

πŸ§ͺ Testing

Backend Tests

cd blogapp
mvn test

Frontend Tests

cd blogfront/blogfront
npm test

🌐 Live Demo

Frontend URL: https://blog-app-kappa-two-40.vercel.app/

πŸ“Έ Screenshots

Home Page

Home Page

Create Blog Page

Create Blog

πŸ‘₯ Usage

  1. Register a new account or login with existing credentials
  2. Browse blogs on the home page (no authentication required)
  3. Create new blogs after logging in
  4. Edit or delete your own blog posts
  5. View detailed blog posts by clicking on titles

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Releases

Packages

Contributors

Languages