A modern blog application built with React, TypeScript, and TanStack Query featuring a clean UI with Tailwind CSS and shadcn/ui components.
- View All Blogs - Browse through all blog posts with a responsive card layout
- Blog Details - View detailed blog content with cover images
- Create New Blog - Add new blog posts with a user-friendly form
- Real-time Updates - Automatic query invalidation and cache management
- Loading States - Smooth skeleton loaders for better UX
- Error Handling - Graceful error states and user feedback
- Responsive Design - Mobile-first responsive layout
- React 19 - UI library
- TypeScript - Type-safe development
- Vite - Fast build tool and dev server
- TanStack Query v5 - Server state management and data fetching
- Tailwind CSS v4 - Utility-first CSS framework
- shadcn/ui - Beautiful and accessible component library
- JSON Server - Mock REST API backend
- Lucide React - Icon library
- Node.js (v18 or higher)
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd Frontend-Interview
-
Install dependencies
npm install
You need to run both the backend (JSON Server) and frontend development server:
-
Start the JSON Server (Terminal 1)
npm run server
The API will be available at
http://localhost:3001 -
Start the Development Server (Terminal 2)
npm run dev
The application will be available at
http://localhost:5173
src/
├── components/
│ ├── BlogList.tsx # Blog list view component
│ ├── BlogDetail.tsx # Individual blog detail view
│ ├── CreateBlogForm.tsx # Form for creating new blogs
│ └── ui/ # shadcn/ui components
│ ├── badge.tsx
│ ├── button.tsx
│ ├── card.tsx
│ ├── input.tsx
│ ├── skeleton.tsx
│ └── textarea.tsx
├── lib/
│ ├── api.ts # API service layer
│ └── utils.ts # Utility functions
├── types/
│ └── blog.ts # TypeScript type definitions
├── App.tsx # Main application component
└── main.tsx # Application entry point
The JSON Server provides the following REST endpoints:
| Method | Endpoint | Description |
|---|---|---|
| GET | /blogs |
Get all blogs |
| GET | /blogs/:id |
Get a specific blog |
| POST | /blogs |
Create a new blog |
| PUT | /blogs/:id |
Update an existing blog |
| DELETE | /blogs/:id |
Delete a blog |
interface Blog {
id: number;
title: string;
category: string[];
description: string;
date: string;
coverImage: string;
content: string;
}npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLintnpm run server- Start JSON Server on port 3001
- Uses TanStack Query for efficient server state management
- Automatic background refetching and cache invalidation
- Optimistic updates for better UX
- Tailwind CSS for utility-first styling
- shadcn/ui components for consistent design system
- Fully responsive layout with mobile-first approach
- Full TypeScript coverage
- Strongly typed API responses
- Type-safe component props
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
Built with ❤️ using modern React best practices