AI-powered marine conservation platform built with Next.js. It provides species identification, gene sequence analysis, threat assessment, conservation recommendations, and water quality analytics, backed by a Python ML model server and MongoDB.
- Species identification with Gemini models
- Gene sequence analysis via a local Python model server (Flask)
- Threat assessment and conservation recommendations
- Interactive water-quality maps (Leaflet)
- Dashboard with charts and insights
- Next.js 14 (App Router), React 18, TypeScript
- UI: Radix UI, Tailwind CSS utilities, custom components
- Data: MongoDB
- AI: Google Gemini (
@google/generative-ai) - Maps: Leaflet, React-Leaflet
- Python ML service (Flask) for gene prediction
- Node.js 18+ and npm (or pnpm/yarn)
- Python 3.8+ (for the ML model server)
- MongoDB instance (local or cloud)
- Install dependencies
npm install
# or: pnpm install- Configure environment variables (create
.env.localin the repo root)
GEMINI_API_KEY=your_gemini_api_key
MONGODB_URI=mongodb+srv://user:pass@host/dbname?retryWrites=true&w=majority- (Optional) Seed the database
node scripts/setup-database.js
node scripts/seed-sample-data.js- Start the ML model server (separate terminal)
- Windows (batch file):
scripts\start-model-server.bat- Cross-platform (Python launcher):
python scripts/start-model-server.pyThe server will run at http://localhost:5000 if all model artifacts exist in Model/.
- Run the web app
npm run dev
# open http://localhost:3000GEMINI_API_KEY(required): Used inlib/gemini-client.tsto initialize Gemini models.MONGODB_URI(required): Used inlib/mongodb.tsto connect to the database.
npm run dev: Start Next.js dev servernpm run build: Production buildnpm run start: Start production server (after build)node scripts/setup-database.js: Create indexes/config for MongoDBnode scripts/seed-sample-data.js: Insert sample datapython scripts/start-model-server.pyorscripts/start-model-server.bat: Launch Python model server
app/ Next.js App Router pages and API routes
api/ Serverless API endpoints (AI, ML, water-quality, dashboard)
components/ UI components and sections
lib/ Clients, DB, utilities, model integration helpers
ml-models/ Python service code and requirements
Model/ Pretrained model artifacts (*.pkl, *.npy, etc.)
scripts/ Setup, seed, and model server launch scripts
Key API routes (under app/api/):
ai/species-identification/route.tsai/gene-sequence-analysis/route.tsai/threat-assessment/route.tsai/conservation-recommendations/route.tsai/water-quality-analysis/route.tsml/gene-prediction/route.tsdashboard-data/route.tswater-quality/route.ts
Artifacts required in Model/:
stack_meta_clf.pklstack_label_encoder.pkllgb_models_list.pklxgb_models_list.pkl
Install Python dependencies once:
pip install -r ml-models/requirements.txtThen run the server (see Quick Start). The launcher checks Python version, required files, installs deps, and starts Flask at http://localhost:5000.
- Gemini client and models are created in
lib/gemini-client.ts. - MongoDB client with connection reuse is in
lib/mongodb.ts. - UI primitives live in
components/ui/.
- Missing
GEMINI_API_KEYorMONGODB_URIwill throw at startup. - If model server fails to start, verify artifacts exist in
Model/and Python 3.8+ is used. - On Windows, prefer
scripts/start-model-server.batif Python launcher has path issues.
Proprietary/Internal. Do not distribute without permission.