This is a full-stack authentication application built with a Node.js backend and a frontend framework (e.g., React, Angular, or Vue). The application provides user registration, login, and session management functionalities.
- Features
- Technologies Used
- Installation
- Backend Setup
- Frontend Setup
- API Endpoints
- Usage
- Contributing
- License
- User registration with email verification
- User login and authentication
- JWT-based session management
- Password hashing and validation
- Error handling and validation
- Secure cookie management
-
Backend:
- Node.js
- Express.js
- MongoDB (with Mongoose)
- Bcrypt for password hashing
- JSON Web Tokens (JWT) for authentication
- Zod for schema validation
-
Frontend:
- React (or your chosen framework)
- Axios for API requests
- Redux (or Context API) for state management
- Node.js
- MongoDB
- npm or yarn
git clone https://github.com/yourusername/auth-app.git
cd auth-appcd backend
npm installcd frontend
npm install- Create a
.envfile in thebackenddirectory and add the following environment variables:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET_KEY=your_jwt_secret_key
JWT_REFRESH_SECRET=your_jwt_refresh_secret
- Start the backend server:
npm run dev- Start the frontend development server:
npm start-
POST /api/auth/register
- Register a new user.
- Request body:
{ "email": "test@test.com", "password": "123123" }
-
POST /api/auth/login
- Log in an existing user.
- Request body:
{ "email": "test@test.com", "password": "123123" }
-
GET /api/auth/logout
- Log out the user.
This project is licensed under the MIT License - see the LICENSE file for details.