This project implements a web application Userauth, featuring user registration, post listings, and secure API endpoints.
Technology Stack
- Backend:
- Node.js
- Express.js
- Database (MongoDB)
- jsonwebtoken (JWT)
- Frontend:
- React.js
- Tailwind CSS
Features
-
Signup Screen
- Fields for username/email, password, optional name and profile picture.
- Input validation and clear error messages.
- Terms and conditions.
- Simulated welcome email.
- Redirect to post list screen (React Router).
-
Post List Screen
- Infinite scrolling, posts fetched via GET API.
- Responsive design (Tailwind CSS).
-
JWT Authentication
- JWT tokens for user authentication.
- Secured API endpoints.
API Endpoints
-
POST /signup
- Registers new users.
- Input validation, unique usernames/emails, secure password hashing.
-
GET /posts
- Fetches posts in a paginated manner.
- Requires authentication.
Best Practices
- Robust input validation and sanitization.
- Secure password storage (bcrypt, Argon2).
- Informative error handling.
- Well-structured and documented code.
- Environment variables for sensitive data.
Installation and Setup
-
Clone repository:
git clone [invalid URL removed]
-
Install dependencies (Backend):
cd Userauth/backend npm install -
Install dependencies (Frontend):
cd Userauth/frontend npm install -
Database configuration:
- Set up database and adjust configuration in backend.
-
Environment variables:
- Create a
.envfile in the backend directory for sensitive information.
- Create a