feat(db): implement complete database schema and models
- Add Prisma schema with PostgreSQL 15 support - Create Users, Batches, Images, Payments, ApiKeys tables - Implement proper foreign key relationships and indexes - Add enum types for status fields (Plan, BatchStatus, ImageStatus, PaymentStatus) - Support for JSON fields (vision_tags, metadata) - UUID primary keys for security - Created/updated timestamps with proper defaults Database Layer Components: - Prisma service with connection management and health checks - Repository pattern for all entities with comprehensive CRUD operations - TypeScript DTOs with class-validator decorations - Swagger API documentation annotations - Helper functions for business logic (quota management, pricing, etc.) Development Support: - Environment variables template - Database seed script with realistic test data - TypeScript configuration optimized for Nest.js - Package.json with all required dependencies Resolves database requirements from issues §78-81 establishing the complete data layer foundation for the AI Bulk Image Renamer SaaS. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
90016254a9
commit
e7e09d5e2c
15 changed files with 3606 additions and 0 deletions
51
packages/api/.env.example
Normal file
51
packages/api/.env.example
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Database
|
||||
DATABASE_URL="postgresql://username:password@localhost:5432/seo_image_renamer?schema=public"
|
||||
|
||||
# Application
|
||||
NODE_ENV="development"
|
||||
PORT=3001
|
||||
API_PREFIX="api/v1"
|
||||
|
||||
# JWT Configuration
|
||||
JWT_SECRET="your-super-secret-jwt-key-here"
|
||||
JWT_EXPIRES_IN="7d"
|
||||
|
||||
# Google OAuth
|
||||
GOOGLE_CLIENT_ID="your-google-client-id"
|
||||
GOOGLE_CLIENT_SECRET="your-google-client-secret"
|
||||
GOOGLE_REDIRECT_URI="http://localhost:3001/api/v1/auth/google/callback"
|
||||
|
||||
# Stripe Configuration
|
||||
STRIPE_SECRET_KEY="sk_test_your_stripe_secret_key"
|
||||
STRIPE_PUBLISHABLE_KEY="pk_test_your_stripe_publishable_key"
|
||||
STRIPE_WEBHOOK_SECRET="whsec_your_stripe_webhook_secret"
|
||||
|
||||
# AWS S3 Configuration
|
||||
AWS_ACCESS_KEY_ID="your-aws-access-key"
|
||||
AWS_SECRET_ACCESS_KEY="your-aws-secret-key"
|
||||
AWS_REGION="us-east-1"
|
||||
AWS_S3_BUCKET="seo-image-renamer-uploads"
|
||||
|
||||
# OpenAI Configuration
|
||||
OPENAI_API_KEY="sk-your-openai-api-key"
|
||||
OPENAI_MODEL="gpt-4-vision-preview"
|
||||
|
||||
# Frontend URL (for CORS)
|
||||
FRONTEND_URL="http://localhost:3000"
|
||||
|
||||
# Redis (for caching and queues)
|
||||
REDIS_URL="redis://localhost:6379"
|
||||
|
||||
# Email Configuration (optional)
|
||||
SMTP_HOST="smtp.gmail.com"
|
||||
SMTP_PORT=587
|
||||
SMTP_USER="your-email@gmail.com"
|
||||
SMTP_PASS="your-email-password"
|
||||
FROM_EMAIL="noreply@seo-image-renamer.com"
|
||||
|
||||
# Monitoring (optional)
|
||||
SENTRY_DSN="https://your-sentry-dsn"
|
||||
|
||||
# Rate Limiting
|
||||
RATE_LIMIT_TTL=60
|
||||
RATE_LIMIT_LIMIT=10
|
Loading…
Add table
Add a link
Reference in a new issue