Solar panel monitoring application built on top of React
Node.js | React | Next.js | Chakra UI | React Query | React Testing Library | Cypress
Solar terminal is a monitoring dashboard built over React to monitor status of panels in farm. It uses Next.js API routes for providing API for updates.
📖 Table of Contents
src/
├──app/ * Next.js app router folder. It contains pages
│ |--layout.tsx * Defines shared layout for routes
│ |--page.tsx * Main dashboard page
│ │──providers.tsx * Set up Chakra UI theme
│ │
│──components/ * Contains app components
│ ├──Overview/ * Overview dashboard component
│ └──SolarGrid/ * Component to display panels in grid
|──hooks/ * Contains React hook for fetching grid data updates
│
|──pages/ * Contains Next.js API routes for providing panel data updates
│
|──public/ * Contains public assets
│
|──test/ * Jest configuration for testing application
|
└──utilities/ * Utilities for generating data for panels
This is our testing stack:
- React Testing Library
- Jest
- Cypress
- Eslint
To run unit and integration tests, type npm test
in the terminal. To run E2E tests, type npm run test:e2e
in the terminal.
Tools needed to run this app:
node
andnpm
Node.js is an environment that can run JavaScript code outside of a web browser and is used to write and run server-side JavaScript apps. Node.js installation includes npm
, the package manager that allows you to install NPM modules from your terminal.
You can download an installer from the Node.js homepage.
Check that you have the minimum required version installed by running the following command:
node -v
You should see a version larger than Node 18.
node -v
v18.19.0
Solar terminal minimum supported Node.js version is Node 18, but more recent versions will work as well.
clone
this reponpm install
to install dependencies
Once all dependencies are installed,
husky
will setup Git hooks which will automatically execute build and testing on commit to make sure everything is working.
After you have installed all dependencies, you may run the app. Running npm run dev
will launch a development server, and watch all files. The port will be displayed in the terminal.
Here's a list of available tasks:
npm run lint
- runs linting with Eslint to verify code styles and formatting.
npm run dev
- starts a dev server via
Next.js
.
- starts a dev server via
npm run build
- builds production build of the application.
npm run export
Builds and exports static version of the application.npm start
- runs the production build of the application.
npm test
- runs the testing.
npm run test:e2e
- runs the E2E testing with Cypress.