A full-stack web application for managing user data with CRUD operations, avatar uploads, Excel import, search functionality, and pagination.
Shows user table with search, sort, and pagination controls.
Upload up to 5 avatars per user. Existing avatars can be cropped or replaced individually.
- User Management
- Create, read, update, delete user records
- Validation rules: required fields, age checks, driver license requirement (18+), email format check
- Avatar Management
- Upload up to 5 avatars per user (
avatar1
–avatar5
) - Temporary folder support for new users before saving
- Automatic cleanup of old avatars when replaced
- URLs automatically included in API responses
- Upload up to 5 avatars per user (
- Excel Import
- Upload
.xlsx
or.xls
file with user data - Validation for required fields, email format, age, driver license
- Summary of created and failed rows returned
- Upload
- Bulk User Creation
- Create multiple users at once using a JSON array
- Advanced Search
- Filter by first name, last name, email, or phone number
- Sorting
- Sort users by ID, name, email, age, etc.
- Pagination
- Navigate through users efficiently
- Responsive Design
- Mobile-friendly interface with Tailwind CSS
- React 18 – Hooks-based architecture
- Tailwind CSS – Modern utility-first styling
- Vite – Fast dev/build tool
- Node.js + Express.js
- MongoDB with Mongoose ODM
- Multer – File upload handling
- XLSX – Excel processing
- CORS – Cross-origin requests
- dotenv – Environment variable management
- uuid – Unique temp folder IDs for new users
user-management-system/
├── backend/
│ ├── src/
│ │ ├── controllers/
│ │ │ └── user.controllers.js
│ │ ├── middlewares/
│ │ │ └── multer.middlewares.js
│ │ ├── models/
│ │ │ └── user.models.js
│ │ ├── routes/
│ │ │ └── user.routes.js
│ │ └── index.js
│ ├── uploads/ # Avatar & Excel storage
│ ├── package.json
│ └── pnpm-lock.yaml
└── frontend/
├── src/
│ ├── components/
│ │ ├── Header.jsx
│ │ └── userTable.jsx
│ ├── Operations/
│ │ └── PostForm.jsx
│ ├── App.jsx
│ └── main.jsx
├── public/
├── package.json
├── tailwind.config.js
├── vite.config.js
└── index.html
- Node.js v16+
- pnpm or npm
- MongoDB Atlas account (or local MongoDB)
-
Clone the repository
git clone [email protected]:alarcritty/data-table.git cd data-table
-
Backend Setup
cd backend npm install
-
Frontend Setup
cd ../frontend pnpm install
Create .env
in /backend
:
PORT=3000
MONGO_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/test
CORS_ORIGIN=*
-
Start Backend
cd backend pnpm run dev # or node src/index.js
Runs on:
http://localhost:3000
-
Start Frontend
cd frontend pnpm dev
Runs on:
http://localhost:5173
GET /api/users
Query params: page
, limit
, sortBy
, order
, firstName
, lastName
, email
, phone
GET /api/users/:id
POST /api/users
- Accepts JSON body or multipart form (with avatars)
- If body is an array, bulk creation is triggered
PUT /api/users/:id
PATCH /api/users/:id
- Upload one avatar field (
avatar1
–avatar5
) at a time - Requires
avatarField
in body
DELETE /api/users/:id
POST /api/users/upload-excel
multipart/form-data
→ field:excelFile
- File type:
.xlsx
or.xls
Example:
curl -X POST http://localhost:3000/api/users/upload-excel \
-F "[email protected]"
Response:
{
"success": true,
"message": "Excel processing complete: 3 users created, 1 failed",
"summary": { "totalRows": 4, "successful": 3, "failed": 1 },
"createdUsers": [
{ "id": "66a...", "firstName": "Alice", "lastName": "Smith" }
],
"failedUsers": [
{ "rowIndex": 4, "error": "Driver License required for age 18+" }
]
}
- Max 5 avatars per user
- Max size: 5MB per file
- Allowed:
jpeg
,jpg
,png
,gif
- Filenames are unique with user ID + timestamp
- Max size: 10MB
- Allowed:
.xlsx
,.xls
- Stored temporarily in
uploads/excel/
- Auto-deleted after processing
firstName
,lastName
,email
,phone
,age
→ requiredage
: 0–120 onlydriverLicense
: required ifage >= 18
email
: must be valid formatphone
: must be numeric
- New users use
uploads/temp_<uuid>
- Files moved to
uploads/user_<id>
once saved
- Old avatars auto-deleted on replacement
- On user deletion, all related files/folder are removed
- Temporary uploads removed if user creation fails
- Deleted immediately after processing
- Responsive design with Tailwind
- Live updates after CRUD operations
- Avatar preview and crop functionality
- Excel upload summary page
- Modern React hooks architecture
- Use environment variables for DB connection
- Add authentication & authorization before production
- Validate user input more strictly
- HTTPS recommended for production
- Consider rate limiting for APIs
- Fork the repository
- Create your 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
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.