This is a backend application for managing user accounts and profiles, built with Node.js, Express, MySQL, and Sequelize. It features user authentication, profile management, and secure API endpoints.
- Installation
- Usage
- Features
- API Endpoints
- Database Models
- Configuration
- Dependencies
- Development
- Contributing
- License
- Clone the repository:
git clone https://github.com/LoordhuJeyakumar/userandprofilemanagement-be.git
- Navigate to the project directory:
cd userandprofilemanagement-be
- Install dependencies:
npm install
-
Set up your environment variables in a
.env
file (see Configuration section). -
Set up your database and run migrations (if applicable).
To start the server:
- Production mode:
npm start
- Development mode:
npm run dev
- Development mode with inspector:
npm run dev:inspector
- Development mode with breakpoint debugging:
npm run dev:debug
- User registration and authentication
- JWT-based authentication
- User profile management
- Role-based access control
- Email verification
- Password reset functionality
- Profile picture upload (using AWS S3)
- CRUD operations for users and profiles
- POST
/api/users/register
- Register a new user - POST
/api/users/login
- User login - GET
/api/users/getAllUsers
- Get all users - GET
/api/users/getUser
- Get current user details (protected) - PUT
/api/users/updateUser
- Update user details (protected) - DELETE
/api/users/deleteUser/:id
- Delete a user - GET
/api/users/verify/:id/:token
- Verify user email - PUT
/api/users/changePassword
- Change user password (protected) - PUT
/api/users/deactivateUser
- Deactivate user account (protected) - DELETE
/api/users/deleteUserAndProfile
- Delete user and associated profile (protected)
- GET
/api/profiles/getProfile
- Get user profile (protected) - PUT
/api/profiles/updateProfile
- Update user profile (protected) - DELETE
/api/profiles/deleteProfile
- Delete user profile (protected) - PUT
/api/profiles/updateProfilePicture
- Update profile picture (protected)
username
: String (required, unique)email
: String (required, unique, validated)password
: String (required)role
: Enum ('user', 'admin')isActive
: BooleanisVerified
: BooleanverificationToken
: StringresetPasswordToken
: StringresetPasswordExpires
: Date
firstName
: String (required)lastName
: String (required)phoneNumber
: Stringgender
: Enum ('male', 'female', 'other')profilePicture
: StringdateOfBirth
: Dateaddress
: String (required)userId
: Integer (foreign key to User model)
Create a .env
file in the root directory with the following variables:
PORT=3000
DB_HOST=your_database_host
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_NAME=your_database_name
JWT_SECRET=your_jwt_secret
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=your_aws_region
S3_BUCKET_NAME=your_s3_bucket_name
- Express
- Sequelize
- MySQL2
- Bcrypt
- JSON Web Token
- Nodemailer
- Multer
- AWS SDK
- Cors
- Dotenv
- Nodemon (for auto-restarting the server during development)
- Sequelize CLI (for database migrations and seeders)
For any queries or support, please contact:
- Email: loordhujeyakumar@gmail.com
- Phone: +91 9600693684