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.
- GO:1.23.4 (Gofiber v2, GORM)
- MySQL:8.0.30 (Database)
- Docker (Containerization)
- Docker: Make sure Docker is installed and running.
- MySQL: MySQL should be configured (will run in a Docker container).
git clone https://github.com/your-username/go-auth-jwt.git cd go-auth-jwt
-
Build the Docker container:
docker build --tag go_auth_jwt:1.0 .
-
Start the application:
docker compose up -d
- The app will now be accessible on
http://localhost:9000.
- 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:3306with the credentials set in thedocker-compose.ymlfile.
###
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