Skip to content

Latest commit

 

History

666 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Service

CI Go Docker Traefik Swagger

A Go service for user authentication and profile management. It provides OTP-based sign-up and login, JWT-protected profile endpoints, database migrations, Traefik routing, and Swagger API documentation.

Highlights

  • OTP-based sign-up, login, and verification
  • JWT-protected profile operations
  • Database migration command
  • Docker-based development workflow
  • Traefik reverse-proxy integration
  • Interactive Swagger documentation

Getting started

Start the service in development mode:

make start-user-app-dev

Apply database migrations inside the running container:

docker exec -it beehive-user-service-1 sh -c "go run cmd/user/main.go migrate --up"

Swagger UI is available at:

http://beehive.local/users/v1/swagger/index.html

API examples

Sign up

curl --location 'http://beehive.local/users/v1/users/signup' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "example-user",
    "phone_number": "09120000000"
  }'

If the user already exists, an OTP code is sent to the supplied number.

Request a login OTP

curl --location 'http://beehive.local/users/v1/users/login' \
  --header 'Content-Type: application/json' \
  --data '{
    "phone_number": "09120000000"
  }'

Verify the OTP

curl --location 'http://beehive.local/users/v1/users/verify/otp' \
  --header 'Content-Type: application/json' \
  --data '{
    "phone_number": "09120000000",
    "otp_code": 12345
  }'

Update a profile

curl --location --request PUT 'http://beehive.local/users/v1/users/profile' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <your-jwt-token>' \
  --data '{
    "name": "updated-user"
  }'

View a profile

curl --location 'http://beehive.local/users/v1/users/profile' \
  --header 'Authorization: Bearer <your-jwt-token>'

Repository structure

  • cmd/ - application entry points and commands
  • adapter/ - external adapters
  • userapp/ - user-service application code
  • deploy/ - deployment configuration
  • docs/ - generated API documentation
  • pkg/ - shared packages

Security note

All credentials, tokens, OTP values, and phone numbers shown above are placeholders. Never commit real secrets or personal data.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages