A modern, full-stack contact management application built with Node.js, Express, MongoDB, and EJS. Features a beautiful responsive UI with smooth animations and comprehensive error handling.
- Create, Read, Update, Delete (CRUD) operations for contacts
- Beautiful & Interactive UI with gradient backgrounds and smooth animations
- Responsive Design - Works seamlessly on all devices
- Form Validation - Client-side and server-side validation
- Error Handling - Comprehensive error handling with custom error pages
- MongoDB Integration - Persistent data storage
- EJS Templating - Dynamic server-side rendering
- Font Awesome Icons - Professional icon integration
- Bootstrap 5 - Modern UI framework
- Node.js (v22 or higher)
- MongoDB (local or Atlas)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/muhammadumarafzaal/ContactApp.git cd ContactApp -
Install dependencies
npm install
-
Create
.envfile in the root directoryMONGODB_URL=mongodb://localhost:27017/contacts-crud PORT=3000
-
Start the application
npm start
Or for development with auto-reload:
npm run dev
-
Open in browser
http://localhost:3000
ContactApp/
βββ controller/
β βββ contacts.controller.js # Business logic for contacts
βββ models/
β βββ contacts.models.js # MongoDB schema
βββ routes/
β βββ contacts.routes.js # API routes
βββ views/
β βββ home.ejs # Contact list page
β βββ add-contact.ejs # Add contact form
β βββ update-contact.ejs # Edit contact form
β βββ show-contact.ejs # Contact details page
β βββ 404.ejs # Error page
β βββ partials/
β βββ header.ejs # Navigation header
β βββ footer.ejs # Footer
βββ public/
β βββ bootstrap.min.css # Bootstrap framework
β βββ custom.css # Custom animations & styles
βββ config/
β βββ database.js # MongoDB connection
βββ index.js # Main application file
βββ package.json # Dependencies
βββ README.md # Project documentation
- Smooth Page Transitions - Fade-in animations for content
- Card Animations - Pop-in effects with elevation
- Button Hover Effects - Scale and rotation on hover
- Table Row Animations - Staggered fade-in for contacts
- Responsive Interactions - Smooth transitions on all devices
- Primary Gradient: Purple (#667eea) to Blue (#764ba2)
- Secondary Colors: Green (#10b981), Red (#ef4444), Blue (#0ea5e9)
- Professional Typography - Clean, modern fonts
| Method | Route | Description |
|---|---|---|
| GET | / |
Get all contacts |
| GET | /add-contact |
Show add contact form |
| POST | /add-contact |
Create new contact |
| GET | /show-contact/:id |
Get contact details |
| GET | /update-contact/:id |
Show edit form |
| POST | /update-contact/:id |
Update contact |
| GET | /delete-contact/:id |
Delete contact |
The application includes comprehensive error handling:
- 400 Bad Request - Missing or invalid form fields
- 404 Not Found - Invalid contact ID or missing contact
- 500 Server Error - Database or server errors
- Custom Error Pages - Professional error messages with navigation
- Node.js - JavaScript runtime
- Express - Web application framework
- MongoDB - NoSQL database
- Mongoose - MongoDB ODM
- Dotenv - Environment variable management
- EJS - Templating engine
- Bootstrap 5 - CSS framework
- Font Awesome - Icon library
- Custom CSS - Animations and styling
{
first_name: String,
last_name: String,
email: String,
phone: String,
address: String,
createdAt: Date (auto),
updatedAt: Date (auto)
}- β First Name
- β Last Name
- β Email (valid email format)
- β Phone (phone number format)
- β Address
- Client-side validation using Bootstrap validation classes
- Server-side validation in controller
- Helpful error messages for users
- Field placeholder hints
- Search and filter contacts
- Sort contacts by name/email
- Export contacts to CSV
- Contact categories/groups
- Photo upload for contacts
- Contact backup/restore
- Multi-user authentication
- Dark mode toggle
- Contact backup to email
- Advanced search filters
This project is licensed under the ISC License - see the LICENSE file for details.
Muhammad Umar Afzaal
- GitHub: @muhammadumarafzaal
- Email: umarafzaal182@gmail.com
- Bootstrap for the responsive UI framework
- Font Awesome for beautiful icons
- MongoDB for reliable data storage
- Express.js community for excellent documentation
For support, email umarafzaal182@gmail.com or open an issue in the repository.
Made with β€οΈ by Muhammad Umar Afzaal