This project is meant to serve as a template for applications that may require simple login functionality and a database to store the information securely. It uses hashing to encrypt passwords and stores them into a postgresql database, but using JWT authentication would be more secure. I would recommend improving upon the template instead of using it directly as is.
I made this originaly for myself to have a template that I can use whenever I want to create a software that needs login functionality and a good framework for frontend.
Before you start, ensure you have the following installed on your machine:
- Node.js (latest LTS version)
- npm (Node package manager)
- Docker (for containerization)
To get started with the application, follow these steps to install the necessary dependencies:
-
Clone the repository:
git clone https://github.com/ottototto/NextExpressAuth.git cd nextexpressauth
-
Install dependencies for both frontend and backend:
cd frontend && npm install cd ../backend && npm install cd ..
To start the frontend development server, execute the following commands:
cd frontend && npm run dev
To start the backend server and the database, use Docker Compose and then run the server:
cd ../backend && docker-compose up -d && node server.js
Once both servers are running, open http://localhost:3000 in your browser to view the application.
- HTTP-Only Cookies
- JWT Authentication
- Session-based authentication
- Clean useless packages
- Refactor code