https://github.com/aadityapanda/userregistration
This is a Full Stack-based user registration application that allows users to sign up, receive email verification, and log in. It includes user registration functionality with email verification using Nodemailer for sending verification emails.
https://github.com/aadityapanda/userregistration
expressjs full-stack js mysql nodejs react-hooks react-router react-router-dom reactjs sql user-registration
Last synced: 2 months ago
JSON representation
This is a Full Stack-based user registration application that allows users to sign up, receive email verification, and log in. It includes user registration functionality with email verification using Nodemailer for sending verification emails.
- Host: GitHub
- URL: https://github.com/aadityapanda/userregistration
- Owner: AadityaPanda
- License: mit
- Created: 2024-12-31T12:10:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-15T06:51:11.000Z (over 1 year ago)
- Last Synced: 2025-01-15T08:59:59.913Z (over 1 year ago)
- Topics: expressjs, full-stack, js, mysql, nodejs, react-hooks, react-router, react-router-dom, reactjs, sql, user-registration
- Language: JavaScript
- Homepage:
- Size: 588 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ๐ User Registration App

**A comprehensive Node.js user registration system with admin dashboard and email verification**
[](https://nodejs.org/)
[](https://expressjs.com/)
[](https://reactjs.org/)
[](https://mysql.com/)
[](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
[](https://www.w3.org/Style/CSS/Overview.en.html)
---
## ๐ Overview
This is a full-stack Node.js application that provides a complete user registration system with email verification and an administrative dashboard. The application offers secure user management capabilities, allowing both regular users to register and authenticate, while providing administrators with comprehensive user management tools.
### ๐ฏ Key Capabilities
The application ensures secure user management and provides a seamless experience for both regular users and administrators through:
- **User Registration & Authentication** - Complete signup and login workflow
- **Email Verification System** - Automated email verification using Nodemailer
- **Administrative Dashboard** - Comprehensive user management interface
- **CRUD Operations** - Full create, read, update, and delete functionality
- **User Status Management** - Activate/deactivate user accounts
- **Automated Cleanup** - Scheduled removal of unverified accounts
---
## ๐ Table of Contents
- [๐ Features](#-features)
- [๐ ๏ธ Tech Stack](#๏ธ-tech-stack)
- [๐ Project Structure](#-project-structure)
- [โ๏ธ Setup](#๏ธ-setup)
- [๐ง Installation](#-installation)
- [๐ฃ๏ธ Routes Overview](#๏ธ-routes-overview)
- [๐งน Scheduled Cleanup](#-scheduled-cleanup)
- [๐ License](#-license)
- [๐ค Contributing](#-contributing)
- [๐ Contact](#-contact)
---
## ๐ Features
### ๐ฅ User Features
- โ
**User Registration** - Secure account creation
- โ
**Email Verification** - Automated verification emails
- โ
**User Authentication** - Login/logout functionality
- โ
**User Dashboard** - Personal account interface
### ๐จโ๐ผ Admin Features
- โ
**Admin Dashboard** - Comprehensive management interface
- โ
**User Management** - Create, edit, delete users
- โ
**Account Control** - Activate/deactivate accounts
- โ
**User Overview** - View all registered users
---
## ๐ ๏ธ Tech Stack
### Backend



### Frontend



### Database & Tools



---
## ๐ Project Structure
๐ Click to expand project structure
```
๐ฆ UserRegistration
โโโ ๐ backend/
โ โโโ ๐ config/
โ โ โโโ ๐ db.js # MySQL database connection
โ โโโ ๐ middleware/
โ โ โโโ ๐ isAdmin.js # Admin verification middleware
โ โ โโโ ๐ requireLogin.js # Session check middleware
โ โโโ ๐ routes/
โ โ โโโ ๐ admin.js # Admin dashboard routes
โ โ โโโ ๐ dashboard.js # User dashboard routes
โ โ โโโ ๐ home.js # Home page routes
โ โ โโโ ๐ login.js # Authentication routes
โ โ โโโ ๐ logout.js # Session management
โ โ โโโ ๐ signup.js # User registration routes
โ โโโ ๐ services/
โ โ โโโ ๐ emailService.js # Email sending service
โ โโโ ๐ .env # Environment variables
โ โโโ ๐ .env.example # Environment template
โ โโโ ๐ cleanup.js # Automated cleanup task
โ โโโ ๐ server.js # Main server file
โ
โโโ ๐ frontend/your-project-name/
โโโ ๐ src/
โ โโโ ๐ App.jsx # Main React component
โ โโโ ๐ main.jsx # React entry point
โ โโโ ๐ components/
โ โ โโโ ๐ AdminNavbar/
โ โ โ โโโ ๐ AdminNavbar.css
โ โ โ โโโ ๐ AdminNavbar.jsx
โ โ โโโ ๐ AdminSidebar/
โ โ โ โโโ ๐ AdminSidebar.css
โ โ โ โโโ ๐ AdminSidebar.jsx
โ โ โโโ ๐ Navbar/
โ โ โโโ ๐ Navbar.css
โ โ โโโ ๐ Navbar.jsx
โ โโโ ๐ pages/
โ โ โโโ ๐ Admin.jsx # Admin dashboard
โ โ โโโ ๐ CreateUser.jsx # User creation
โ โ โโโ ๐ Dashboard.jsx # User dashboard
โ โ โโโ ๐ EditUser.jsx # User editing
โ โ โโโ ๐ Home.jsx # Landing page
โ โ โโโ ๐ Login.jsx # Authentication
โ โ โโโ ๐ ManageUsers.jsx # User management
โ โ โโโ ๐ Signup.jsx # Registration
โ โโโ ๐ styles/
โ โโโ ๐ Admin.css
โ โโโ ๐ CreateUser.css
โ โโโ ๐ Dashboard.css
โ โโโ ๐ EditUser.css
โ โโโ ๐ Home.css
โ โโโ ๐ Login.css
โ โโโ ๐ ManageUsers.css
โ โโโ ๐ Signup.css
โโโ ๐ public/
โโโ ๐ index.html
โโโ ๐ package.json
โโโ ๐ vite.config.js
```
---
## โ๏ธ Setup
### ๐ Prerequisites
Before you begin, ensure you have the following installed:
| Requirement | Version | Description |
|-------------|---------|-------------|
|  | 14.x or above | JavaScript runtime |
|  | Latest | Database server |
|  | Latest | Version control |
|  | Latest | Frontend framework |
---
## ๐ง Installation
### ๐ฅ๏ธ Backend Setup
๐ฅ Step 1: Clone the Repository
```bash
git clone https://github.com/AadityaPanda/UserRegistration.git
cd backend
```
๐ฆ Step 2: Install Dependencies
```bash
npm install
```
๐ง Step 3: Environment Configuration
Create your environment file:
```bash
cp .env.example .env
```
Configure your `.env` file with the following variables:
```env
# ๐๏ธ Database Configuration
DB_HOST=your_database_host
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_NAME=your_database_name
# ๐ Session Configuration
SESSION_SECRET=your_session_secret
# ๐ Server Configuration
PORT=3000
BASE_URL=http://localhost:3000
# ๐ง SMTP Configuration
SMTP_HOST=your_smtp_host
SMTP_PORT=587
EMAIL_USER=your_email_address
EMAIL_PASS=your_email_password
SMTP_SECURE=false
```
### ๐๏ธ Database Setup
๐ Step 4: Database Configuration
Execute the following SQL commands to set up your database:
```sql
-- Create the database
CREATE DATABASE myform;
-- Switch to the database
USE myform;
-- Create the users table
CREATE TABLE users (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
middlename VARCHAR(30),
lastname VARCHAR(30) NOT NULL,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(64) NOT NULL,
mobile_no VARCHAR(15) NOT NULL,
email VARCHAR(50) NOT NULL UNIQUE,
isAdmin BOOLEAN DEFAULT FALSE,
verified BOOLEAN DEFAULT FALSE,
active BOOLEAN DEFAULT TRUE
);
-- Create an admin user
UPDATE users SET isAdmin = TRUE WHERE username = 'admin';
-- Reset auto-increment
ALTER TABLE users AUTO_INCREMENT = 1;
```
๐ Step 5: Start the Backend Server
```bash
npm start
```
โ
Backend server will be running at `http://localhost:3000`
### ๐จ Frontend Setup
โ๏ธ Step 1: Create React Frontend
```bash
cd frontend
npm create vite@latest your-project-name -- --template react
cd your-project-name
```
๐ฆ Step 2: Install Frontend Dependencies
```bash
npm install
```
๐๏ธ Step 3: Build and Run
```bash
# Create production build
npm run build
# Start development server
npm run dev
```
โ
Frontend will be running at `http://localhost:5173`
---
## ๐ฃ๏ธ Routes Overview
๐ Route
๐ Description
๐ Access
/
๐ Landing page
๐ Public
/signup
๐ User registration
๐ Public
/login
๐ User authentication
๐ Public
/dashboard
๐ค User dashboard
๐ Authenticated
/admin
๐จโ๐ผ Admin homepage
๐ก๏ธ Admin only
/admin/user
๐ฅ User management
๐ก๏ธ Admin only
/admin/create
โ Create new user
๐ก๏ธ Admin only
/admin/edit/:id
โ๏ธ Edit user details
๐ก๏ธ Admin only
---
## ๐งน Scheduled Cleanup
The application includes an automated cleanup system (`cleanup.js`) that:
- ๐ **Runs every hour** to maintain database hygiene
- ๐๏ธ **Removes unverified users** whose verification tokens have expired
- ๐ง **Prevents spam registrations** by cleaning up abandoned accounts
- โก **Optimizes database performance** by removing inactive records
This ensures your database stays clean and performs optimally over time.
---
## ๐ License
[](https://choosealicense.com/licenses/mit/)
**This project is licensed under the MIT License**
Feel free to use, modify, and distribute it in your projects.
---
## ๐ค Contributing
We welcome contributions! Here's how you can help improve this project:
### ๐ง Development Workflow
1. **๐ด Fork the repository**
2. **๐ฟ Create a feature branch**
```bash
git checkout -b feature/YourFeatureName
```
3. **๐พ Commit your changes**
```bash
git commit -m "Add YourFeatureName"
```
4. **๐ค Push to the branch**
```bash
git push origin feature/YourFeatureName
```
5. **๐ Open a pull request**
### ๐ Contribution Guidelines
- ๐งช Ensure all tests pass before submitting
- ๐ Update documentation for new features
- ๐จ Follow the existing code style
- ๐ฌ Provide clear commit messages
Check [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
---
## ๐ Contact
**๐จโ๐ป Aaditya Panda**
[](mailto:aadityapanda23@gmail.com)
[](https://github.com/AadityaPanda)
---
๐ **Thank you for using the User Registration App!**
*If you found this project helpful, please consider giving it a โญ on GitHub!*