Skip to content

A clean and modular JWT authentication template built with TypeScript, Express, and MongoDB. Perfect for starting secure backend APIs.

Notifications You must be signed in to change notification settings

sambhandavale/jwt-auth-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 JWT Authentication Template (TypeScript + Express)

A clean and modular starter template for building secure authentication APIs using Node.js, Express, TypeScript, and JWT (JSON Web Tokens).

📂 Project Structure

├── config/         # Database & environment configurations
├── controllers/    # Authentication and user controllers
├── models/         # Database models (e.g., User schema)
├── routes/         # Route definitions for authentication
├── App.ts          # Main application entry point
├── package.json    # Project dependencies
├── tsconfig.json   # TypeScript configuration
└── .gitignore

⚙️ Features

  • 🔑 JWT-based authentication (login, register, verify)
  • 🧱 Modular folder structure
  • 🛡️ Secure password hashing with bcrypt
  • 🌐 Environment variable support via dotenv
  • 💡 Written fully in TypeScript
  • 🧩 Ready to integrate with MongoDB or any database

🚀 Getting Started

1️⃣ Clone the repo

git clone https://github.com/<your-username>/<repo-name>.git
cd <repo-name>

2️⃣ Install dependencies

npm install

3️⃣ Add environment variables

Create a .env file in the root directory:

PORT=6000
MONGODB_URI=your_mongo_uri
JWT_SECRET=your_secret_key

4️⃣ Run the server

npm start

Server will start on: 👉 http://localhost:6000

🧠 Tech Stack

  • Node.js
  • Express.js
  • TypeScript
  • MongoDB
  • JWT
  • bcrypt

📜 License

This project is open-source and available under the MIT License.

About

A clean and modular JWT authentication template built with TypeScript, Express, and MongoDB. Perfect for starting secure backend APIs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published