Skip to content

jakesuche/flight-management

Repository files navigation

Flight Management System

Project Overview

This is a Flight Management System built with Next.js, React, and TypeScript. It provides functionality for user authentication, flight creation, editing, deletion, and searching.

Table of Contents

  1. Features
  2. Tech Stack
  3. Project Structure
  4. Setup Instructions
  5. Component Design Patterns
  6. API Integration
  7. Testing
  8. Deployment

Features

  • User Authentication (Login/Register)
  • Flight Management (Create, Read, Update, Delete)
  • Flight Search
  • Responsive Design

Tech Stack

  • Next.js 13 (with App Router)
  • React 18
  • TypeScript
  • Tailwind CSS
  • shadcn/ui components
  • React Hook Form
  • Zod (for form validation)
  • Jest (for unit testing)
  • Cypress (for end-to-end testing)

Project Structure

flight-management/
├── app/
│   ├── auth/
│   │   └── page.tsx
│   ├── flights/
│   │   └── page.tsx
│   ├── layout.tsx
│   └── page.tsx
├── components/
│   ├── auth/
│   │   ├── login-form.tsx
│   │   └── register-form.tsx
│   ├── flights/
│   │   ├── flight-form.tsx
│   │   └── flight-list.tsx
│   └── ui/
│       └── ... (shadcn/ui components)
├── contexts/
│   └── auth-context.tsx
├── hooks/
│   ├── use-api.ts
│   └── use-form.ts
├── lib/
│   ├── api.ts
│   └── utils.ts
├── types/
│   ├── auth.ts
│   └── flight.ts
├── .env.local
├── jest.config.js
├── next.config.js
├── package.json
├── README.md
└── tsconfig.json

Setup Instructions

  1. Clone the repository: ``` git clone https://github.com/your-username/flight-management.git cd flight-management ```

  2. Install dependencies: ``` npm install ```

  3. Create a .env.local file in the root directory and add your environment variables: ``` NEXT_PUBLIC_API_URL=your_api_url_here ```

  4. Run the development server: ``` npm run dev ```

  5. Open http://localhost:3000 with your browser to see the result.

Component Design Patterns

  1. Atomic Design: We've structured our components following the Atomic Design methodology, with atoms (basic UI components), molecules (groups of atoms), and organisms (groups of molecules and/or atoms).

  2. Container/Presentational Pattern: We separate the logic and presentation concerns. Container components (like pages) handle data fetching and state management, while presentational components focus on rendering UI.

  3. Composition: We use composition to build complex components from simpler ones, promoting reusability and maintainability.

  4. Hooks: We extensively use React Hooks for state management and side effects. Custom hooks (use-api.ts, use-form.ts) encapsulate reusable logic.

  5. Context API: We use React's Context API for global state management, particularly for user authentication (auth-context.tsx).

  6. Render Props: Some components use the render props pattern to share code between components.

API Integration

We use a custom api object (lib/api.ts) to interact with the backend. This object provides methods for all necessary API calls, handling authentication and request/response processing.

Testing

  1. Unit Testing: We use Jest and React Testing Library for unit tests. Run unit tests with: ``` npm run test ```

  2. End-to-End Testing: We use Cypress for E2E tests. Run E2E tests with: ``` npm run test:e2e ```

Deployment

This project is set up to be easily deployed on Vercel. Connect your GitHub repository to Vercel for automatic deployments on every push to the main branch.

For other platforms, make sure to build the project first:

``` npm run build ```

Then, you can start the production server:

``` npm start ```

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published