Skip to content

Minyeng/go-auth-jwt

Repository files navigation

Go Auth with JWT

A fast, lightweight, and secure JWT authentication service built using Go, MySQL, and Docker

Ideal for developers who want a quick and secure way to implement user authentication in their apps. With Docker containerization, this service is also easily deployable and scalable for modern applications.

⚙️ Tech Stack

  • GO:1.23.4 (Gofiber v2, GORM)
  • MySQL:8.0.30 (Database)
  • Docker (Containerization)

📦 Getting Started

Prerequisites

  • Docker: Make sure Docker is installed and running.
  • MySQL: MySQL should be configured (will run in a Docker container).

Clone the repository

  git clone https://github.com/your-username/go-auth-jwt.git
  cd go-auth-jwt

Docker Setup

  1. Build the Docker container:
      docker build --tag go_auth_jwt:1.0 .
    
  2. Start the application:
      docker compose up -d
    
  3. The app will now be accessible on http://localhost:9000.

Database Configuration

  • The MySQL database will run in a Docker container and will be automatically configured on startup.
  • You might migrate your DB by accessing the MySQL database on localhost:3306 with the credentials set in the docker-compose.yml file.

🌐 API Endpoints

###
POST http://localhost:9000/signup HTTP/1.1
Content-Type: application/json
{
    "name": "fulan",
    "email": "ful@n.com",
    "password": "123456"
}

###
POST http://localhost:9000/login HTTP/1.1
Content-Type: application/json

{
    "email": "ful@n.com",
    "password": "123456"
}

###
GET http://localhost:9000/private HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzY5MDUxMTgsInVzZXJfaWQiOjE0fQ.CSH6gkLwnDVVa_9bYk43bOTFnTxPSm6c6OeKzR8sg_s

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors