Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DalaScript/fullstack-auth-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

Fullstack Auth App - User Authentication System

πŸš€ Overview

A simple fullstack authentication system with JWT-based login, MongoDB user storage, and a protected dashboard route.
Built for learning, testing, and extending real-world auth flows in fullstack applications. πŸ”

This project includes a React frontend, Node.js backend, and MongoDB database connection.


πŸ“Œ Features

  • πŸ” User Registration & Login
  • πŸ”‘ Password hashing with bcrypt
  • πŸ“¦ Token-based authentication with JWT
  • πŸ” Protected routes (Dashboard)
  • πŸšͺ Logout functionality
  • πŸ“ Organized code structure for scalability
  • πŸ§ͺ Tested via Postman

πŸ“¦ Setup & Installation

1️⃣ Clone the Repository

git clone https://github.com/DalaScript/fullstack-auth-app.git
cd fullstack-auth-app

2️⃣ Install Dependencies

Backend:

cd server
npm install

Frontend:

cd ../client
npm install

3️⃣ Configure Environment Variables

In the server/ folder, create a .env file and add:

PORT=5000
MONGO_URI=your_mongodb_connection_string
DB_NAME=your_database_name
JWT_SECRET=your_secret_key

πŸ”₯ You can change the port or JWT secret as needed.

4️⃣ Start the Server

Backend:

npm start

Frontend (React App):

cd ../client
npm start

πŸ“‘ API Endpoints

πŸ”Ή POST /api/register

Registers a new user.

Request Body:

{
 "email": "user@example.com",
 "password": "yourpassword"
}

πŸ”Ή POST /api/login

Logs in a user and returns a token.

Request Body:

{
 "email": "user@example.com",
 "password": "yourpassword"
}

Response:

{
 "token": "jwt-token"
}

Token is stored in localStorage on the client side.


βš™οΈ Additional Features

  • Frontend redirect logic based on auth status
  • Token stored securely in localStorage
  • Clean and minimalistic UI

πŸ› οΈ Technologies Used

Frontend:

  • React
  • React Router DOM

Backend:

  • Node.js
  • MongoDB
  • bcryptjs
  • jsonwebtoken

🎯 Next Steps

  • βœ… Add user-specific content after login (e.g., profile, settings)
  • πŸ“„ Implement server-side token validation middleware
  • 🌐 Form validations & error handling improvements
  • πŸ“¬ Add forgot password and reset functionality

🀝 Contributing

Feel free to fork and submit issues!

Created by DalaScript πŸ’»


Author

Connect with Me

Coding Profiles

Releases

No releases published

Packages

Contributors

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /