{"id":19820377,"url":"https://github.com/drcbeatz/ai_greeting_cards","last_synced_at":"2025-02-28T15:49:43.696Z","repository":{"id":247001075,"uuid":"822779324","full_name":"DrCBeatz/ai_greeting_cards","owner":"DrCBeatz","description":"A SaaS web app enabling users to create and share AI-generated greeting cards using DALL-E 3. Built with a scalable and secure backend on AWS. (Python/Django/HTMX/Postgres/Redis/Docker/AWS/Terraform)","archived":false,"fork":false,"pushed_at":"2024-10-21T01:23:56.000Z","size":1152,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T08:30:32.048Z","etag":null,"topics":["bem","celery","ci-cd","dall-e3","django","docker","ec2","github-actions","htmx","javascript","mdbootstrap","postgresql","pytest","python","rds","redis","s3","saas","stripe-checkout","terraform"],"latest_commit_sha":null,"homepage":"https://ai-greeting-cards.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DrCBeatz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security_groups.tf","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-01T20:02:38.000Z","updated_at":"2024-12-07T19:20:10.000Z","dependencies_parsed_at":"2024-10-21T02:28:07.917Z","dependency_job_id":null,"html_url":"https://github.com/DrCBeatz/ai_greeting_cards","commit_stats":null,"previous_names":["drcbeatz/ai_greeting_cards"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fai_greeting_cards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fai_greeting_cards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fai_greeting_cards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fai_greeting_cards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrCBeatz","download_url":"https://codeload.github.com/DrCBeatz/ai_greeting_cards/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241176618,"owners_count":19922732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bem","celery","ci-cd","dall-e3","django","docker","ec2","github-actions","htmx","javascript","mdbootstrap","postgresql","pytest","python","rds","redis","s3","saas","stripe-checkout","terraform"],"created_at":"2024-11-12T10:23:06.759Z","updated_at":"2025-02-28T15:49:43.664Z","avatar_url":"https://github.com/DrCBeatz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Greeting Card App\n\nAn AI-powered web application that generates personalized greeting cards using OpenAI's DALL-E 3 technology. Users can create custom images and send them via email. The app supports user authentication, payment processing for credits, and secure media storage with AWS S3.\n\n## Table of Contents\n\n- Features\n- Prerequisites\n- Installation\n- Configuration\n- Usage\n- Testing\n- Deployment\n- Technologies Used\n- Contributing\n- License\n- Contact\n\n## Features\n\n- AI Image Generation: Generate custom greeting card images using OpenAI's DALL-E 3 API.\n- User Authentication: Secure user registration and login system.\n- Payment Processing: Purchase credits using Stripe Checkout for generating images.\n- Email Integration: Send generated images via email to recipients.\n- Media Storage: Store images securely using AWS S3 buckets.\n- Security Enhancements: Implements Content Security Policy (CSP), Django-Axes for brute-force protection, and secure headers.\n- Asynchronous Tasks: Uses Celery and Redis for handling background tasks like image processing to accomodate multiple simultaneous users.\n\n## Prerequisites\n\n- Docker \u0026 Docker Compose: Ensure Docker and Docker Compose are installed on your machine.\n- AWS Account: For S3 bucket and access keys if you plan to enable S3 storage.\n- Stripe Account: For payment processing.\n- OpenAI API Key: Required for image generation.\n- Mailgun Account: For sending emails.\n\n## Installation\n\n### Clone the Repository\n\n```bash\ngit clone https://github.com/yourusername/aigreetingcard-app.git\ncd aigreetingcard-app\n```\n\n### Create .env file for Environment Variables\n\nCreate a .env file at the root of your project and populate it with the necessary environment variables below.\n\n#### General Settings\n\nDJANGO_SECRET_KEY=your_django_secret_key\nDJANGO_DEBUG=True\nDJANGO_ALLOWED_HOSTS=localhost,127.0.0.1\n\n#### Database Settings\n\nPOSTGRES_DB=your_db_name\nPOSTGRES_USER=your_db_user\nPOSTGRES_PASSWORD=your_db_password\nPOSTGRES_HOST=db\n\n#### Email Settings\n\nEMAIL_HOST=smtp.mailgun.org\nEMAIL_PORT=587\nEMAIL_HOST_USER=mailgun_email_address\nEMAIL_HOST_PASSWORD=mailgun_email_password\nDEFAULT_FROM_EMAIL=your_default_from_email\n\n#### OpenAI API Key\n\nOPENAI_API_KEY=your_openai_api_key\n\n#### Stripe Settings\n\nSTRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key\nSTRIPE_SECRET_KEY=your_stripe_secret_key\nSTRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret\n\n#### AWS S3 Settings (if using S3 for media storage)\n\nS3_BUCKET_ENABLED=True\nAWS_ACCESS_KEY_ID=your_aws_access_key_id\nAWS_SECRET_ACCESS_KEY=your_aws_secret_access_key\nAWS_STORAGE_BUCKET_NAME=your_s3_bucket_name\nAWS_S3_REGION_NAME=your_s3_region\n\n#### Security Settings\n\nDJANGO_SECURE_SSL_REDIRECT=False\nSECURE_PROXY_SSL_HEADER=http\nDJANGO_SECURE_HSTS_SECONDS=0\nDJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS=False\nDJANGO_SECURE_HSTS_PRELOAD=False\nDJANGO_SESSION_COOKIE_SECURE=False\nDJANGO_CSRF_COOKIE_SECURE=False\nDJANGO_SECURE_BROWSER_XSS_FILTER=False\nDJANGO_SECURE_CONTENT_TYPE_NOSNIFF=False\nDJANGO_SECURE_REFERRER_POLICY=same-origin\nCSP_ENABLED=False\nDJANGO_AXES_ENABLED=False\nLOGGING_ENABLED=True\n\n#### Celery Settings\n\nCELERY_BROKER_URL=redis://redis:6379/0\n\n#### Payment URLs\n\nBACKEND_DOMAIN=your_backend_domain\nPAYMENT_SUCCESS_URL=your_payment_success_url\nPAYMENT_CANCEL_URL=your_payment_cancel_url\nNote: Ensure you keep your secret keys secure and do not commit them to version control.\n\n## Usage\n\n### Build and Run Docker Containers\n\n```bash\ndocker-compose up --build\n```\n\n### Apply Migrations\n\nIn a new terminal window, run:\n\n```bash\ndocker-compose exec web python manage.py migrate\n```\n\n### Create a Superuser (Optional)\n\n```bash\ndocker-compose exec web python manage.py createsuperuser\n```\n\n### Collect Static Files\n\n```bash\ndocker-compose exec web python manage.py collectstatic --noinput\n```\n\n### Access the Application\n\nVisit http://localhost:8000 in your web browser.\n\n## Testing\n\n### Run tests using Pytest:\n\n```bash\ndocker-compose exec web pytest\n```\n\n## Deployment\n\nFor production deployment, you can use the provided docker-compose.prod.yml and Dockerfile.prod files. Ensure you set DJANGO_DEBUG=False and configure allowed hosts appropriately.\n\n## Example Deployment Steps:\n\n### Build the Production Image\n\n```bash\ndocker-compose -f docker-compose.prod.yml build\n```\n\n### Run the Containers\n\n```bash\ndocker-compose -f docker-compose.prod.yml up\n```\n\n### Apply Migrations and Collect Static Files\n\n```bash\ndocker-compose -f docker-compose.prod.yml exec web python manage.py migrate\ndocker-compose -f docker-compose.prod.yml exec web python manage.py collectstatic --noinput\n```\n\n## Technologies Used\n\n- Framework: Django 4.2\n- Frontend: HTML, CSS, Bootstrap 5, HTMX, Crispy Forms\n- Database: PostgreSQL\n- Asynchronous Tasks: Celery with Redis as broker and backend\n- Payments: Stripe Checkout\n- Email: SMTP via Mailgun (configurable)\n- Storage: AWS S3 for media files (optional)\n- Containerization: Docker \u0026 Docker Compose\n- Infrastructure as Code: Terraform files included for AWS resources\n- Security: Content Security Policy (CSP), Django-Axes for login attempt monitoring, Secure headers and SSL settings\n\n## File Structure Overview\n\n- core/: Django project settings and URLs.\n- accounts/: Custom user model and authentication.\n- aigreetingcards/: Main app for image generation.\n- payments/: Handles payment processing with Stripe.\n- templates/: HTML templates for rendering views.\n- static/: Static files (CSS, JS, images).\n- Dockerfile \u0026 docker-compose.yml: Configuration for Docker.\n- Terraform files: Infrastructure configuration for AWS services.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrcbeatz%2Fai_greeting_cards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrcbeatz%2Fai_greeting_cards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrcbeatz%2Fai_greeting_cards/lists"}