How fiqrioemry/event-ticketing-system-application works
Project Type and Purpose
• Tiketku is a full-stack event ticketing system.
• Frontend: a SvelteKit-based single-page application for users and admin dashboards.
• Backend: a Golang (Gin) REST API that handles authentication, event/ticket CRUD, orders, refunds, withdrawals, reporting.
• External integrations: Stripe (payments/webhooks), Redis (OTP & token store), Cloudinary (asset upload), SMTP (Nodemailer), MySQL (GORM), API key validation.
File Structure
• Top-level directories:
• client/ – frontend SvelteKit code
• server/ – backend Go service
• docs/ – Postman collection
• Frontend breaks down into API clients, stores, services/hooks, UI components, routes.
• Backend follows a layered pattern:
• config/ – bootstrap of DB, Redis, Stripe, etc.
• dto/ – request/response schemas
• handlers/ (controllers) → services/ (business logic) → repositories/ (DB access) → models/
• middleware/ – auth, CORS, rate limiting, error recovery
• cron/ – scheduled tasks
• utils/ – helpers (logging, JWT, hashing, emailing)
• Deployment artifacts: Dockerfiles, docker-compose.yml, GitHub Actions.
Extract Key Architectural Insights from README
• JWT-based auth with Access/Refresh tokens and Google OAuth.
• Role-based API access (User vs Admin).
• Stripe Checkout for payments and webhooks for asynchronous events.
• Cron jobs for reminders, auto-expire payments.
• CSV export for reporting.
• Partial refund flow and user wallet/withdrawal workflow.
a. Main Components
1. Frontend SPA (SvelteKit + TailwindCSS + TanStack Query + Zod)
2. API Gateway (Gin router + middleware)
3. Business Layer (services)
4. Data Access Layer (GORM → MySQL)
5. Redis Cache/Store (OTP, token blacklists)
6. External Services:
– Stripe (Checkout, Webhooks)
– Cloudinary (Asset uploads)
– SMTP Server (Nodemailer)
7. Cron Scheduler (scheduled jobs)
8. File store / static hosting (Netlify or Hostinger)
b. Relationships & Interactions
• User/admin browser ↔ Frontend (SvelteKit routes/UI components)
• Frontend ↔ Backend REST API (/api/v1/*) via fetch/axios
• Backend middleware authenticates JWT or API key
• Handlers invoke services → repositories → MySQL
• Services call Redis for OTP/token operations
• Payment flow:
– Frontend triggers Stripe Checkout
– Stripe redirects and posts webhooks → /payments/stripe/webhooks
– Backend updates order/payment status
• Refund flow:
– Admin POST /orders/:id/refund → service adjusts wallet → issues partial refund via Stripe API
• Withdrawal:
– User POST /withdrawals → service validates, writes to DB
• Reporting:
– Admin GET /reports/transaction → service queries DB → optionally exports CSV
c. Architectural Patterns & Principles
• Layered (Controller → Service → Repository → Model)
• Separation of concerns (auth, business logic, data access in separate packages)
• Hexagonal touches: external adapters (Stripe, Redis) isolated in utils or config
• Event-driven for webhooks & cron jobs
• Role-based access control via middleware
d. Key Technologies & Frameworks
• Frontend: SvelteKit, TailwindCSS, @tanstack/svelte-query, Zod, Vite
• Backend: Go, Gin, GORM(MySQL), Redis, Stripe SDK, JWT, Cloudinary SDK, Nodemailer
• Orchestration: Docker, Docker-Compose, GitHub Actions CI/CD