Skip to content

Repository files navigation

Airplane Logo

Airport Resource Management System

The Airport Resource Management System is a backend system built with NestJS for managing airport resources. Users can register, create or join airport teams, and manage various airport resources like cars, airplanes, employees, helicopters, and other assets.

This project leverages MongoDB as the database with Mongoose as the ODM, and includes JWT-based authentication along with Google and GitHub OAuth integration via passport.js.

Features

  • User Authentication:
    Supports registration and authentication using email/password, Google, and GitHub. Implemented using JWT for secure token-based authentication.

  • User Profile:
    Each user has a personal profile where they can add real-world or custom airports, and manage the airport's resources.

  • Airport Teams:
    Users can create airports or join existing ones by providing the airport's UUID and a join password. This allows multiple users to collaborate on managing airport resources.

  • Resource Management:
    Supports full CRUD (Create, Read, Update, Delete) operations for managing airport resources, including:

    • Cars
    • Airplanes
    • Employees
    • Helicopters
    • Inventory (Other resources)
  • Rate Limiting:
    Rate limiting is applied to prevent abuse, allowing up to 60 requests per minute per user.

  • Transportation Module:
    This module provides the ability to retrieve information about various transportation entities such as:

    • Helicopters
    • Cars
    • Airports
    • Airlines
    • Aircraft

    The module leverages the external Ninjas API, and caching has been applied to minimize the load on the system, with storage for up to 1000 items that are refreshed every 8 hours.

  • API Documentation:
    Comprehensive API documentation available via Swagger at /api.

  • Data Validation:
    Incoming data is validated using NestJS’s built-in DTO (Data Transfer Object) validation with decorators and a class validator system.

Tech Stack

Swagger API Documentation

For a detailed overview of the available API endpoints, request/response structures, and data models, the Swagger documentation is available at /api. This documentation provides interactive API exploration and helps developers understand and integrate with the API efficiently.

Access Key Header

Every request to the API must contain the following header:

authorization: json_web_token

Installation

GitHub

$ git clone https://github.com/Pier228/airport-resource-management-system-backend.git
$ cd airport-resource-management-system-backend
$ npm install

Docker Image

The Docker image for this project is available on Docker Hub.

Docker Hub

Environment Variables

To run this application, you need to set up several environment variables. Create a .env file in the root directory of the project and add the following variables:

  • PORT: The port on which the server will run.
    Example: 2300

  • DB_CONNECT: MongoDB connection URL used to connect to the database.
    Example: mongodb://localhost:27017/airport-management

  • JWT_SECRET: Secret key for signing and verifying JWT tokens.
    Example: my_jwt_secret_key

  • SALT_ROUNDS: Number of rounds for hashing passwords (bcrypt).
    Example: 10

  • GOOGLE_CLIENT_ID: Google OAuth Client ID for Google authentication.
    Example: your_google_client_id_here

  • GOOGLE_CLIENT_SECRET: Google OAuth Client Secret for Google authentication.
    Example: your_google_client_secret_here

  • GOOGLE_CALLBACK_URL: The URL to redirect to after Google authentication.
    Example: http://localhost:2300/auth/google/callback

  • GITHUB_CLIENT_ID: GitHub OAuth Client ID for GitHub authentication.
    Example: your_github_client_id_here

  • GITHUB_CLIENT_SECRET: GitHub OAuth Client Secret for GitHub authentication.
    Example: your_github_client_secret_here

  • GITHUB_CALLBACK_URL: The URL to redirect to after GitHub authentication.
    Example: http://localhost:2300/auth/github/callback

  • CLIENT_REDIRECT_URL: The URL to redirect to after success OAuth authentication.
    Example: http://localhost:3000/profile

  • CORS_ALLOWED_ORIGIN: The URL of the domain from which it is allowed to send requests to the server (CORS settings)
    Example: http://localhost:3000

  • TRANSPORTATION_API_KEY: The API key from https://api-ninjas.com/

You can also see example of needed environment variables in .env.example

Running the app

After setting up the .env file, you can start the application using the following commands:

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

The Airport Resource Management System is a backend system for managing airport resources.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages