Skip to content

oustani-anas/Smart_ticket_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎫 Smart Ticket System

Internship Project - Backend Development

A full-stack event ticketing platform with face recognition authentication, developed during my backend development internship. This project demonstrates modern API development, database design, payment integration, and AI-powered security features.

Smart Ticket System Backend Dev Version

πŸš€ Key Features

  • πŸ” Multi-Authentication: JWT, Google OAuth, Face Recognition
  • πŸ’³ Payment Integration: Stripe API with webhook handling
  • 🎟️ Event & Ticket Management: Full CRUD operations
  • πŸ“Š Admin Dashboard: User management and analytics
  • πŸ€– AI Security: Anti-spoofing face recognition
  • πŸ“„ PDF Generation: QR code tickets with PDF-lib

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚    Backend      β”‚    β”‚ Face Recognitionβ”‚
β”‚   (Next.js)     │◄──►│   (NestJS)      │◄──►│   (Python)      β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ React 19      β”‚    β”‚ β€’ TypeScript    β”‚    β”‚ β€’ OpenCV        β”‚
β”‚ β€’ Tailwind CSS  β”‚    β”‚ β€’ Prisma ORM    β”‚    β”‚ β€’ PyTorch       β”‚
β”‚ β€’ Next.js 15    β”‚    β”‚ β€’ PostgreSQL    β”‚    β”‚ β€’ MTCNN         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Database      β”‚
                    β”‚  (PostgreSQL)   β”‚
                    β”‚ β€’ Users/Events  β”‚
                    β”‚ β€’ Tickets/Paymentsβ”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Backend (Primary Focus)

NestJS TypeScript Prisma PostgreSQL JWT Stripe

Frontend

Next.js React Tailwind CSS

AI/ML

Python OpenCV PyTorch

πŸ“ Project Structure

Smart_ticket_System/
β”œβ”€β”€ πŸ“ backend/                  # NestJS Backend API (Main Focus)
β”‚   β”œβ”€β”€ πŸ“ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“ auth/            # JWT & OAuth authentication
β”‚   β”‚   β”œβ”€β”€ πŸ“ user/            # User management & profiles
β”‚   β”‚   β”œβ”€β”€ πŸ“ events/          # Event CRUD operations
β”‚   β”‚   β”œβ”€β”€ πŸ“ ticket/          # Ticket generation & validation
β”‚   β”‚   β”œβ”€β”€ πŸ“ payment/         # Stripe integration & webhooks
β”‚   β”‚   └── πŸ“ prisma/          # Database service & ORM
β”‚   β”œβ”€β”€ πŸ“ prisma/              # Database schema & migrations
β”‚   └── πŸ“„ docker-compose.yml   # PostgreSQL container
β”‚
β”œβ”€β”€ πŸ“ frontend/                 # Next.js Frontend
β”‚   β”œβ”€β”€ πŸ“ src/app/             # App Router pages
β”‚   └── πŸ“ src/components/      # Reusable components
β”‚
β”œβ”€β”€ πŸ“ face-recognition/         # Python AI System
β”‚   β”œβ”€β”€ πŸ“ src/                 # ML models & processing
β”‚   └── πŸ“„ app.py               # Face recognition app
β”‚
└── πŸ“„ README.md

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Docker and Docker Compose
  • PostgreSQL (via Docker)

Backend Setup (Main Focus)

cd backend

# Install dependencies
npm install

# Set up environment variables
cp .env_example .env

# Start PostgreSQL with Docker
docker-compose up -d

# Run database migrations
npx prisma migrate dev

# Start the backend server
npm run start:dev

Backend runs on: http://localhost:4000
API Documentation: http://localhost:4000/api

Frontend Setup

cd frontend
npm install
npm run dev

Frontend runs on: http://localhost:3000

πŸ”§ Environment Variables

Backend (.env)

DATABASE_URL="postgresql://username:password@localhost:5432/smart_ticket_db"
JWT_SECRET=your_jwt_secret_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret

🎯 Backend Development Highlights

πŸ” Authentication & Security

  • JWT Implementation: Secure token-based authentication
  • Google OAuth: Passport.js integration for social login
  • Password Security: bcrypt hashing with salt rounds
  • CORS Configuration: Secure cross-origin requests

πŸ’³ Payment Integration

  • Stripe API: Complete payment processing workflow
  • Webhook Handling: Secure payment confirmation
  • Session Management: Checkout session creation and validation

πŸ—„οΈ Database Design

  • Prisma ORM: Type-safe database operations
  • PostgreSQL: Relational database with proper relationships
  • Migrations: Version-controlled schema changes
  • Data Validation: DTO validation with class-validator

πŸ“Š API Development

  • RESTful Design: Clean API endpoints
  • Swagger Documentation: Auto-generated API docs
  • Error Handling: Comprehensive error responses
  • Middleware: Request logging and validation

πŸ§ͺ Key API Endpoints

Authentication

POST /auth/register          # User registration
POST /auth/login             # User login
GET  /auth/google            # Google OAuth
POST /auth/forgot-password   # Password reset

Core Features

GET  /events/getall          # Get all events
GET  /ticket/my-tickets      # Get user tickets
GET  /ticket/:id/download    # Download ticket PDF
POST /payment/create-checkout-session  # Stripe payment
POST /payment/webhook        # Payment confirmation

πŸš€ Deployment

# Backend Production
cd backend
npm run build
npm run start:prod

# Frontend Production
cd frontend
npm run build
npm run start

πŸ“„ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments

  • NestJS - Progressive Node.js framework
  • Prisma - Next-generation ORM
  • Stripe - Payment processing
  • OpenCV - Computer vision library

πŸŽ“ Internship Project - Backend Development

Demonstrating modern API development, database design, and payment integration

About

Smart_ticket_System (closed Copy to the Internship Project ) # not complete yet

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published