This repository contains the server-side implementation of TaskHive, providing backend logic, database interactions, and RESTful APIs for the TaskHive application.
base url: http://localhost:3000
The API is documented using Swagger. Once the server is running, you can access the documentation at:
http://localhost:3000/api-docs
# Development mode
npm run dev
npm run start:dev
# Production mode
npm run start:prod
# Test environment
npm run start:test
The application is containerized with Docker and supports multiple environments.
- Development: For local development with hot reloading
- Testing: For running tests in isolated environment
- Production: Optimized for deployment
# Development environment
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d
# Testing environment
docker compose -f docker-compose.yml -f docker-compose.test.yml up --build -d
# Production environment
docker compose -f docker-compose.yml -f docker-compose.prod.yml up --build -d
The application includes Nginx as a reverse proxy with the following benefits:
- Load balancing
- SSL termination
- Static file serving
- API gateway functionality
Access the application through Nginx at:
http://localhost:8080
The Docker image is published to Docker Hub:
# Pull the latest image
docker pull mdawoud27/tasktrial:latest
# Pull a specific version by commit SHA
docker pull mdawoud27/tasktrial:[SHA]
The GitHub Actions workflow automatically:
- Runs linting and tests
- Builds Docker image for production
- Pushes to Docker Hub with appropriate tags
This happens automatically on pushes to the main branch after all tests pass.
- Development: Uses local environment variables with verbose logging for debugging
- Production: Uses production configuration, optimized for performance and security
- Test: Used for running the application during testing with mock services
The project uses Jest as the testing framework with distinct configurations for different test types.
# Run all unit tests
npm run test
# or
npm run test:unit
# Run unit tests in watch mode
npm run test:watch
# Generate test coverage report
npm run test:coverage
# Run integration tests (runs serially with --runInBand)
npm run test:integration
# Run end-to-end tests
npm run test:e2e
# Run all test suites
npm run test:all
# Delete test data from db
npm run cleanup:test-data
- Unit Tests: Test individual functions and components in isolation
- Integration Tests: Test interactions between multiple components (API endpoints, database)
- E2E Tests: Test complete workflows from start to finish
- Port conflicts: Integration tests run serially with
--runInBand
to avoid port conflicts - Database setup: Tests use a separate test database to avoid affecting development data
- Test data: Use the provided test data helpers for consistent test data generation