A Spring Boot application that generates essays and blog posts using AI models (OpenAI GPT-4 and Anthropic Claude).
- Essay generation using AI models
- Rate limiting for API endpoints
- Secure configuration management
- PostgreSQL database integration
- RESTful API endpoints
- Swagger/OpenAPI documentation
- Java 17 or higher
- Maven
- PostgreSQL
- OpenAI API key
- Anthropic API key
Create a .env file in the root directory with the following variables:
DB_URL=jdbc:postgresql://localhost:5432/essaydb
DB_USERNAME=your_username
DB_PASSWORD=your_secure_password
OPENAI_API_KEY=your_openai_key
OPENAI_MODEL=gpt-4
ANTHROPIC_API_KEY=your_anthropic_key
ANTHROPIC_MODEL=claude-3mvn clean installmvn spring-boot:runThe application will start on port 8080.
Once the application is running, you can access the Swagger UI at:
http://localhost:8080/swagger-ui.html
POST /api/essay
Content-Type: application/json
{
"topic": "Your essay topic",
"additionalContext": "Optional additional context"
}
The API is rate-limited to 10 requests per minute per IP address.
- All sensitive configuration is managed through environment variables
- Input validation on all endpoints
- Rate limiting to prevent abuse
- Secure database configuration
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.