Skip to content

irf87/shipping_tracking_system_challange

Repository files navigation

Tracking System Test

📚 Documentation

For detailed information about the project architecture, patterns, and technical implementation, see TECHNICAL_DOCUMENTATION.MD.

🚀 Getting Started

Development Setup

  1. Install dependencies:
npm install
  1. Start the PostgreSQL database with Docker:
docker-compose up -d
  1. Set up environment variables:
# Copy environment files
cp env.example .env
cp env.test.example .env.test

The .env file should contain your PostgreSQL database URL:

DATABASE_URL="postgresql://postgres:postgres@localhost:5432/tracking_db"
  1. Run database migrations:
npx prisma migrate dev
  1. Start the development server:
npm run dev

Testing

Before running tests:

The test script automatically switches the Prisma provider from PostgreSQL to SQLite for testing. This is handled by the scripts/switch-prisma-provider.js script.

Running tests:

npm test

After running tests:

⚠️ Important: After running tests, the Prisma provider remains set to SQLite. To return to development mode, you must:

  1. Switch back to PostgreSQL provider:
npx prisma migrate dev
  1. Then start the development server:
npm run dev

Provider Switching

The application uses different database providers:

  • Development/Production: PostgreSQL
  • Testing: SQLite

The provider switching is handled automatically by the test script, but you may need to manually reset it after testing as described above.

Available Scripts

  • npm run dev - Start development server
  • npm test - Run tests (switches to SQLite provider)
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

Docker Database Commands

  • docker-compose up -d - Start PostgreSQL database in background
  • docker-compose down - Stop and remove database container
  • docker-compose logs postgres - View database logs
  • docker-compose restart postgres - Restart database service

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published