A full-stack web application for managing IT documentation with advanced features including Google OAuth, document versioning, and enhanced security.
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js with Express
- Database: MongoDB
- Authentication: JWT with bcrypt password hashing + Google OAuth
- Email: Nodemailer
- Security: Helmet, Rate Limiting, Account Locking
- Google OAuth 2.0 integration
- Account locking after failed login attempts
- Session management
- Enhanced security headers
- Document versioning system
- Advanced search with tags and categories
- File metadata tracking
- Download count analytics
- Soft delete functionality
- Search by title, description, category, and tags
- Filter by categories and tags
- Pagination support
- Sorting options
- Comprehensive activity tracking
- User action logs
- IP address and user agent logging
- Admin activity dashboard
- Welcome emails for new users
- Document upload notifications
- Configurable SMTP settings
- Rate limiting on API endpoints
- Helmet.js security headers
- Input validation
- CORS configuration
- Account lockout protection
- Secure login with JWT authentication
- Upload documents (PDF, DOCX, TXT)
- Edit document details
- Delete documents
- Create and manage users
- View all documents and users
- Search documents by title or category
- Secure login with JWT authentication
- View all documents
- Search documents
- View document details
- Download documents
- Read-only access
it-documentation-portal/
├── backend/
│ ├── config/
│ │ └── db.js # Database configuration
│ ├── controllers/
│ │ ├── authController.js # Authentication logic
│ │ ├── documentController.js # Document CRUD operations
│ │ └── userController.js # User management
│ ├── middleware/
│ │ ├── auth.js # JWT authentication middleware
│ │ └── upload.js # Multer file upload configuration
│ ├── models/
│ │ ├── User.js # User schema
│ │ └── Document.js # Document schema
│ ├── routes/
│ │ ├── authRoutes.js # Authentication routes
│ │ ├── documentRoutes.js # Document routes
│ │ └── userRoutes.js # User routes
│ ├── uploads/ # Uploaded files directory
│ ├── .env # Environment variables
│ ├── server.js # Express server
│ └── package.json # Backend dependencies
└── frontend/
├── css/
│ └── style.css # Application styles
├── js/
│ ├── login.js # Login functionality
│ ├── admin.js # Admin dashboard logic
│ └── user.js # User dashboard logic
├── login.html # Login page
├── admin.html # Admin dashboard
└── user.html # User dashboard
Before running this project, make sure you have the following installed:
- Node.js (v14 or higher) - Download here
- MongoDB (v4.4 or higher) - Download here
- VS Code (recommended) - Download here
-
Download and install MongoDB Community Edition
-
Start MongoDB service:
- Windows: MongoDB should start automatically after installation
- Mac/Linux: Run
mongodin terminal
-
Verify MongoDB is running:
mongo --version
-
Open terminal/command prompt and navigate to the backend folder:
cd C:\it-documentation-portal\backend
-
Install dependencies:
npm install
-
Verify the
.envfile exists with the following content:PORT=5000 MONGODB_URI=mongodb://localhost:27017/it_documentation_portal JWT_SECRET=your_jwt_secret_key_change_this_in_production -
Start the backend server:
npm start
Or for development with auto-restart:
npm run dev
-
You should see:
MongoDB connected successfully Server running on port 5000
Since this is the first time running the application, you need to create an admin user manually.
-
Open a new terminal and start MongoDB shell:
mongo
-
Switch to the application database:
use it_documentation_portal
-
Create an admin user (password will be automatically hashed by the application):
db.users.insertOne({ name: "Admin User", email: "admin@example.com", password: "$2a$10$8K1p/a0dL3LKzOWR5EHzXeKGHZQE5WxGhFFpNUzT5JhN5xKxVxqZS", role: "admin", createdAt: new Date(), updatedAt: new Date() })
Default Admin Credentials:
- Email:
admin@example.com - Password:
admin123
- Email:
-
Create a test user:
db.users.insertOne({ name: "Test User", email: "user@example.com", password: "$2a$10$8K1p/a0dL3LKzOWR5EHzXeKGHZQE5WxGhFFpNUzT5JhN5xKxVxqZS", role: "user", createdAt: new Date(), updatedAt: new Date() })
Default User Credentials:
- Email:
user@example.com - Password:
admin123
- Email:
-
Exit MongoDB shell:
exit
-
Navigate to the frontend folder:
cd C:\it-documentation-portal\frontend
-
Open
login.htmlin your browser:- Right-click on
login.html→ Open with → Your preferred browser - Or use Live Server extension in VS Code
Using Live Server in VS Code (Recommended):
- Install "Live Server" extension in VS Code
- Right-click on
login.html→ "Open with Live Server" - This will open the application at
http://127.0.0.1:5500/login.html
- Right-click on
- Open the application in your browser
- Use the default credentials:
- Admin: admin@example.com / admin123
- User: user@example.com / admin123
After logging in as admin, you can:
-
Upload Documents:
- Click "Upload Document" button
- Fill in title, description, category
- Select a file (PDF, DOCX, or TXT)
- Click "Upload"
-
Edit Documents:
- Click "Edit" button on any document
- Modify the details
- Click "Update"
-
Delete Documents:
- Click "Delete" button on any document
- Confirm deletion
-
Create Users:
- Click "Create User" button
- Fill in user details
- Select role (admin/user)
- Click "Create User"
-
Search Documents:
- Type in the search bar to filter documents by title or category
After logging in as user, you can:
-
View Documents:
- See all available documents
-
Search Documents:
- Use the search bar to find documents
-
View Details:
- Click "View Details" to see full document information
-
Download Documents:
- Click "Download" button to download any document
POST /api/auth/login- User loginGET /api/auth/profile- Get user profile (protected)
POST /api/documents- Upload document (admin only)GET /api/documents- Get all documents (protected)GET /api/documents/:id- Get single document (protected)GET /api/documents/search?query=- Search documents (protected)PUT /api/documents/:id- Update document (admin only)DELETE /api/documents/:id- Delete document (admin only)GET /api/documents/:id/download- Download document (protected)
POST /api/users- Create user (admin only)GET /api/users- Get all users (admin only)DELETE /api/users/:id- Delete user (admin only)
- Password hashing using bcrypt
- JWT-based authentication
- Role-based access control
- Protected API routes
- File type validation
- File size limits (10MB)
- Make sure MongoDB is running
- Check if the connection string in
.envis correct - Try restarting MongoDB service
- Change the PORT in
.envfile - Or stop the process using port 5000
- Make sure backend server is running
- Check if API_URL in frontend JS files matches your backend URL
- Check if
uploads/folder exists in backend directory - Verify file type is PDF, DOCX, or TXT
- Check file size is under 10MB
- Backend runs on
http://localhost:5000 - Frontend should be served via Live Server or any static file server
- MongoDB stores data in
it_documentation_portaldatabase - Uploaded files are stored in
backend/uploads/directory
- Email verification
- Password reset functionality
- Document versioning
- Document categories management
- User profile editing
- Activity logs
- Advanced search filters
- Document preview
This is an academic project for educational purposes.
For issues or questions, please refer to the documentation or contact your instructor.
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js, Express
- Database: MongoDB
- User document upload
- Admin verification (approve/reject)
- Document management system
cd backend npm install npm start
/backend /frontend