Skip to content

ayusharma-ctrl/AuthFlowTs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Fullstack Authentication Boilerplate

A full-stack web application that provides user authentication with JWT-based cookie authentication, real-time validation, and an enhanced user experience. It can be used as a template to quickly start new projects without setting up authentication from scratch.

🚀 Features

User Authentication (Signup, Login, Logout)
Sign in with either Username or Email
JWT Token Authentication (Cookie-based)
Remember Me (Store token locally for persistent login)
Real-time Form Validation (Ensuring proper inputs)
Responsive UI (Mobile-first approach with Tailwind CSS)
Real-time Notifications (Accurate error messages & feedback)
Rate Limiting (Using express-rate-limit for security)
Backend Validation & Error Handling
Middleware Support (For protected routes & auth checks)
Confetti for Great UX 🎉
Docker Support (Easy setup with docker-compose)
Production-ready Template (Quickly start new projects)


🛠 Tech Stack

Backend:

  • Node.js + Express.js
  • TypeScript
  • MongoDB Atlas (Cloud database)
  • JWT Authentication
  • Rate Limiting (Prevent brute force attacks)

Frontend:

  • React (with Hooks)
  • Vite (Fast development build tool)
  • TypeScript
  • Tailwind CSS (Modern styling)
  • Redux Toolkit (State management)
  • Confetti & Toast Notifications (For better UX)

📌 Setup Instructions

1️⃣ Clone the Repository

git clone https://github.com/ayusharma-ctrl/AuthFlowTs

cd AuthFlowTs

2️⃣ Add Environment Variables

Both frontend and backend require .env files. Sample files (.env.example) are provided for reference.


⚡ Running the App

There are two ways to run the app:

Option 1: Manually Installing Dependencies

For the Backend:

cd server
npm install
npm run dev

For the Frontend:

cd client
npm install
npm run dev

Option 2: Docker

You can use Docker to run both services easily with Docker Compose.

docker-compose up --build

To stop the containers, run:

docker-compose down

Your application will be available at:

🔥 API Endpoints

Authentication APIs

Method Endpoint Description
POST /api/v1/auth/signup User Registration
POST /api/v1/auth/signin User Login
POST /api/v1/auth/signout User Logout

Protected Routes (Require Auth)

Method Endpoint Description
GET /api/v1/user Get User Details

Public Test Route

Method Endpoint Description
GET / Test API Response

🔒 Security Measures

  • JWT Token Authentication (Cookie-based)
  • Rate Limiting (Prevent brute force attacks)
  • Secure Password Storage (Using bcrypt)
  • Proper Input Validation (Prevent SQL Injection & XSS)

🚀 Ready to Use?

Clone the repo and start building your next project without worrying about authentication setup! 🎉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published