Loading repository data…
Loading repository data…
APerlinx / repository
Frontend for chatSVG (https://chatsvg.dev) — a React + TypeScript app for AI-powered SVG generation with real-time job progress (Socket.IO), authenticated sessions, and secure S3 signed-URL downloads. Includes Playwright E2E tests, Sentry monitoring, and CI automation.
Frontend for chatSVG (https://chatsvg.dev) — a React + TypeScript app for AI-powered SVG generation with real-time job progress (Socket.IO), authenticated sessions, and secure S3 signed-URL downloads. Includes Playwright E2E tests, Sentry monitoring, and CI automation.
git clone https://github.com/APerlinx/svg-saas-client.git
cd svg-saas-client
npm install
Copy the example environment file:
cp .env.example .env
Configure your .env:
# Backend API URL
VITE_API_BASE_URL="http://localhost:4000/api"
# PayPal client ID (sandbox for dev, live for production)
VITE_PAYPAL_CLIENT_ID="your-paypal-client-id"
# Sentry error tracking (optional - production only)
# VITE_SENTRY_DSN="your-sentry-dsn-here"
npm run dev
The app will be available at http://localhost:5173
This repository contains the frontend only. Backend/infrastructure details live in the server repository.
npm run dev # Start dev server with hot reload
npm run build # Build for production
npm run preview # Preview production build locally
npm run test # Run unit tests
npm run test:ui # Open Vitest UI
npm run test:e2e # Run Playwright E2E tests
npm run test:e2e:ui # Open Playwright UI mode
npm run lint # Check code quality
npm run type-check # Run TypeScript compiler check
client/
├── .github/
│ └── workflows/
│ └── playwright.yml # CI/CD pipeline
├── docs/
│ ├── AGENTS.md # AI agent reference guide
│ ├── FRONTEND_ARCHITECTURE.md # Architecture and flows
│ ├── NOTIFICATIONS.md # Notifications feature docs
│ ├── SENTRY_SETUP.md # Error tracking guide
│ └── SENTRY_IMPLEMENTATION.md
├── public/ # Static assets
├── src/
│ ├── assets/ # SVG icons and images
│ │ └── Dashboard-background/
│ ├── components/ # Reusable components
│ │ ├── auth/ # Auth-related components
│ │ ├── icons/ # Icon components
│ │ ├── modal/ # Modal components
│ │ └── ui/ # UI primitives
│ ├── constants/ # App constants
│ │ ├── models.ts # AI model definitions
│ │ └── svgStyles.ts # SVG style options
│ ├── context/ # React Context providers
│ │ ├── AuthContext.tsx
│ │ ├── AuthProvider.tsx
│ │ └── ToastProvider.tsx
│ ├── hooks/ # Custom React hooks
│ ├── pages/ # Route pages
│ │ ├── auth/ # Auth pages
│ │ ├── Dashboard.tsx
│ │ ├── Gallery.tsx
│ │ └── Pricing.tsx
│ ├── routes/ # Route configuration
│ ├── services/ # API services
│ │ ├── authService.ts
│ │ ├── svgService.ts
│ │ ├── paypalService.ts # PayPal subscription API
│ │ ├── csrfInterceptor.ts
│ │ └── logger.ts # Sentry integration
│ ├── types/ # TypeScript types
│ ├── utils/ # Utility functions
│ ├── App.tsx # Root component
│ ├── main.tsx # Entry point
│ └── index.css # Global styles
├── tests/ # E2E test specs
├── playwright.config.ts # Playwright configuration
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript config
└── package.json
// Users can generate SVGs with:
- Custom prompts (min 10 characters)
- Multiple AI models (GPT-4o, GPT-5)
- Style presets (minimal, flat, isometric, etc.)
- Privacy controls (public/private)
- Async job processing with BullMQ
- Real-time progress updates (QUEUED → RUNNING → SUCCEEDED/FAILED)
- Live progress via WebSockets (Socket.IO)
- Idempotency keys to prevent duplicate submissions
generation-job:update and filters by jobId/svg/generation-jobs/:id to get SVG + creditsnpm run test
Tests are colocated with components in *.test.tsx files.
# Run all tests
npm run test:e2e
# Run specific test
npx playwright test tests/auth/signin.spec.ts
# Debug mode
npm run test:e2e:ui
# Generate test report
npx playwright show-report
tests/
├── auth/
│ ├── auth.setup.spec.ts # Creates authenticated state
│ ├── signin.spec.ts
│ └── signup.spec.ts
└── svg/
└── authenticated-generate.spec.ts
This project uses CI (Continuous Integration) and CD (Continuous Deployment) to keep main stable and production deployments reliable.
Every push and pull request triggers automated checks.
The pipeline runs:
Workflow: .github/workflows/playwright.yml
- Checkout client and server repos
- Setup PostgreSQL service
- Install dependencies
- Run Prisma migrations
- Seed test database
- Start backend and frontend servers
- Execute Playwright tests
- Upload test reports on failure
main is protected:
Production deployments are triggered only from main:
Frontend deploys to Vercel
mainBackend API is deployed from the server repository (AWS EC2 / k3s)
Preview deployments may be created for pull requests, but production is always based on main.
Production-ready error monitoring with Sentry.
.env:VITE_SENTRY_DSN="https://your-key@sentry.io/your-project"
See docs/SENTRY_SETUP.md for detailed configuration.
console.* and debugger in productionCustom theme with brand colors:
wizard-orange: #FF6B35
wizard-gold: #FFD700
wizard-gray-medium: #4A5568
Notes:
VITE_API_BASE_URL (the client derives the socket origin from it).withCredentials cookies.| Variable | Description | Required | Default |
|---|---|---|---|
VITE_API_BASE_URL | Backend API URL | Yes | http://localhost:4000/api |
VITE_SENTRY_DSN | Sentry error tracking DSN | No | - |
VITE_PAYPAL_CLIENT_ID | PayPal client ID | Yes | - |
Problem: Backend blocks requests from frontend
**Solution: