A modern fullstack web application for article management with real-time notifications.
- User Authentication: JWT-based authentication with role-based access control
- Article Management: Create, read, update, and delete articles
- Real-time Notifications: Live updates when new articles are posted
- Responsive Design: Mobile-friendly interface with Material-UI
- Admin Panel: User management for administrators
- API Documentation: Interactive Swagger documentation
- React 18 with TypeScript
- Material-UI (MUI) for components
- React Router for navigation
- Socket.IO Client for real-time features
- Axios for HTTP requests
- Node.js with Express.js
- PostgreSQL database
- Socket.IO for real-time communication
- JWT for authentication
- Swagger for API documentation
viruma/
βββ client/ # React frontend application
β βββ src/
β β βββ components/ # React components
β β βββ contexts/ # React contexts
β β βββ services/ # API and socket services
β β βββ types/ # TypeScript type definitions
β βββ public/
β βββ package.json
βββ server/ # Node.js backend application
β βββ src/
β β βββ controllers/ # Route controllers
β β βββ models/ # Database models
β β βββ routes/ # API routes
β β βββ middleware/ # Custom middleware
β β βββ config/ # Configuration files
β βββ database.sql # Database schema
β βββ package.json
βββ README.md
- Node.js (v16 or higher)
- PostgreSQL (v12 or higher)
- npm or yarn
git clone <repository-url>
cd viruma# Navigate to server directory
cd server
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# Edit .env with your database credentials
# Setup database
psql -U username -h localhost -f database.sql
# Start development server
npm run dev# Open new terminal and navigate to client directory
cd client
# Install dependencies
npm install
# Start development server
npm start- Frontend: http://localhost:3000
- Backend API: http://localhost:5001
- API Documentation: http://localhost:5001/api-docs
After running the database setup, you can create users through the registration form or use these test accounts:
Admin User:
- Username: admin
- Email: admin@example.com
- Role: admin
Regular User:
- Username: user
- Email: user@example.com
- Role: user
The backend includes comprehensive API documentation built with Swagger. Visit http://localhost:5001/api-docs when the server is running to explore all available endpoints.
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/articles- Get all articlesPOST /api/articles- Create new articleGET /api/users- Get all users (admin only)
The application uses Socket.IO for real-time notifications:
- New Article Notifications: Users receive instant notifications when new articles are published
- Live Updates: Article lists refresh automatically
- Connection Management: Handles user connections and disconnections gracefully
- Responsive Design: Works on desktop, tablet, and mobile devices
- Dark/Light Theme: Toggle between themes
- Material Design: Clean and modern interface
- Mobile Navigation: Hamburger menu for mobile devices
- Loading States: Smooth loading indicators
- Error Handling: User-friendly error messages
- JWT Authentication: Secure token-based authentication
- Role-based Access: Different permissions for admin and regular users
- Input Validation: Server-side validation for all inputs
- CORS Protection: Configured cross-origin resource sharing
- Helmet.js: Security headers
- Password Hashing: bcrypt for secure password storage
cd client
npm run build
# Deploy the build/ directory to your hosting servicecd server
npm run build
# Deploy to your server with PM2 or similar process managerBackend (.env):
PORT=5001
DATABASE_URL=postgresql://username:password@localhost:5432/database
JWT_SECRET=your-secret-key
NODE_ENV=production- 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
- Follow TypeScript best practices
- Use meaningful commit messages
- Add comments for complex logic
- Write tests for new features
- Update documentation when needed
-
Database Connection Error
- Ensure PostgreSQL is running
- Check database credentials in .env
- Verify database exists
-
Port Already in Use
- Change PORT in server .env
- Kill existing processes on ports 3000/5001
-
Socket Connection Issues
- Check CORS settings
- Verify frontend/backend URLs match
For questions and support:
- Create an issue in this repository
- Check the API documentation at
/api-docs - Review the individual README files in
/clientand/server
This project is licensed under the MIT License - see the LICENSE file for details.
- Material-UI team for the excellent component library
- Socket.IO team for real-time capabilities
- PostgreSQL community for the robust database
- React team for the amazing frontend framework