Bon Voyage is an AI-powered maritime voyage management system that provides fuel consumption prediction, route optimisation, and maintenance forecasting for ships.
- 🤖 AI-Powered Predictions: Machine learning models for fuel consumption and route optimisation
- ⛽ Fuel Management: Track and predict fuel usage across voyages
- 🗺️ Route Optimisation: Find optimal routes considering weather and cargo
- 🔧 Maintenance Forecasting: Predictive maintenance scheduling
- 📊 Voyage Analytics: Comprehensive voyage tracking and feedback
- 👥 User Management: Authentication and user-specific data
- Backend: Node.js, Express, TypeScript
- Database: PostgreSQL with Prisma ORM
- AI/ML: TensorFlow.js
- Containerization: Docker & Docker Compose
- Package Manager: pnpm
Before setting up the application, ensure you have the following installed:
- Docker (v20.0+)
- Docker Compose (v2.0+)
- Git
Note: No need to install Node.js, pnpm, or PostgreSQL locally as they run inside Docker containers.
git clone <your-repository-url>
cd bon-voyage
docker-compose up --build
This single command will:
- Build the application Docker image
- Start PostgreSQL database
- Run database migrations
- Seed the database with sample data
- Train AI models
- Start the Express server
Once the setup is complete, you'll see:
🚢 Server is running on port 4000
The API will be available at: http://localhost:4000
- POST /auth/register - Register a new user
- POST /auth/login - Login user
- POST /voyage/plan-voyage - Create a new voyage and predict the details
- GET /voyage/plan-history - Compare actual and predicted data for all voyages
- GET /voyage/plan-history/:voyageId - Compare actual and predicted data for a specific voyage
- GET /maintenance-alerts/:shipId - Get maintenance predictions
- POST /feedback/provide-feedback - Submit voyage feedback
For development with hot-reload and local debugging:
bash
npm install -g pnpm
pnpm install
Create a .env file in the root directory:
env
DATABASE_URL="postgresql://postgres:password123@localhost:5432/bon_voyage"
DIRECT_URL="postgresql://postgres:password123@localhost:5432/bon_voyage"
PORT=3000
JWT_SECRET="your-secret-key-here"
pnpm db:push
pnpm db:generate
pnpm seed
pnpm dev
# Development
pnpm dev # Start development server with nodemon
pnpm build # Build TypeScript to JavaScript
pnpm start # Start production server
# Database
pnpm db:generate # Generate Prisma client
pnpm db:push # Push schema to database
pnpm db:migrate # Run migrations
pnpm db:reset # Reset database
pnpm db:studio # Open Prisma Studio
pnpm seed # Seed database with sample data
# AI/ML
pnpm train # Train AI models manually
# Start all services
docker-compose up
# Rebuild and start
docker-compose up --build
# Stop all services
docker-compose down
# View logs
docker-compose logs app
docker-compose logs postgres
The application uses the following main entities:
- Users: Authentication and user management
- Ships: Fleet management
- Voyages: Trip planning and tracking
- FuelLogs: Fuel consumption tracking
- VoyageFeedback: Post-voyage analytics
- MaintenanceRecords: Equipment maintenance tracking
The application includes three AI models that are automatically trained on startup:
- Fuel Predictor: Predicts fuel consumption based on distance, cargo weight, weather conditions
- Route Optimizer: Optimizes routes considering weather and cargo constraints
- Maintenance Forecaster: Predicts maintenance needs based on usage patterns
-Problem: exec ./docker-entrypoint.sh: no such file or directory -Solution: This is usually a line-ending issue. The Dockerfile includes dos2unix to handle this automatically.
-Problem: Cannot find module '/app/dist/server.js' -Solution: Ensure you're not using volume mounts that override the built image in production.
-Problem: The table 'public.voyages' does not exist -Solution: Run database migrations:
docker-compose exec app pnpm db:push
-Problem: Connection refused to PostgreSQL -Solution: Ensure PostgreSQL container is running:
docker-compose up postgres -d
-Problem: Slow AI model training -Solution: The app includes TensorFlow.js CPU backend. For faster training, you can:
- Use a machine with more CPU cores
- The models train once on startup and save to disk
This Project, Bon Voyage works with AI/ML to provide data oriented decision support for Marine Operations.
-
the
/plan-voyage
optimal speed and fuel consumption based on cargo weight, distance, and weather. This allows operators to plan cost-efficient and timely routes. A regression model forecasts fuel usage, enabling better refueling decisions and cost management. -
The system estimates voyage duration and recommends a dynamic speed schedule across segments, improving ETA predictions and voyage efficiency.
-
Based on historical fuel logs and maintenance records, the system predicts the next due maintenance date, readiness time, and health score for each ship.
-
With
/feedback
endpoints and model retraining schedules, the system evolves using real operational data, improving over time with usage. -
For savimg each training model's version, accuracy and metadata for reliability.
Happy Sailing! ⛵