Skip to content

shaqa3/ticket-system

Repository files navigation

Ticket System with 2FA

A modern ticket management system built with .NET 8 backend, Node.js frontend, and Nginx reverse proxy. Features two-factor authentication for enhanced security.

🚀 Tech Stack

  • Backend: .NET 8 Web API
  • Frontend: Node.js
  • Proxy: Nginx
  • Containerization: Docker & Docker Compose
  • Authentication: Cookie-based with 2FA support

📋 Prerequisites

🛠️ Project Structure

ticket-system/
├── TicketSystem.Api/          # .NET 8 Backend
├── TicketSystem.Frontend/     # Node.js Frontend
├── docker-compose.yml         # Docker configuration
├── nginx.conf                 # Nginx configuration
└── README.md                  # This file

🏃‍♂️ Getting Started

  1. Clone the repository

    git clone <repository-url>
    cd ticket-system
  2. Start the application

    docker-compose up -d
  3. Access the application

🔍 Service Verification

Check if services are running properly:

# View all containers
docker-compose ps

# Check nginx logs
docker-compose logs nginx

# Check API logs
docker-compose logs ticketsystem.api

# Check frontend logs
docker-compose logs ticketsystem.ui

🔧 Testing Nginx

  1. Check Nginx Status

    docker-compose exec nginx nginx -t
  2. Test HTTP Response

    curl -I http://localhost:8080
  3. View Nginx Logs

    docker-compose logs -f nginx

🛑 Stopping the Application

# Stop all services
docker-compose down

# Stop specific service
docker-compose stop [service-name]

🔄 Common Commands

# Rebuild services
docker-compose build

# Restart services
docker-compose restart

# View logs
docker-compose logs -f

# Enter container shell
docker-compose exec [service-name] sh

🔐 Security Features

  • Two-Factor Authentication (2FA)
  • Cookie-based authentication
  • Secure communication between services
  • CORS protection

🌐 Environment Variables

Backend (.NET API)

ASPNETCORE_ENVIRONMENT=Development
ASPNETCORE_URLS=http://+:5000

Frontend (Node.js)

  • Default port: 3000
  • Configure additional variables in .env file

🐳 Docker Services

API Service

ticketsystem.api:
  - Port: 5000
  - Environment: Development
  - Base Image: mcr.microsoft.com/dotnet/aspnet:8.0

Frontend Service

ticketsystem.ui:
  - Port: 3000
  - Base Image: node:alpine
  - Hot Reload Enabled

Nginx Service

nginx:
  - Port: 8080
  - Base Image: nginx:latest
  - Reverse Proxy Configuration

🔨 Troubleshooting

  1. 502 Bad Gateway

    • Check if all services are running
    • Verify nginx configuration
    • Check service logs
  2. Service not starting

    # Check logs
    docker-compose logs [service-name]
    
    # Rebuild service
    docker-compose build [service-name]
  3. Port conflicts

    • Modify ports in docker-compose.yml
    • Check for running services on same ports

📝 License

MIT License - See LICENSE for details

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Ticket System with 2FA using .NET 8, Node.js, and Nginx

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages