GitHub - KrishNatrium/AuthDemo · GitHub
Skip to content

KrishNatrium/AuthDemo

Repository files navigation

🔐 AuthDemo – Spring Boot + MySQL + JWT Authentication

A simple and secure backend system for user registration and login, built as part of a backend internship challenge.


📌 Features

  • User Registration with Full Name, Email, and Password
  • Secure Login with password hashing (BCrypt)
  • JWT-based Authentication
  • Stateless security using Spring Security
  • MySQL Database integration
  • Input validation and error handling

🧰 Tech Stack

  • Language: Java 21
  • Framework: Spring Boot
  • Security: Spring Security + JWT (jjwt)
  • Database: MySQL
  • ORM: Spring Data JPA + Hibernate
  • Build Tool: Maven
  • API Testing: Postman

🛠️ Setup Instructions

✅ Prerequisites

  • Java 21+
  • Maven
  • MySQL
  • IDE (e.g. IntelliJ)
  • Postman (for testing)

🧑‍💻 Steps

  1. Clone the repository

    git clone https://github.com/KrishNatrium/AuthDemo.git
    cd authdemo
    
  2. Create MySQL Database

    CREATE DATABASE authdb;
  3. Update application.properties

    spring.datasource.username=your_mysql_user
    spring.datasource.password=your_mysql_password
    
  4. Run the Application

    • Open in IntelliJ
    • Run DemoApplication.java
    • App runs at: http://localhost:9090

📬 API Endpoints

🔸 Register

POST /api/auth/register

Request Body:

{
  "fullName": "Krishna Gopal Kar",
  "email": "krishna@example.com",
  "password": "password123"
}

Returns: JWT token


🔸 Login

POST /api/auth/login

Request Body:

{
  "email": "krishna@example.com",
  "password": "password123"
}

Returns: JWT token


🧪 Sample Test Credentials

You can register any credentials, but here's one:

Email Password
krishna@example.com password123

✅ Optional Enhancements

  • Protected routes (e.g. /api/user/me)
  • Docker Support
  • Role-based authorization

👤 Author

Krishna Gopal Kar B.Tech CSE | KIIT DU LinkedIn GitHub


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages