- β¨ Features
- π οΈ Tech Stack
- π¦ Installation
- π API Endpoints
- π― Project Structure
- π¨ UI Features
- π§ͺ Testing
- π± Responsive Design
- π Deployment
- π€ Contributing
- π License
- π¨βπ» Author
- π Acknowledgments
- β Complete CRUD Operations (Create, Read, Update, Delete)
- β RESTful API Architecture
- β MongoDB Database Integration
- β Error Handling & Validation
- β CORS Enabled
- β Environment Ready
- π¨ Modern Animated UI
- π± Fully Responsive Design
- π Real-time Dashboard with Statistics
- π‘ Smart Suggestions Based on Data
- π Smooth Animations & Transitions
- π Gradient Color Schemes
- π User Analytics Dashboard
- β¨ Hero Section with Animated Welcome Message
- π Statistics Cards with Counters
- π₯ User Management Table
- π― Smart Suggestions Engine
- π Real-time Data Updates
- π¨ Bootstrap 5 Components
- Node.js - JavaScript Runtime
- Express.js - Web Framework
- MongoDB - NoSQL Database
- Mongoose - ODM Library
- CORS - Cross-Origin Resource Sharing
- EJS - Template Engine
- Bootstrap 5 - CSS Framework
- CSS3 - Custom Animations
- JavaScript (ES6+) - Client-side Logic
- Font Awesome - Icons
- Node.js (v14 or higher)
- MongoDB (local or cloud)
- npm or yarn package manager
- Clone the repository
git clone https://github.com/Nadeer-Ansari/Nodejs-CRUD-API.git
cd Nodejs-CRUD-API- Install dependencies
npm install- Setup MongoDB
-
Local MongoDB: Make sure MongoDB is running on mongodb://127.0.0.1:27017
-
OR use MongoDB Atlas (cloud)
-
Update the connection string in database/db.js
- Run the application
# Development mode with auto-reload
npm run dev
# Production mode
npm start- Access the application
-
Web Interface: http://localhost:9000
-
API Endpoints: http://localhost:9000/api/users
| Method | Endpoint | Description | Status |
|---|---|---|---|
| GET | /api/users | Get all users | β |
| GET | /api/users/:id | Get single user | β |
| POST | /api/users | Create new user | β |
| PUT | /api/users/:id | Update user | β |
| DELETE | /api/users/:id | Delete user | β |
POST /api/users
{
"name": "John Doe",
"age": 25,
"place": "New York"
}Response
{
"message": "User Created Successfully!",
"user": {
"_id": "607f1f2b9f1b2c3d4e5f6a7b",
"name": "John Doe",
"age": 25,
"place": "New York",
"__v": 0
}
}Nodejs-CRUD-API/
β
βββ π public/
β βββ π css/
β β βββ style.css # Custom styles & animations
β βββ π js/
β βββ script.js # Frontend logic & dashboard
β
βββ π views/
β βββ header.ejs # Navigation & head section
β βββ footer.ejs # Scripts & closing tags
β βββ home.ejs # Dashboard homepage
β βββ adduser.ejs # Add user form
β βββ showuser.ejs # User listing table
β βββ updateuser.ejs # Edit user form
β
βββ π models/
β βββ usermodel.js # Mongoose schema
β
βββ π database/
β βββ db.js # MongoDB connection
β
βββ index.js # Main application file
βββ package.json # Dependencies
βββ README.md # Documentation
- Total Users Count - Real-time user statistics
- Average Age - Demographic analysis
- Unique Locations - Geographic distribution
- Recent Users - Latest 5 members
The application intelligently analyzes your data and provides:
- π Growth suggestions based on user count
- π₯ Age demographic insights
- π Geographic diversity recommendations
- π‘ Quick tips for better management
- π Fade-in animations on page load
- π Hover effects on cards and buttons
- π Smooth counter animations
- π« Loading spinners and transitions
- π¨ Gradient backgrounds and shadows
- Import the API endpoints
-
POST /api/users - Create user
-
GET /api/users - Get all users
-
PUT /api/users/:id - Update user
-
DELETE /api/users/:id - Delete user
-
Check response status codes (200, 201, 400, 404)
- Dashboard statistics update automatically
- Forms validate input data
- Delete confirmation dialogs
- Real-time table updates
- Responsive design on different screen sizes
| Device | Breakpoint | Features |
|---|---|---|
| Mobile | < 768px | Stacked layout, smaller buttons, hamburger menu |
| Tablet | 768px - 1024px | Adjusted spacing, 2-column layout |
| Desktop | > 1024px | Full dashboard view, 3-4 column layout |
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Opera (latest)
Create a .env file in the root directory:
PORT=9000
MONGODB_URI=mongodb://127.0.0.1:27017/cdac
NODE_ENV=development- Sign up at render.com
- Click "New +" β "Web Service"
- Connect your GitHub repository
- Name: nodejs-crud-api
- Environment: Node
- Build Command: npm install
- Start Command: node index.js
- Add environment variables
- Click "Create Web Service"
npm i -g vercel
vercel --prodnpm i -g netlify-cli
netlify deploy --prodhttps://smart-crud-dashboard.onrender.com
Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.
-
Fork the Project
-
Create your 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
- Update the README.md with details of changes
- Add comments to your code
- Follow the existing code style
- Test your changes thoroughly
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Nadeer Ansari
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions...
- GitHub: Nadeer-Ansari
- LinkedIn: Nadeer Ansari
- Portfolio: https://nadeer-ansari.netlify.app
- Node.js - JavaScript Runtime
- Express.js - Web Framework
- MongoDB - Database
- Bootstrap - UI Framework
- Font Awesome - Icons
- All contributors and users
| Feature | Status |
|---|---|
| Backend API | β Complete |
| Frontend UI | β Complete |
| Dashboard Analytics | β Complete |
| Smart Suggestions | β Complete |
| Responsive Design | β Complete |
| Documentation | β Complete |
| Deployment | π Ready |
- User Authentication & Authorization
- Search and Filter functionality
- Pagination for large datasets
- Export data to CSV/PDF
- User profile pictures upload
- Email notifications
- Advanced analytics charts
- Dark mode toggle
- Multi-language support
- Real-time WebSocket updates
None currently. Report issues here
For support, email anadeer13@gmail.com or open an issue on GitHub.
Give a βοΈ if this project helped you!