A modern, full-stack user management application built with Node.js, Express, MongoDB, and EJS templating engine. Features a sleek glassmorphism UI design with real-time form validation and live preview functionality.
- Modern UI Design: Glassmorphism design with animated backgrounds
- CRUD Operations: Create, Read, Update, Delete users
- Real-time Preview: Live preview of user changes while editing
- Form Validation: Client-side and server-side validation
- Responsive Design: Mobile-first responsive layout
- Image Support: Profile image URL handling with fallback
- Loading States: Smooth loading animations and feedback
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ODM
- Template Engine: EJS
- Styling: Tailwind CSS, Custom CSS animations
- Icons: Heroicons (via SVG)
- Development: Nodemon for auto-restart
Before running this application, make sure you have the following installed:
git clone https://github.com/yourusername/user-management-system.git
cd user-management-system
npm install
If you need to install dependencies manually:
# Core dependencies
npm install express mongoose ejs dotenv
# Development dependencies
npm install --save-dev nodemon
Create a .env
file in the root directory:
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/user_management
# For MongoDB Atlas, use:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/user_management
# Server Configuration
PORT=3000
NODE_ENV=development
# Optional: Session Secret (if using sessions)
SESSION_SECRET=your_session_secret_here
- Install MongoDB locally
- Start MongoDB service:
# On macOS with Homebrew brew services start mongodb/brew/mongodb-community # On Ubuntu/Linux sudo systemctl start mongod # On Windows net start MongoDB
- Create account at MongoDB Atlas
- Create a new cluster
- Get connection string and add to
.env
file
# Start with nodemon for auto-restart on file changes
npm run dev
# Or directly with nodemon
npx nodemon app.js
# Or if nodemon is installed globally
nodemon app.js
# Start the application
npm start
# Or directly with node
node app.js
The application will be available at: http://localhost:3000
user-management-system/
βββ π models/
β βββ user.js # User model/schema
βββ π node_modules/ # Dependencies
βββ π public/
β βββ π images/ # Static images
β βββ π javascripts/ # Client-side JS
β βββ π stylesheets/
β βββ style.css # Additional styles
βββ π views/
β βββ edit.ejs # Edit user form
β βββ index.ejs # User listing page
β βββ read.ejs # User details page
βββ .gitignore # Git ignore file
βββ app.js # Main application file
βββ package.json # Dependencies and scripts
βββ package-lock.json # Dependency lock file
βββ README.md # This file
Method | Route | Description |
---|---|---|
GET | / |
Home page |
GET | /read |
Display all users |
GET | /edit/:id |
Edit user form |
POST | /edit/:id |
Update user |
POST | /create |
Create new user |
GET | /delete/:id |
Delete user |
Add these scripts to your package.json
:
{
"scripts": {
"start": "node app.js",
"dev": "nodemon app.js",
"test": "echo \"Error: no test specified\" && exit 1"
}
}
Update your MongoDB connection in app.js
or create a separate config file:
// app.js
const mongoose = require('mongoose');
// Connect to MongoDB
mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/user_management', {
useNewUrlParser: true,
useUnifiedTopology: true
});
Variable | Description | Default |
---|---|---|
MONGODB_URI |
MongoDB connection string | mongodb://localhost:27017/user_management |
PORT |
Server port | 3000 |
NODE_ENV |
Environment mode | development |
-
MongoDB Connection Error
# Check if MongoDB is running sudo systemctl status mongod # Linux brew services list | grep mongodb # macOS
-
Port Already in Use
# Find process using port 3000 lsof -i :3000 # Kill the process kill -9 <PID>
-
Nodemon Not Found
# Install nodemon globally npm install -g nodemon # Or use npx npx nodemon app.js
-
Dependencies Issues
# Clear npm cache and reinstall npm cache clean --force rm -rf node_modules package-lock.json npm install
For production deployment, consider:
- Input validation and sanitization
- Rate limiting
- CORS configuration
- Environment variables for sensitive data
- HTTPS/SSL certificates
- Database connection security
- Fork the repository
- Create a 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 is created by IYKYK(7A) *****
Happy Coding! π