A modern blog platform with interactive maps, user authentication, and content management features.
- Create, read, update, and delete blog posts
- Rich text content support
- Interactive map integration
- Category-based organization
- SEO-friendly URLs with slugs
- View count tracking
- Publication date management
- Google OAuth authentication
- User roles (admin, user)
- Profile management
- Username customization
- Display name updates
- Last login tracking
- Secure JWT-based authentication
- Nested comments (up to 3 levels deep)
- Like/Dislike functionality
- Image upload support
- Comment reactions tracking
- Moderation capabilities
- Real-time updates
- Interactive map embedding in posts
- Custom map center coordinates
- Zoom level control
- Location-based features
- Map data persistence
- Post management dashboard
- User role management
- Content moderation
- Analytics tracking
- System configuration
- React.js
- Tailwind CSS
- React Router
- Context API for state management
- Custom hooks for authentication
- Responsive design
- Node.js with Express
- PostgreSQL database
- JWT authentication
- Google OAuth integration
- File upload handling
- Rate limiting
- CORS configuration
- Helmet.js for security headers
- Rate limiting for API protection
- CORS policy implementation
- Secure session management
- Password hashing
- Input validation
- XSS protection
- Node.js (v14 or higher)
- PostgreSQL (v12 or higher)
- Google OAuth credentials
Create a .env file in the backend directory with:
DB_HOST=your_db_host
DB_PORT=your_db_port
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name
JWT_SECRET=your_jwt_secret
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=your_google_callback_url
FRONTEND_URL=your_frontend_url- Clone the repository:
git clone https://github.com/yourusername/pattinam.git
cd pattinam- Install backend dependencies:
cd backend
npm install- Install frontend dependencies:
cd ../frontend
npm install- Start the development servers:
Backend:
cd backend
npm run devFrontend:
cd frontend
npm run devCREATE TABLE users (
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
username TEXT UNIQUE NOT NULL,
email TEXT UNIQUE NOT NULL,
display_name TEXT,
role TEXT DEFAULT 'user',
password_hash TEXT,
auth_provider TEXT,
last_login TIMESTAMP WITH TIME ZONE
);CREATE TABLE post (
postid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
title TEXT NOT NULL,
content TEXT NOT NULL,
author TEXT NOT NULL,
category TEXT NOT NULL,
publicationdate DATE NOT NULL,
tags TEXT[],
slug TEXT UNIQUE NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
hasmap BOOLEAN DEFAULT false,
visit_count INTEGER DEFAULT 0,
mapcenter TEXT,
zoom INTEGER
);CREATE TABLE comment (
comment_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
post_id UUID NOT NULL,
user_id UUID NOT NULL,
content TEXT NOT NULL,
parent_comment_id UUID,
image_url TEXT,
likes INTEGER DEFAULT 0,
dislikes INTEGER DEFAULT 0,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
is_approved BOOLEAN DEFAULT false,
FOREIGN KEY (post_id) REFERENCES post(postid) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE,
FOREIGN KEY (parent_comment_id) REFERENCES comment(comment_id) ON DELETE CASCADE
);POST /api/auth/google- Google OAuth loginGET /api/auth/google/callback- Google OAuth callbackGET /api/auth/me- Get current user infoPOST /api/auth/logout- Logout user
GET /api/bloglist- Get paginated postsGET /api/blog/:slug- Get single postPOST /api/posts- Create new postDELETE /api/posts/:postId- Delete postPOST /api/posts/:postId/view- Increment view count
GET /api/comments/:postId- Get post commentsPOST /api/comments- Create commentDELETE /api/comments/:commentId- Delete commentPOST /api/comments/:commentId/like- Like commentPOST /api/comments/:commentId/dislike- Dislike comment
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or support, please contact:
- Email: [email protected]
- Twitter: @karthi9003