A professional, modern, and SEO-optimized website for Vanguard Machinery Trading Company, built with Node.js, Express, MySQL, and React.
- Modern React 18 with functional components and hooks
- Responsive Design using Tailwind CSS
- Smooth Animations with Framer Motion
- SEO Optimized with meta tags and structured data
- Mobile First approach for all devices
- Fast Loading with optimized images and lazy loading
- Node.js & Express.js server
- MySQL Database with Sequelize ORM
- JWT Authentication with role-based access control
- RESTful API design
- File Upload support with image processing
- Email Notifications for contact forms
- Rate Limiting and security middleware
- Product Management - Add, edit, delete products with categories
- News Management - Publish company news and industry updates
- Contact Management - Handle customer inquiries and responses
- User Management - Admin and editor roles with permissions
- Media Library - Upload and manage images
- Meta Tags for all pages
- Structured Data (JSON-LD)
- Sitemap Generation
- SEO-friendly URLs with slugs
- Image Optimization and alt tags
- Performance Optimization
newhtmlg/
├── client/ # React frontend
│ ├── public/ # Static files
│ ├── src/ # Source code
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Page components
│ │ ├── contexts/ # React contexts
│ │ ├── services/ # API services
│ │ └── utils/ # Utility functions
│ ├── package.json # Frontend dependencies
│ └── tailwind.config.js # Tailwind CSS configuration
├── models/ # Database models
├── routes/ # API routes
├── middleware/ # Custom middleware
├── config/ # Configuration files
├── scripts/ # Database setup scripts
├── uploads/ # File uploads directory
├── server.js # Main server file
├── package.json # Backend dependencies
└── README.md # This file
Before running this application, make sure you have the following installed:
- Node.js (v16 or higher)
- MySQL (v8.0 or higher)
- npm or yarn package manager
git clone <repository-url>
cd newhtmlg# Install backend dependencies
npm install
# Install frontend dependencies
cd client
npm install
cd ..CREATE DATABASE vanguard_machinery CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;Create a .env file in the root directory with the following content:
# Server Configuration
PORT=5000
NODE_ENV=development
# Database Configuration (MySQL)
DB_HOST=localhost
DB_PORT=3307
DB_NAME=vanguard_machinery
DB_USER=root
DB_PASSWORD=Key-1122
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# Email Configuration (Optional - for contact form notifications)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
# File Upload Configuration
MAX_FILE_SIZE=10485760
UPLOAD_PATH=./uploads
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100npm run setup-dbThis will create the database tables and default users:
- Admin User:
admin/admin123 - Editor User:
editor/editor123
npm run devThe backend will run on http://localhost:5000
cd client
npm startThe frontend will run on http://localhost:3000
npm run buildnpm startnpm start- Start production servernpm run dev- Start development server with nodemonnpm run build- Build frontend for productionnpm run build:client- Build only the frontendnpm run install:all- Install both backend and frontend dependenciesnpm run setup-db- Setup database and create default users
POST /api/auth/login- User loginGET /api/auth/user- Get current userPOST /api/auth/change-password- Change password
GET /api/products- Get all products (with pagination, filtering, sorting)GET /api/products/featured- Get featured productsGET /api/products/categories- Get product categoriesGET /api/products/:slug- Get product by slugPOST /api/products- Create new product (Admin/Editor)PUT /api/products/:id- Update product (Admin/Editor)DELETE /api/products/:id- Delete product (Admin)
GET /api/news- Get all news (with pagination, filtering, sorting)GET /api/news/featured- Get featured newsGET /api/news/categories- Get news categoriesGET /api/news/:slug- Get news by slugPOST /api/news- Create new news (Admin/Editor)PUT /api/news/:id- Update news (Admin/Editor)DELETE /api/news/:id- Delete news (Admin)
POST /api/contact- Submit contact formGET /api/contact- Get all inquiries (Admin/Editor)GET /api/contact/:id- Get inquiry details (Admin/Editor)PUT /api/contact/:id/status- Update inquiry status (Admin/Editor)PUT /api/contact/:id/respond- Respond to inquiry (Admin/Editor)PUT /api/contact/:id/read- Mark inquiry as read (Admin/Editor)DELETE /api/contact/:id- Delete inquiry (Admin)
GET /api/admin/dashboard- Get admin dashboard dataGET /api/admin/users- Get all users (Admin)POST /api/admin/users- Create new user (Admin)PUT /api/admin/users/:id- Update user (Admin)DELETE /api/admin/users/:id- Delete user (Admin)
- Login as Admin or Editor
- Navigate to Admin Panel > Products
- Click "Add New Product"
- Fill in product details and upload images
- Set SEO fields for better search rankings
- Publish the product
- Login as Admin or Editor
- Navigate to Admin Panel > News
- Click "Add New Article"
- Write content with proper SEO optimization
- Add featured image and tags
- Publish the article
- Login as Admin or Editor
- Navigate to Admin Panel > Contact
- View and respond to customer inquiries
- Update status and assign to team members
- Send email responses to customers
- Dynamic title and description for each page
- Open Graph tags for social media sharing
- Twitter Card support
- Canonical URLs
- Organization schema
- Product schema
- Article schema
- Breadcrumb navigation
- Image optimization with Sharp
- Lazy loading for images
- Code splitting and bundling
- Compression middleware
Make sure to set all required environment variables in production:
- Database credentials
- JWT secret
- Email configuration
- File upload settings
- Use a production MySQL server
- Set up proper backups
- Configure connection pooling
- Enable SSL connections if required
- Change default JWT secret
- Enable HTTPS
- Set up proper CORS configuration
- Configure rate limiting
- Use environment variables for sensitive data
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please contact:
- Email: support@vanguardmachinery.com
- Website: https://vanguardmachinery.com
- Initial release
- MySQL database integration
- Complete CMS functionality
- SEO optimization features
- Responsive design
- Admin panel with role-based access