Skip to content

manupanand-freelance-developer/go-fiber-user-auth-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Fiber User Auth Platform (Go + Fiber)

A fast and lightweight user authentication platform built with Go Fiber, supporting:

  • πŸ” User Signup & Login
  • βœ… OTP-based User Verification via SMS
  • πŸ§‘β€πŸ’Ό Role management for Buyer/Seller

πŸ“¦ Features

  • πŸ“ User Signup with email, password, and phone number
  • πŸ”‘ Secure Login with hashed passwords (bcrypt)
  • πŸ“² OTP Verification (via SMS API like Twilio)
  • πŸ‘₯ Role Assignment: Users can become Buyers or Sellers
  • 🧾 Basic JWT-based session/token support
  • πŸ§ͺ Structured modular code for extensibility

🧱 Tech Stack

  • Go (Golang) – Language
  • Fiber – Fast HTTP web framework
  • GORM – ORM for PostgreSQL/MySQL (optional)
  • JWT – JSON Web Tokens for auth
  • Bcrypt – Password hashing
  • SMS Gateway API – For OTP delivery (e.g., Twilio, Fast2SMS)

πŸ“ Project Structure

go-fiber-user-auth-microservice/
β”œβ”€β”€ main.go
β”œβ”€β”€ model/
β”‚ └── user.go
β”œβ”€β”€ handler/
β”‚ └── auth.go
β”œβ”€β”€ routes/
β”‚ └── routes.go
β”œβ”€β”€ utils/
β”‚ β”œβ”€β”€ jwt.go
β”‚ └── otp.go
β”œβ”€β”€ config/
β”‚ └── db.go
└── go.mod```


---

## πŸš€ Getting Started

### 1. Clone the Repo
```bash
git clone https://github.com/manupanand-freelence-developer/go-fiber-user-auth-microservice.git
cd go-fiber-user-auth-microservice

2. Initialize Go Modules

go mod tidy

3. Run the App

go run main.go

πŸ› οΈ Environment Variables (or .env)

PORT=3000
JWT_SECRET=supersecretkey
DB_URL=postgres://user:pass@localhost:5432/mydb
SMS_API_KEY=your_sms_api_key

Use godotenv if needed for .env loading.
πŸ” API Endpoints (Planned)
Method	Endpoint	Description
POST	/signup	Register new user
POST	/login	Login user and get token
POST	/verify	Verify OTP sent via SMS
POST	/role/buyer	Set user as buyer
POST	/role/seller	Set user as seller
πŸ§ͺ Future Enhancements

    Email + SMS fallback OTP support

    Admin role and dashboard

    Password reset via OTP

    Rate limiting and brute-force protection



MIT License Β© 2025 [Manu P Anand]
πŸ’¬ Contact

[www.linkedin.co.in.manupanand]

About

go fiber user authentication microservice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published