A professional web-based platform for real-time oceanic hazard reporting and monitoring
OceanWatch is a comprehensive full-stack web application designed to enhance coastal safety through community-driven reporting and official monitoring of oceanic hazards. The platform enables citizens and officials to report, track, and manage dangerous marine conditions with precise geolocation data and real-time visualization.
- π¨ Early Warning System: Community-powered hazard detection for faster emergency response
- π Centralized Monitoring: Single platform for all oceanic hazard data and analytics
- πΊοΈ Real-time Visualization: Interactive maps with severity-based color coding
- π₯ Community Safety: Connecting citizens, officials, and emergency services
- π± Mobile-First: Optimized for field reporting and emergency situations
- Interactive Map Dashboard: Real-time hazard visualization with PostGIS-powered geospatial queries
- Geotagged Reporting: GPS-accurate hazard reporting with location validation for Indian coastal regions
- Role-Based Access Control: Separate interfaces for citizens and government officials
- Severity Classification: Four-tier system (Low, Medium, High, Critical) with color-coded markers
- Report Verification: Official verification workflow for data accuracy
- Real-time Updates: Live synchronization of new reports and status changes
- Professional UI: Government-grade interface with comprehensive icon system
- Image Documentation: Secure file upload with validation and storage
- Analytics Dashboard: Statistical insights and hazard trend analysis
- Emergency Contacts: Quick access to Coast Guard, NDRF, and emergency services
- Database Migration: Safe schema updates and data migration tools
- Production-Ready: No dummy data generation, clean production deployment
- PostGIS Integration: Advanced geospatial data handling and geographic queries
- JWT Authentication: Secure session management with role-based permissions
- TypeScript Support: Type-safe development with comprehensive type definitions
- Responsive Design: Mobile-optimized for field reporting scenarios
- RESTful API: Well-structured API endpoints with proper error handling
System Requirements:
- Node.js 18.0.0+
- npm 8.0.0+
- PostgreSQL 12.0+ with PostGIS extension
- Git for version control
-
Install Node.js
# Download from https://nodejs.org/ (LTS version recommended) # Verify installation node --version npm --version
-
Install PostgreSQL with PostGIS
# Download from https://www.postgresql.org/download/windows/ # During installation, note your postgres password # Open pgAdmin or psql and run: CREATE EXTENSION IF NOT EXISTS postgis;
-
Clone and Setup Project
git clone https://github.com/yourusername/OceanWatch.git cd OceanWatch # Automated setup (recommended) .\setup.sh # Manual setup alternative: npm install cd packages\backend-api && npm install && cd ..\.. cd packages\web-app && npm install && cd ..\..
-
Install Node.js
# Ubuntu/Debian curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs # CentOS/RHEL/Fedora curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash - sudo dnf install -y nodejs npm # Verify installation node --version && npm --version
-
Install PostgreSQL with PostGIS
# Ubuntu/Debian sudo apt update sudo apt install postgresql postgresql-contrib postgis postgresql-14-postgis-3 # CentOS/RHEL/Fedora sudo dnf install postgresql postgresql-server postgresql-contrib postgis sudo postgresql-setup --initdb sudo systemctl enable --now postgresql
-
Setup Database
# Create database as postgres user sudo -u postgres createdb oceanguard sudo -u postgres psql oceanguard -c "CREATE EXTENSION IF NOT EXISTS postgis;"
-
Clone and Setup Project
git clone https://github.com/yourusername/OceanWatch.git cd OceanWatch # Run automated setup chmod +x setup.sh ./setup.sh
-
Configure Backend Environment
cd packages/backend-api cp env.example .env -
Edit
.envwith your settings:# Database Configuration DB_HOST=localhost DB_PORT=5432 DB_NAME=oceanguard DB_USER=postgres DB_PASSWORD=your_postgres_password # JWT Security JWT_SECRET=your-super-secret-jwt-key-change-this-in-production JWT_EXPIRES_IN=7d # Server Configuration PORT=3001 NODE_ENV=development # File Upload Settings UPLOAD_DIR=uploads MAX_FILE_SIZE=5242880
-
Initialize Database Schema
# From project root cd packages/backend-api npm run init-db cd ../..
-
Start Development Environment
# Start both backend and frontend concurrently npm run dev # Or start services individually: npm run dev:backend # API server on http://localhost:3001 npm run dev:frontend # Web app on http://localhost:3000
-
Access the Application
- Main Application: http://localhost:3000
- API Health Check: http://localhost:3001/health
- API Documentation: http://localhost:3001/api
π€ Citizen Account:
Email: citizen@oceanguard.com
Password: password
ποΈ Official Account:
Email: admin@oceanguard.com
Password: password
POST /api/auth/register # User registration
POST /api/auth/login # User authentication
GET /api/auth/profile # Get user profileGET /api/reports # Fetch all reports
POST /api/reports # Create new report
GET /api/reports/:id # Get specific report
PUT /api/reports/:id # Update report (officials only)
DELETE /api/reports/:id # Delete report (admin only)# Build applications for production
npm run build
# Start production servers
cd packages/backend-api && npm start &
cd packages/web-app && npm start &| Variable | Description | Default | Required |
|---|---|---|---|
DB_HOST |
PostgreSQL server host | localhost | β |
DB_PORT |
PostgreSQL server port | 5432 | β |
DB_NAME |
Database name | oceanguard | β |
DB_USER |
Database username | postgres | β |
DB_PASSWORD |
Database password | - | β |
JWT_SECRET |
JWT signing secret | - | β |
JWT_EXPIRES_IN |
Token expiration time | 7d | β |
PORT |
API server port | 3001 | β |
NODE_ENV |
Environment mode | development | β |
UPLOAD_DIR |
File upload directory | uploads | β |
MAX_FILE_SIZE |
Max upload size (bytes) | 5242880 | β |
# Initialize fresh database with schema
npm run init-db
# Migrate existing database to latest schema
npm run migrate-db
# Reset database (β οΈ destructive operation)
npm run init-db # Will prompt for confirmationOceanWatch/
βββ π packages/
β βββ π backend-api/ # Express.js REST API
β β βββ π src/
β β β βββ π config/ # Database & app configuration
β β β β βββ init-db.js # Database initialization
β β β β βββ migrate-db.js # Schema migration tool
β β β β βββ schema.sql # PostgreSQL schema with PostGIS
β β β βββ π controllers/ # Request handlers
β β β βββ π middleware/ # Express middleware
β β β βββ π models/ # Database models
β β β βββ π routes/ # API route definitions
β β β βββ π services/ # Business logic layer
β β β βββ server.js # Main application server
β β βββ π tests/ # API test suites
β β βββ π uploads/ # File storage directory
β β βββ env.example # Environment template
β βββ π web-app/ # Next.js frontend application
β βββ π src/
β β βββ π components/ # Reusable React components
β β β βββ π icons/ # Professional icon system
β β β βββ MapView.tsx # Interactive map component
β β β βββ DashboardLayout.tsx
β β β βββ ... # Feature-specific components
β β βββ π contexts/ # React context providers
β β βββ π pages/ # Next.js page components
β β β βββ dashboard.tsx # Main dashboard interface
β β β βββ report.tsx # Report submission page
β β β βββ map.tsx # Full-screen map view
β β βββ π services/ # API integration services
β β βββ π styles/ # Global CSS and Tailwind
β β βββ π types/ # TypeScript type definitions
β β βββ π utils/ # Helper functions
β βββ π public/ # Static assets
βββ π setup.sh # Automated setup script
βββ π test-report-submission.js # Testing utilities
βββ π package.json # Workspace configuration
βββ π Documentation/ # Project documentation
βββ MAP_SYSTEM_DOCUMENTATION.md
βββ CRITICAL_FIXES_DOCUMENTATION.md
βββ UI_IMPROVEMENTS_DOCUMENTATION.md
- Backend: Express.js REST API with PostgreSQL/PostGIS database
- Frontend: Next.js React application with TypeScript
- Database: PostgreSQL with PostGIS for geospatial data
- Authentication: JWT-based with role-based access control
- File Storage: Local filesystem with Multer middleware
- Maps: Leaflet with OpenStreetMap tiles and custom markers
-
Fork & Clone
git clone https://github.com/yourusername/OceanWatch.git cd OceanWatch -
Create Feature Branch
git checkout -b feature/your-feature-name
-
Development Setup
# Install dependencies npm install # Start development environment npm run dev
-
Code Quality
# Backend testing cd packages/backend-api && npm test # Frontend linting cd packages/web-app && npm run lint
-
Submit Pull Request
- Clear description of changes
- Include screenshots for UI modifications
- Reference related issues
- Ensure all tests pass
- Backend: Node.js best practices, ESLint configuration
- Frontend: React/Next.js conventions, TypeScript strict mode
- Database: Proper SQL formatting, indexing strategies
- Git: Conventional commit messages (
feat:,fix:,docs:)
Include in bug reports:
- Environment details (OS, Node.js, PostgreSQL versions)
- Reproduction steps
- Expected vs actual behavior
- Error logs and screenshots
- Browser information (for frontend issues)
This project is licensed under the MIT License - see the LICENSE file for complete details.
- Express.js - Fast, unopinionated web framework
- Next.js - Production-ready React framework
- PostgreSQL - Advanced open-source database
- PostGIS - Spatial database extension
- Leaflet - Open-source interactive maps
- Tailwind CSS - Utility-first CSS framework
- TypeScript - Type-safe JavaScript
- React - Component-based UI library
- Axios - HTTP client library
- Multer - File upload middleware
- JWT - JSON Web Token standard
- OpenStreetMap - Collaborative mapping data
- Nominatim - Geocoding service
- Lucide - Beautiful icon library
π Built with passion for ocean safety and community protection
For support, questions, or feature requests, please open an issue or contact our development team.