Harness the power of Appwrite 1.4 with this repository, which contains enhanced serverless functions tailored for recipe generation and data management.
Demo: - Try out the demo!
- AI-Powered Recipes: Utilizes the OpenAI GPT-3.5-turbo model to dynamically generate unique recipes based on the ingredients you provide. It ensures that the output is not only relevant but also detailed, providing both ingredients and step-by-step instructions.
- Rate Limiting: Designed with protection mechanisms in mind, the function intelligently rate limits requests based on the IP address of the requester, ensuring fair usage and preventing abuse.
- Email Notifications: Optionally, once a recipe is generated, it can be sent directly to an email address provided in the request. This feature is particularly useful if you wish to share the recipe or save it for later use.
- Efficient Cleanup: This function is your go-to solution for maintaining a clean slate in your Appwrite collection. It methodically traverses the specified collection and deletes all entries, effectively resetting the data.
- Regular Maintenance: Ideal for periodic data resets or cleanups. For example, if you're running a demo or test environment where you wish to purge data at regular intervals, this function is a perfect fit.
- Brand Consistency: With Appwrite 1.4, each function can be assigned its unique domain. By setting up a custom domain for your functions, you maintain brand consistency and provide a more professional appearance to your users.
- Enhanced Security: Using a custom domain often allows for better security practices, especially if combined with SSL certificates, ensuring that the data between the client and server remains encrypted and secure.
- Appwrite 1.4 or later.
- OpenAI account with API key for the GPT-3.5-turbo model.
- SMTP server for sending emails.
- A custom domain (if you wish to leverage the custom domain feature).
- Environment Variables:
- SMTP related (
APP_SMTP_HOST
,APP_SMTP_PORT
,APP_SMTP_USERNAME
,APP_SMTP_PASSWORD
). - Appwrite related (
APPWRITE_FUNCTION_PROJECT_ID
,APPWRITE_API_KEY
,APP_DATABASE
,APP_COLLECTION
). - OpenAI (
OPENAI_API_KEY
).
- SMTP related (
- Deploying the Function:
- Use the Appwrite Console or CLI to deploy the function.
- With Appwrite 1.4, link your GitHub repository for seamless deployments!
- Setting Up CRON (Optional):
- For periodic execution of the data cleanup function, set a CRON job.
- For execution every minute:
* * * * *
.
- Custom Domain Setup:
- Configure your custom domain within Appwrite to point to your function. Ensure that you have an SSL certificate if you wish to serve over HTTPS.
- Recipe Generator:
- POST request to the function's endpoint.
- Include
ipAddress
,email
(optional), andprompts
(ingredient list) in the body.
- Data Cleanup:
- Trigger the function to purge all documents in the specified collection.
Your feedback is invaluable! Issues, pull requests, or feedback about the functions are welcome.
Happy Coding! 🎉