Skip to content

devadedejimike/Auth-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Auth API

A secure and modular Authentication API built with Express.js, TypeScript, and MongoDB.
It handles user registration, login, and JWT-based authentication for protecting API routes.


πŸ› οΈ Tech Stack

🟦 TypeScript Β Β  βš™οΈ Express.js Β Β  πŸƒ MongoDB Β Β  🟒 Node.js Β Β  πŸ”‘ JWT


πŸ“ Project Structure

auth-api/ ┣ src/ ┃ ┣ controllers/ ┃ ┣ middlewares/ ┃ ┣ models/ ┃ ┣ routes/ ┃ β”— index.ts ┣ .env ┣ .gitignore ┣ package.json ┣ tsconfig.json β”— README.md

yaml Copy code


πŸš€ Features

  • 🧾 User Registration (sign up with validation)
  • πŸ” Login with JWT (JSON Web Token authentication)
  • πŸ”‘ Protected Routes for authenticated users only
  • 🧩 TypeScript support for better type safety
  • βš™οΈ Modular and scalable folder structure

βš™οΈ Installation & Setup

  1. Clone the repository
    git clone https://github.com/<your-username>/auth-api.git
    cd auth-api

Install dependencies

bash Copy code npm install Create a .env file and add your environment variables:

ini Copy code MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key PORT=5000 Compile TypeScript

bash Copy code npm run build Run the server

bash Copy code npm run dev πŸ“¬ API Endpoints Method Endpoint Description POST /api/auth/register Register a new user POST /api/auth/login Log in a user GET /api/auth/profile Get user profile (protected route)

🧠 Learning Focus This project helps reinforce:

Authentication and authorization with JWT

Using bcrypt for password hashing

Writing clean middleware for route protection

TypeScript and Express integration

Secure environment configuration

πŸ‘¨β€πŸ’» Author devadedejimike(Adeyemi Adedeji Michael)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published