A full-stack blog application allowing users to create, view, and manage blog posts with authentication.
- User authentication using email and password
- Create, read, update, and delete blog posts
- Public blog listing with pagination
- Responsive design for desktop and mobile devices
- Role-based access control (only authors can edit/delete their own blogs)
This project consists of two main folders:
client/: Frontend React applicationserver/: Backend Express.js API with TypeScript and MongoDB
Before you begin, ensure you have the following installed:
git clone <repository-url>
cd blog-applicationCreate a .env file in the server/ directory with the following variables:
NODE_ENV=development
PORT=5001
MONGO_URI=your_mongo_db_url
JWT_SECRET=your_jwt_secret_key_here
Note: Replace your_jwt_secret_key_here with a strong secret key and update the MONGO_URI if you're using MongoDB Atlas.
You need to install dependencies for both the client and server:
# Install server dependencies
cd server
npm install
# Install client dependencies
cd ../client
npm installYou need to run both the server and client in separate terminal windows:
cd server
npm run devThe server will start on port 5000 (or the port specified in your .env file).
cd client
npm run devThe client development server will start and display a URL (typically http://localhost:3000 or http://localhost:5173) which you can click to open in your browser.
- Register:
POST /api/v1/auth/register - Login:
POST /api/v1/auth/login - Profile:
GET /api/v1/auth/profile
- Get all blogs:
GET /api/v1/blogs?page=1&limit=10 - Get blog by ID:
GET /api/v1/blogs/:id - Create blog:
POST /api/v1/blogs - Update blog:
PUT /api/v1/blogs/:id - Delete blog:
DELETE /api/v1/blogs/:id
- Register a new account or log in with existing credentials.
- Create new blog posts from your dashboard.
- View all blogs on the home page.
- View, edit, or delete your own blogs from the blog detail page.
- React.js
- React Router
- Context API for state management
- CSS/SCSS for styling
- Node.js
- Express.js
- TypeScript
- MongoDB with Mongoose
- JWT for authentication
