← Work

Nov 2023 – Mar 2024 · 4 months

AI Cards Platform

Built sharing features, admin dashboard, and usage analytics for an AI-powered e-card platform — users describe cards via chat, GPT-4 parses intent, DALL-E 3 generates images.

35
commits
16%
of codebase
4 mo
duration
8
features delivered
LaravelLivewireGPT-4DALL-EAdminLTEMailgunAlpine.js

Overview

AI Cards is an AI-powered e-card generation platform. Users describe their desired card design through conversation, the system uses GPT-4 to parse requirements, then generates custom images via DALL-E 3. I built the admin management system, sharing features, and analytics dashboard.

What I Built

Admin Card Management (Nov–Dec 2023)

  • Built complete CRUD interface for card management
  • Design management page displaying chat history
  • Updated backend code and breadcrumbs after table rename (cards → designs)

Multi-channel Sharing (Dec 2023)

  • Implemented Email, LINE, and URL sharing methods
  • Used SweetAlert for share modal interface
  • Integrated Mailgun for email delivery
  • LINE Share with default message templates

User Privacy Verification (Dec 2023)

  • Required email and terms agreement before sharing
  • Added email and terms_agreed fields to designs table
  • Implemented frontend validation and backend persistence

OpenAI Usage Dashboard (Dec 2023)

  • Built admin dashboard displaying OpenAI API usage statistics
  • Fixed usage chart calculation errors
  • Improved chart visualization for better readability

Scheduled Task: Auto Cleanup (Dec 2023)

  • Developed scheduled task to clean up empty design records
  • Fixed cleanup logic: added has('images')->orHas('cards') condition to prevent deleting valid data

Model Version Upgrade (Mar 2024)

  • Upgraded GPT-4 to GPT-4 Turbo (gpt-4-0125-preview) for faster responses and lower costs

Architecture Decisions

Pre-share Verification Flow

Originally sharing was open without restrictions. To collect user information and comply with privacy regulations, redesigned the flow: users must enter their email and agree to terms before the share button becomes active. Used Livewire for real-time validation, auto-saving to database upon completion.

Empty Design Cleanup Strategy

The system generates many incomplete design records (users enter the page but don't finish creating). Designed a scheduled task to periodically clean these records, but excludes designs with associated images or cards to avoid deleting works in progress.

Key Bug Fix: Usage Chart Calculation Error

Problem: Dashboard's OpenAI usage chart showed incorrect data — the statistics logic wasn't properly aggregating token usage across models.

Fix: Reviewed DashboardController's query logic, fixed activity_log groupBy conditions, and changed chart type from bar to line for clearer usage trend visualization.

Other Contributions

  • Fixed design showpage display issues and added hover effects to card index
  • Fixed email share content formatting
  • Fixed cardUrl generation logic error
  • Fixed Dashboard routing path configuration

Reflection

Building the sharing feature taught me that "just a share button" evolves into a complete verification → agreement → share flow. Feature design needs to consider business requirements (collecting user emails) and regulatory compliance (privacy terms). Planning for these upfront reduces rework later.