Image Generator API using Dall-E, Spring boot + Spring Security & Json Web Token
Report Bug
.
Request Feature
This project is created using Java Spring framework and OpenAI Dall-E API to generate image.
This project use Spring Security to authenticate users using Json Web Token. The users are pre-registred in a Postgresql database.
It also uses AWS S3 to store the generated images.
At creation, the registered user has 1 credit. Each time he generates an image, he loses 1 credit. but there is an option to refill the credits by paying with Stripe.
To get a local copy up and running follow these simple example steps.
-
Get an API Key at [https://openai.com/]
-
Configure AWS S3 and create a bucket. You will need the access key and secret key.
-
Create a Stripe account and get the secret key.
-
Create a Postgresql database.
-
Clone the repo
git clone https://github.com/manesjonathan/image-generator.git
- Enter your database credentials and OpenAI API key in
application.properties
spring.jpa.database=POSTGRESQL
spring.sql.init.platform=postgres
spring.datasource.url=jdbc:postgresql://[YOUR_URL]/[DB_NAME]
spring.datasource.username=[DB_USERNAME]
spring.datasource.password=[DB_PASSWORD]
spring.jpa.hibernate.ddl-auto=update
app.jwt.secret=[PASSWORD_FOR_JWT]
app.openai.api=[OPENAI_API_KEY]
aws.access.key=[AWS_ACCESS_KEY]
aws.secret.key=[AWS_SECRET_KEY]
stripe.secret.key=[STRIPE_SECRET_KEY]
custom.admin.email=[ADMIN_EMAIL]
-
Update the Stripe webhook in your Stripe account. If you run locally, you can use ngrok to create a public URL for your localhost.
-
Run the project
The following features are planned for the next release:
- Add a feature to rate the generated images
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
- Jonathan Manes - Full Stack Developer