A comprehensive React application demonstrating modern web development practices with CRUD operations, authentication, and responsive design. This project serves as a learning resource for building full-featured React applications with TypeScript, Tailwind CSS, and REST API integration.
This is a full-featured React web application that demonstrates real-world development patterns and best practices. The project implements a complete CRUD (Create, Read, Update, Delete) system for managing posts, with user authentication, protected routes, and a modern responsive UI.
- React Fundamentals: Component composition, hooks, state management, and context API
- TypeScript Integration: Type-safe development with interfaces, types, and proper error handling
- Authentication Flow: JWT-like token management with localStorage persistence
- Protected Routes: Route guards and conditional navigation using React Router
- API Integration: RESTful API consumption with JSONPlaceholder fake backend
- Form Handling: Client-side validation, error handling, and user feedback
- Modern UI: Responsive design with Tailwind CSS and mobile-first approach
- State Management: Context API for global state and local component state
- Code Architecture: Clean folder structure and separation of concerns
- User authentication system (sign-in/sign-up)
- Protected dashboard with CRUD operations
- Posts management (create, read, update, delete)
- Responsive navigation with mobile menu
- Form validation and error handling
- Toast notifications for user feedback
- Modern UI with animations and transitions
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 24.x |
Runtime environment |
| React | 19.1.1 |
Frontend framework |
| React Router | 7.9.5 |
Client-side routing |
| TypeScript | 5.9.3 |
Type-safe JavaScript |
| Tailwind CSS | 4.1.16 |
Utility-first CSS framework |
| Vite | 7.1.7 |
Build tool and dev server |
| ESLint | 9.36.0 |
Code linting and formatting |
- @types/node:
24.6.0- Node.js type definitions - @types/react:
19.1.16- React type definitions - @vitejs/plugin-react:
5.0.4- Vite React plugin - autoprefixer:
10.4.21- CSS vendor prefixing
Ensure you have the following installed on your system:
- Node.js version 24.x or higher
- npm or yarn package manager
- Git for version control
git clone <your-repository-url>
cd react-crud-demo-projectUsing nvm (Node Version Manager):
# Install Node.js 24
nvm install 24
nvm use 24
# Verify installation
node --version # Should show v24.x.x
npm --version # Should show compatible npm versionUsing volta (Alternative):
# Install and pin Node.js 24
volta install node@24
volta pin node@24# Using npm
npm install
# Or using yarn
yarn installCreate a .env.local file if you need environment variables:
# Copy example environment file
cp .env.example .env.local
# Edit with your preferred settings
VITE_API_BASE_URL=https://jsonplaceholder.typicode.com# Start the development server
npm run dev
# Or using yarn
yarn devThe application will be available at http://localhost:5173 (or the port shown in your terminal).
# Create production build
npm run build
# Preview production build locally
npm run previewreact-crud-demo-project/
βββ public/ # Static assets
β βββ vite.svg # Vite logo
βββ src/ # Source code directory
β βββ assets/ # Static assets (images, icons)
β β βββ react.svg # React logo
β βββ components/ # Reusable UI components
β β βββ AddEditPost.tsx # Post form component
β β βββ footer.tsx # Footer component
β β βββ header.tsx # Navigation header
β βββ config/ # Configuration files
β β βββ api.ts # API configuration and endpoints
β βββ contexts/ # React Context providers
β β βββ AuthContext.tsx # Authentication context
β βββ hooks/ # Custom React hooks
β β βββ useToast.tsx # Toast notification hook
β βββ layouts/ # Layout components
β β βββ DefaultLayout.tsx # Main layout wrapper
β βββ pages/ # Page components
β β βββ admin/ # Protected admin pages
β β β βββ dashboard.tsx # Dashboard with CRUD operations
β β βββ about.tsx # About page
β β βββ Home.tsx # Home page
β β βββ PageNotFound.tsx # 404 error page
β β βββ sign-in.tsx # Sign-in page
β β βββ sign-up.tsx # Sign-up page
β βββ types/ # TypeScript type definitions
β β βββ types.ts # Shared interfaces and types
β βββ utils/ # Utility functions
β β βββ validation.ts # Form validation helpers
β βββ App.css # Global styles
β βββ App.tsx # Main App component
β βββ index.css # Tailwind CSS imports
β βββ main.tsx # Application entry point
β βββ router.tsx # React Router configuration
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore rules
βββ eslint.config.js # ESLint configuration
βββ index.html # HTML template
βββ package.json # Project dependencies
βββ postcss.config.cjs # PostCSS configuration
βββ README.md # Project documentation
βββ tailwind.config.cjs # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ tsconfig.app.json # App-specific TypeScript config
βββ tsconfig.node.json # Node-specific TypeScript config
βββ vite.config.ts # Vite configuration
components/: Pure, reusable UI componentspages/: Route-specific components with business logiclayouts/: Wrapper components for consistent page structure
config/: Centralized API and app configurationcontexts/: Global state management with React Contexthooks/: Custom hooks for reusable logic
types/: Centralized TypeScript interfaces and typesutils/: Helper functions and validation logic
- Tailwind CSS: Utility-first approach for rapid development
- Component-level: Scoped styles when needed
- Responsive Design: Mobile-first responsive utilities
- Sign In: Email/password authentication with form validation
- Sign Up: User registration with comprehensive validation
- Token Management: JWT-like token stored in localStorage
- Auto-redirect: Automatic navigation based on auth state
- Session Persistence: Maintains login across browser sessions
- Route Guards: Automatic redirection for unauthenticated users
- Conditional Navigation: Different menu options for authenticated/guest users
- Dashboard Access: Protected admin area with full CRUD functionality
- Posts Management: Full CRUD operations for blog posts
- Create: Add new posts with title and content validation
- Read: Display posts in a clean, organized layout
- Update: Edit existing posts with pre-populated forms
- Delete: Remove posts with confirmation prompts
- Real-time Updates: Optimistic UI updates for immediate feedback
- Form Validation: Client-side validation with error messages
- Mobile-First Design: Optimized for all device sizes
- Navigation Menu: Collapsible mobile menu with smooth animations
- Header Management: Auto-hiding header on scroll (mobile)
- Toast Notifications: Success and error feedback system
- Loading States: Visual feedback during API operations
- Tailwind CSS: Utility-first styling with custom components
- Smooth Animations: CSS transitions and hover effects
- Form Handling: Advanced form state management
- Error Boundaries: Graceful error handling and user feedback
- 404 Handling: Custom error pages with navigation options
- TypeScript: Full type safety with interfaces and type checking
- ESLint: Code quality and consistency enforcement
- Hot Reload: Instant development feedback with Vite
- Path Aliases: Clean imports with
@/syntax - Build Optimization: Production-ready builds with code splitting
- JSONPlaceholder: Fake REST API for learning and development
- HTTP Methods: GET, POST, PUT, DELETE operations
- Error Handling: Comprehensive API error management
- Loading States: User feedback during network operations
- Title Validation: Required, letters and spaces only
- Content Validation: Required, alphanumeric and spaces
- Email Validation: Proper email format checking
- Real-time Feedback: Instant validation as user types
By exploring this project, you will understand:
- Modern React Patterns: Hooks, Context API, and functional components
- TypeScript Integration: Type-safe development practices
- Authentication Flow: Token-based auth with route protection
- API Integration: RESTful API consumption and error handling
- Form Management: Validation, state management, and user feedback
- Responsive Design: Mobile-first CSS with Tailwind
- Project Architecture: Clean folder structure and separation of concerns
- Build Tools: Modern development setup with Vite
- Follow the installation steps above
- Start the development server with
npm run dev - Open
http://localhost:5173in your browser - Explore the sign-in/sign-up functionality
- Access the dashboard to try CRUD operations
- Check the Network tab in DevTools to see API calls
This project uses JSONPlaceholder (https://jsonplaceholder.typicode.com) as a fake REST API:
- Base URL:
https://jsonplaceholder.typicode.com - Endpoints:
/posts,/users - Note: Changes are not persisted on the server (fake backend)
Feel free to fork this project and submit pull requests. This is a learning project, so contributions that enhance the educational value are especially welcome!
This project is open source and available under the MIT License.