https://github.com/puskar-roy/secure-auth-system
A Secure account dashboard where users can log in, log out, and view their login history. Additionally, the system is support real-time monitoring of user activities, two-factor authentication (2FA) for enhanced security, and options for users to manage their devices.
https://github.com/puskar-roy/secure-auth-system
expressjs mongodb monorepo moongose nextjs14 nodejs nodemailer-smtp-transport turborepo typescript
Last synced: 7 months ago
JSON representation
A Secure account dashboard where users can log in, log out, and view their login history. Additionally, the system is support real-time monitoring of user activities, two-factor authentication (2FA) for enhanced security, and options for users to manage their devices.
- Host: GitHub
- URL: https://github.com/puskar-roy/secure-auth-system
- Owner: Puskar-Roy
- Created: 2024-05-02T06:15:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-07T18:28:38.000Z (over 1 year ago)
- Last Synced: 2025-01-16T19:51:49.446Z (9 months ago)
- Topics: expressjs, mongodb, monorepo, moongose, nextjs14, nodejs, nodemailer-smtp-transport, turborepo, typescript
- Language: TypeScript
- Homepage: https://myauthhub.vercel.app
- Size: 1.48 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
##### Note: _Please be aware that our API is currently deployed in the free tier. This means that your free instance will spin down due to inactivity, potentially causing delays of 50 seconds or more in request handling._

## Directory Structure π
_Just a quick note to let you know that this is a **Monorepo**, built with the Monorepo framework **Turborepo**. This means that it contains multiple packages or projects in a single repository, making it easier to manage and share code across different parts of the application._
```bash
Secure-Auth-System/
βββ turbo.json #Turborepo config
βββ pnpm-workspace.yaml (if using pnpm) #
βββ README.md # Project overview
βββ apps/ #Main Apps
β βββ web/ # Next Js Frontend
β β βββ public/ # Public assets
β β βββ src/ # Source code
β β
β βββ server/ # Node JsBackend
β # ... (similar structure For An API)
βββ packages/
β βββ ui(shared-components)/
β β βββ src/
β β βββ package.json
β βββ config/ # Example utility package
β βββ src/
β βββ package.json
βββ (Optional directories)
βββ docs/ # Project documentation
βββ .gitignore # Version control exclusions
```## Architecture Diagram π»
.png)
## All Features π
### 1. Role base Authentication (JWT, session-based)
#### Login Page
- Users can log in to their accounts using their credentials and OTP.



#### Register Page
- New users can create an account and verify his email to access the application.


### 2. Users Page
- Users can see all online users, see current device, manage all of his account and also signout from any device

- Users can view their Auth records.

- When a user is already logged in on one device, if someone logs in to another device using the same account credentials, we will send an email notification.

Note - _**When User Login or Logout UI will update autometic with the help of web sockets**_
### 3. Admin Panel
- Admins can view All User Details

- Admins can view and manage all users device and auth history

## Getting Started π
### Prerequisites
Before you begin contributing to this project, make sure you have the following set up:
- [Node.js](https://nodejs.org/): A JavaScript runtime.
- [npm](https://www.npmjs.com/): The Node.js package manager.### Run This β¨οΈ
1. **Clone the Repository:**
```bash
git clone https://github.com/Puskar-Roy/Secure-Auth-System
```
2. **Install Dependencies:**
```bash
npm install
```
3. **Add Environment Variables:**
```bash
cd apps/web touch .env
cd apps/server touch .env
```
4. **Add the necessary configuration:**```bash
#In apps/web Directory
NEXT_PUBLIC_BACKENDURL=http://localhost:5050#In apps/server Directory
PORT=5050
DEV_MODE=DEV #DEV or PROD
FRONTENDURL=http://localhost:3000
BACKENDURL=http://localhost:5050
JWT_SECRET=
JWT_COOKIE_EXPIRES_IN=3d
EMAIL= #For Nodemailer
PASSWORD= #For Nodemailer
MONGOURI=
```5. **Run This Project:**
```bash
npm run dev
```
### Run This Using Docker π
_Please note that the currently API can only be run using Docker. Make sure you have Docker installed_
1. **Move Into API Directory**
```bash
cd apps/server
```
2. **Build the Docker Image:**
```bash
docker build -t server .
```
3. **Run the Docker Image:**```bash
docker run -e add-environmental-variables -p 5050:5050 server
```
### Built With
This section highlights the key frameworks and libraries that form the foundation of your project. Below are some notable examples:
- **[](https://www.typescriptlang.org/):** A superset of JavaScript that adds static types.
- **[](https://developer.mozilla.org/en-US/docs/Web/JavaScript):** The programming language of
- **[](https://www.mongodb.com/):** The database for modern applications.
- **[](https://vercel.com/):** Cloud platform for serverless deployment and hosting.
- **[](https://eslint.org/):** Pluggable linting utility for identifying and fixing code issues.
- **[](https://prettier.io/):** Opinionated code formatter to ensure consistent code styling the web.## Contributing π
### Making Contributions
We welcome and appreciate contributions from the community β€οΈ! Here's how you can contribute:
- **Open Issues:** Check for open issues or create a new one to start discussions.
- **Fork the Repository:** Fork the project to your own GitHub account.
- **Create Pull Request:** Make changes in your fork and submit a pull request.### Welcome Contributors!
π Thank you for considering contributing to this project! Your involvement makes this template even better. Feel free to explore the code, share your ideas, and make improvements βοΈ.
π Don't hesitate to reach out if you have any questions or need assistance. Together, let's make this project amazing!π©
### Puskar RoyποΈ