This repository contains a user authorization application built with React, Node.js, TypeScript, and MySQL. It provides robust authentication and access control features, suitable for secure web applications.
You can install application manually or by using docker-compose.
If you prefer manual configuration without Docker, follow these steps:
- Node.js (v22+)
- MySQL database
- Any web server (for serving client side)
- npm or yarn package manager
-
Clone the repository:
git clone https://github.com/armanmartirosyan/react-node-login-api.git
-
Set up environment variables:
Create
.envfiles in the client and server directories of the project, using the provided.env-examplefiles as templates. Customize the values of the variables in each.envfile according to your environment and configuration needs. These environment variables are essential for configuring database connections, API keys, and other sensitive information required by the User Authorization application. -
Configure server-side:
Inside the
serverfolder install server-side dependencies listed in the package.json file and execute the database migrations.npm install && npm run migrate:latestBuild and start the application.
npm start
-
Configure client-side:
Inside the
clientfolder install the client-side dependencies listed in the package.json file.npm install
Serve the
client/distdirectory with a static file server or configure your web server to serve it. I usenginx, it's configuration file you can find inclient/confdirectory. -
Access the application
Open
http://localhost:<port>in your browser, where<port>is the port configured for your server.
If you prefer using Docker for a simplified setup, follow these steps:
- Docker
- Docker-Compose
-
Clone the repository:
git clone https://github.com/armanmartirosyan/react-node-login-api.git
-
Set up environment variables:
Create
.envfiles in the client and server directories of the project, using the provided.env-examplefiles as templates. Customize the values of the variables in each.envfile according to your environment and configuration needs. These environment variables are essential for configuring database connections, API keys, and other sensitive information required by the User Authorization application. -
Start Docker containers:
docker compose up -d
-
Access the application
Open
http://localhostin your browser.
-
Register:
- Navigate to the registration page.
- Enter your details including email and password.
- Submit the form.
- Check your email for a verification link.
-
Verify Email:
- Click on the verification link received in your email to verify your account.
- Upon successful verification, you can proceed to log in.
-
Log In:
- Navigate to the login page.
- Enter your registered email and password.
- Submit the form to log in to your account.
- Authenticated Users:
- Once logged in, authenticated users can access the list of all users.
- Users can view details such as usernames, emails, and other relevant information about registered users.
This usage guide outlines the primary functionalities of the User Authorization application, focusing on user registration, authentication, email verification, and accessing user information.
- Portainer Dashboard:
- If you are using Docker, you can manage Docker containers by accessing Portainer's web interface.
- Open a web browser and go to
http://localhost/portainer. - Log in to Portainer if required, and manage your Docker containers as needed.
This project is licensed under the MIT License - see the LICENSE file for details.