A Spring Boot application that generates QR codes and stores them in an AWS S3 bucket. The service provides public access URLs to the generated QR code images.
- ✅ Generate QR codes from text input
- ☁️ Upload and store QR code images to Amazon S3
- 🔗 Retrieve public URLs for each generated code
- 🛡️ Environment variable-based configuration for AWS credentials
- 🐳 Dockerized for easy deployment
- Java 21
- Spring Boot 3
- AWS SDK for Java (S3)
- Maven
- Docker
- Java 21+
- Maven
- Docker (optional for containerized run)
- AWS credentials (IAM user with S3 access)
- Clone the repository:
git clone https://github.com/buenolas/qrcode-generator.git
cd qrcode-generator- Set up the
.envfile (or export env vars):
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key
AWS_REGION=us-east-1
AWS_BUCKET_NAME=test-qrcode-storage-bueno
- Build the project:
mvn clean package- Run the application:
java -jar target/qrcode-generator-0.0.1-SNAPSHOT.jardocker build -t qrcode-generator:1.0 .
docker run --env-file .env -p 8080:8080 qrcode-generator:1.0| Method | Endpoint | Description |
|---|---|---|
| POST | /api/qrcode |
Generates a QR code from text and returns the URL |
POST /api/qrcode
Content-Type: application/json
{
"text": "https://example.com"
}{
"url": "https://test-qrcode-storage-bueno.s3.us-east-1.amazonaws.com/abcd1234.png"
}To allow the app to upload files to S3, your IAM user should have the following policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:GetObject", "s3:ListBucket"],
"Resource": [
"arn:aws:s3:::test-qrcode-storage-bueno",
"arn:aws:s3:::test-qrcode-storage-bueno/*"
]
}
]
}Make sure your AWS credentials are valid and have the correct permissions to access the bucket.
This project is licensed under the MIT License.