This project implements Token-Based Authentication (JWT) using Node.js for the backend and React with TypeScript for the frontend.
Token-Based Authentication is a secure way to authenticate users by issuing a unique token upon successful login. This token is then used to access protected routes or resources.
- JWT Implementation: Secure user authentication using JSON Web Tokens.
- Node.js Backend: Backend server built using Node.js for handling authentication and authorization.
- React Frontend: User interface developed with React and TypeScript for seamless interaction.
Throughout the development process, a few challenges were encountered, including:
- Cross-Origin Resource Sharing (CORS): Handling CORS issues when making requests from the frontend to the backend.
- Type Safety in Frontend: Ensuring type safety in the React components and handling TypeScript-specific issues.
To run this project locally, follow these steps:
- Node.js installed on your machine.
- Navigate to the
backend
directory. - Install dependencies using
npm install
. - Set up environment variables for database connection, JWT secret, etc.
- Start the server using
npm start
.
- Navigate to the
frontend
directory. - Install dependencies using
npm install
. - Configure backend API URL in the environment file.
- Start the frontend using
npm start
.
- Node.js: JavaScript runtime for building the backend server.
- React: JavaScript library for building the user interface.
- TypeScript: Superset of JavaScript providing static typing for enhanced code quality.
- JSON Web Tokens (JWT): Secure method for user authentication.
- Express: Web framework for Node.js backend.