Admin dashboard application for managing and visualizing data for the New Mexico Bureau of Geology & Mineral Resources ( NMBGMR). Built with React, TypeScript, and Refine.dev, it provides an intuitive interface to interact with various NMBGMR data sources, including NM aquifer, Pychron, NM wells, and ST2 data.
- Features
- Tech Stack
- Prerequisites
- Getting Started
- Notable Well IDs
- Configuration
- Available Scripts
- Building for Production
- Deployment
- License
- Contact
- Acknowledgements
- CRUD operations for Ocotillo system through a unified Admin Dashboard
- User authentication and authorization via Authentik
- Interactive map visualizations using Mapbox GL
- Data validation with React Hook Form and Zod
- Theming and layout via Material UI
- React & TypeScript
- Refine.dev (Admin Dashboard framework)
- Vite (Next-generation frontend build tool)
- Material UI (UI components)
- React Hook Form & Zod (Forms & validation)
- Mapbox GL (Map visualizations)
- Authentik (Authentication)
- Cypress (E2E Testing)
- Node.js v16+
- npm v6+
- Clone the repository:
git clone https://github.com/DataIntegrationGroup/NMBGMRDataManager.git cd NMBGMRDataManager - Install dependencies:
npm install
- Create environment variable file for development:
cp .env.development.example .env.development
- Update the
.env.*files with your API URLs, tokens, and Authentik credentials. - Run the development server:
The app will be available at
npm run dev
http://localhost:5173.
The following wells contain a full, rich set of information and are useful for testing the Well Show page and related UI:
- AR-0025
- HS-038
- QU-050
- QU-054
- TB-0203
This application uses Vite environment variables. The following variables are required in .env.development:
VITE_APP_TITLE="Ocotillo (Dev)"
VITE_NMBGMR_AMP_API_URL="https://your-amp-development-api-url"
VITE_NMBGMR_GEOTHERMAL_API_URL="https://your-geothermal-development-api-url"
VITE_OCOTILLO_API_URL="https://your-ocotillo-development-api-url"
VITE_REFINE_PROJECT_ID="your-refine-project-id"
VITE_MAPBOX_TOKEN="your-mapbox-token"
VITE_POSTHOG_KEY="your-posthog-project-api-key"
VITE_POSTHOG_HOST="https://us.i.posthog.com"
VITE_AUTHENTIK_CLIENT_ID="your-authentik-client-id"
VITE_AUTHENTIK_URL="https://your-authentik-domain"
VITE_AUTHENTIK_REDIRECT_URI="https://your-athentik-redirect"- If you plan to develop against a locally hosted version of an API, change your API Urls accoringly
npm run dev: Runs the app in development mode with hot-reloading.npm run build: Builds the app for production (outputs todist/).npm run start: Serves the production build locally.npm run refine: Runs Refine CLI commands.
npm run mock:server:vitest: Runs a Prism mock server to run the vitest test suite. Uses the committedopenapi-auth.jsonin the repo root (no network fetch for startup).npm run mock:server:cypress: Runs a Prism mock server to run the cypress test suite. Same spec file as vitest.npm run test:run: Runs the Vitest test suite a single time.npx cypress open: Opens the Cypress browser to run and interact with Cypress tests.npx cypress run: Runs the Cypress test suite in headless mode a single time.npm run openapi:generate: Runs hey-api TypeScript and Zod generation using./openapi-auth.jsonintosrc/generated.
Prism mocks and codegen both use openapi-auth.json at the repo root. When the staging API adds or changes schemas, refresh the file from staging and regenerate so contract tests and zWellResponse validation stay aligned:
curl -fsSL "https://ocotillo-api-staging.newmexicowaterdata.org/openapi-auth.json" -o openapi-auth.json
npm run openapi:generateThen run tests and commit openapi-auth.json plus src/generated/ updates as needed.
This test suite uses the data provider against a mock server for contract tests or unit tests, and the mock server needs to be running first:
- Start mock server
npm run mock:server:vitest- Run vitest suite once
npm run test:runThis test suite runs Cypress for E2E or Component tests, and the mock server and app build need to be running:
- Start mock server (with seed set)
npm run mock:server:cypress- Serve production build locally (matches CI Cypress workflow)
npm run build
npm run start- Open Cypress testing environment to run tests and interact with Cypress against your locally running app
npx cypress openor
- Run Cypress tests once in headless mode against your locally running app
npx cypress runBoth the Vitest and Cypress test suites run via a Github action on PR. The Vitest contract tests may fail when the committed openapi-auth.json is older than the API schemas your Zod types expect.
When the API changes, refresh openapi-auth.json from staging (see Refreshing the OpenAPI spec above), run:
npm run openapi:generateFix any failing tests and related code, then commit openapi-auth.json and src/generated/ together with your changes.
npm run build
npm run startDeploy the contents of the dist/ folder to any static hosting provider (e.g. GCP). Ensure environment variables are configured on the hosting platform.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
New Mexico Bureau of Geology & Mineral Resources
https://newmexicowaterdata.org