This repository showcases a simple Go Fiber application integrated with JWT (JSON Web Tokens) for authentication and MongoDB for data storage. The application is containerized using Docker for easy deployment.
- User authentication using JWT.
- CRUD (Create, Read, Update) operations with a MongoDB database.
- Docker setup for easy deployment and testing.
- Go - The programming language used.
- Fiber - A web framework for Go.
- MongoDB - A popular NoSQL database.
- JWT - JSON Web Tokens for secure communication.
- Docker - Containerization for easy deployment and testing.
- Install Go by following the official Go installation guide.
- Install Docker by following the official Docker installation guide.
- Download the MongoDB Docker image:
docker pull mongo
- Clone the repository:
git clone https://github.com/ZahidZafar/fiber-go-jwt-mongodb.git
cd your_repository
- Configure environment variables:
Create a
app.env
file in the project root and set the following variables:
MONGO_DB_URL=mongodb://your_mongo_url
TOKEN_SECRET_KEY=your_jwt_secret
ACCESS_TOKEN_DURATION=25m
TEMP_TOKEN_DURATION=1m
REFRESH_TOKEN_DURATION=24h
- Build go-app image:
docker build -t go-app:0.1 .
- Run the Docker container:
docker-compose -f docker-compose.yaml up
The application will be accessible at http://localhost:3000
.
Contributions are welcome! Feel free to open an issue or submit a pull request.