Live Demo https://poultrypro.net ([email protected] - password)
![Signup](https://private-user-images.githubusercontent.com/1897307/363956892-6328ab90-3593-4d5f-b636-4a84fcfb73e1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk1Njg5Mi02MzI4YWI5MC0zNTkzLTRkNWYtYjYzNi00YTg0ZmNmYjczZTEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDdmMWUxNzUzNzhhY2VlMDM3M2JkYjEwMTQ5ZmYyZmM4NmMzOWQ3NzViOTA4YWQyMTM2OTQ1YWViOWFkNjE0MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.OYr_ksmfbRx4nImBnh5zNovfgV4mPZYl4XouDt5ePuU)
![dashboard](https://private-user-images.githubusercontent.com/1897307/363956621-e963ae2f-a92e-41fa-ae18-ef5a7f3dcb35.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk1NjYyMS1lOTYzYWUyZi1hOTJlLTQxZmEtYWUxOC1lZjVhN2YzZGNiMzUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTJlN2M2MDJjY2EwZDc2MmMwZGYxNjg3MTk5N2UxNGZiNDVmMjNmYzNlYjJkMDBmYjMzODZiZTNjNTU4NDFmNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.fWMeaTgdzeDsqD6mOOzhDycNrTVmHbhen0OiNTCJfdU)
This project is a frontend client that allows users to manage poultry farms and their associated data. It provides features for user authentication, farm management, poultry management, and data analysis.
- Installation
- Usage
- Tech Stack and Architecture
- Frontend
- Backend
- Deployment
- Monitoring and Analytics
- Architecture Overview
To set up the PoultryPro frontend client on your local machine, follow these steps:
-
Clone the frontend repository:
HTTPS - git clone https://github.com/TaylorBeck/poultrypro-client.git SSH - git clone [email protected]:TaylorBeck/poultrypro-client.git cd poultrypro-client
-
Clone the backend repository:
HTTPS - git clone https://github.com/TaylorBeck/poultrypro-server.git SSH - git clone [email protected]:TaylorBeck/poultrypro-server.git cd poultrypro-server
-
Install dependencies:
npm install
-
Create a frontend
.env
file in the root directory and add the necessary environment variables:VITE_FIREBASE_API_KEY=your_firebase_api_key VITE_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain VITE_FIREBASE_PROJECT_ID=your_firebase_project_id VITE_FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket VITE_FIREBASE_MESSAGING_SENDER_ID=your_firebase_messaging_sender_id VITE_FIREBASE_APP_ID=your_firebase_app_id VITE_FIREBASE_API_URL=http://localhost:3001 # or your deployed backend URL
-
Create a backend
.env
file in the root directory and add the necessary environment variables:PORT=3001 FIREBASE_TYPE="service_account" FIREBASE_PROJECT_ID="" FIREBASE_PRIVATE_KEY="" FIREBASE_PRIVATE_KEY_ID="" FIREBASE_CLIENT_EMAIL="" FIREBASE_CLIENT_ID="" FIREBASE_AUTH_URI="https://accounts.google.com/o/oauth2/auth" FIREBASE_TOKEN_URI="https://oauth2.googleapis.com/token" FIREBASE_AUTH_PROVIDER_X509_CERT_URL="https://www.googleapis.com/oauth2/v1/certs" FIREBASE_CLIENT_X509_CERT_URL="" FIREBASE_UNIVERSE_DOMAIN="googleapis.com" FIREBASE_DATABASE_URL=""
-
Start the development servers on the frontend and backend:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
to view the application.
Note: Make sure you have Node.js (version 14 or later, ideally 20) and npm installed on your machine before starting the installation process.
- Sign in to the application at https://poultrypro.net ([email protected] - password)
- Alternatively, sign up at https://poultrypro.net/sign-up (takes roughly 5 seconds for database seeding).
- Navigate to /chickens or /farms to Add/Edit/Delete poultry in your farm and track their health and growth.
- Each chicken will have a timeline of its measurements:
![measurements](https://private-user-images.githubusercontent.com/1897307/363960241-78e077f5-166a-47f9-8504-3e18f0c64284.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk2MDI0MS03OGUwNzdmNS0xNjZhLTQ3ZjktODUwNC0zZTE4ZjBjNjQyODQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmQwNDA2Njc4NDFhNDUyYmFkYzUyZmE3YmNmYTE0Y2Y4NGE2NjQxMGVmMjA1ZDBlMmI4Mjg0ZTM2YTAzMDY1OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.0ohvTboyiiRI8Oy6Syla0tLu9rmaWLOwcgWaf_aKLmc)
- Then for guest access, use a guest token (created automatically durin): https://poultrypro.net/guest/uniqueAccessToken2
![guestAccess](https://private-user-images.githubusercontent.com/1897307/363954899-e8dbdf21-015c-4e4c-9f4c-1b685efe44e4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk1NDg5OS1lOGRiZGYyMS0wMTVjLTRlNGMtOWY0Yy0xYjY4NWVmZTQ0ZTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDAzNmY4OTAzZGNiZTRiNTlhMjE5MjkyZWZkOTRhYzE0MWNlNzk5ZDhmOWI0YzdhNzIxNGM1NDc1YzI5NGEzOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.kF-AwLlIvMufEpxFQNEHymcbokRbXyCtDby2NHycR2Y)
- A list of your farm business' orders can be accessed at /orders and downloaded as a CSV file.
![orders-page](https://private-user-images.githubusercontent.com/1897307/363965497-9340e87e-3d79-4cbe-976f-d2a0dceb41bc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk2NTQ5Ny05MzQwZTg3ZS0zZDc5LTRjYmUtOTc2Zi1kMmEwZGNlYjQxYmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTZlM2IxZjNhYjM4NTg5MDlhY2IzY2E3OGVhMDczZWM3OWZiYjYyNDg4NzJmNDg5M2JlM2IxYzI1NDM1YTNjYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.LDRQB03gf44CdJrsbkkV0cxCvQa47V0LWC1_zXfTWfw)
- NOTE: Navigating to a path that doesn't exist will end up on the 404 page. Simply go back or sign in again to continue.
![404](https://private-user-images.githubusercontent.com/1897307/363969770-ccc8dfd2-c69a-4b97-90c3-6e3a9a2ff6ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk2OTc3MC1jY2M4ZGZkMi1jNjlhLTRiOTctOTBjMy02ZTNhOWEyZmY2YWUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzdiNDRmMWEzMTBiMTYxYmUxNzk2NTkyY2I0MGE0ZTQ5NWRiZjZmMTcwODYyMTU5MDZjMjNhNjIxMDJlMGFjOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tgvgESrsWoH8gCUDquavFB0oHCKDvmsVPAQUVCpAOz4)
- React 18
- Vite for build tooling
- Material-UI (MUI) for UI components
- Redux Toolkit for state management
- React Router for navigation
- Chart.js for data visualization
- Firebase for authentication and real-time database
- Axios for API requests
- Domain hosted in Route 53
- Github Actions Workflow using Github Action secrets
- Node.js with Express.js framework
- Firebase Admin SDK for authentication and database interactions
- Body-parser for parsing incoming request bodies
- CORS for Cross-Origin Resource Sharing
- Helmet for setting various HTTP headers for security
- Morgan for HTTP request logging
- Azure App Service Environment Variables for environment variable management
- Azure App Service (P0v3 plan)
- (Github Action Workflow)
- Custom autoscaling rules:
- Scale out: +1 instance when CPU > 70% for 5 minutes
- Scale in: -1 instance when CPU < 25% for 5 minutes
- Min instances: 1, Max instances: 5
- Cost-effective, and adjustable up to 30 max instances as needed
![autoscaling-rule](https://private-user-images.githubusercontent.com/1897307/363947832-0041c199-caa8-4d22-902d-f511d48e9609.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk0NzgzMi0wMDQxYzE5OS1jYWE4LTRkMjItOTAyZC1mNTExZDQ4ZTk2MDkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NGQxYjVjYTgwMmQ0NDIzYzcxNWMxYTU2NjI1ZGRhYTRlYmIxZTBiZWE1MzA5ZTAxNTJhYzBhZGZlMWI3NjE0ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.apc8bf_sPLJxXEU2VwPwf-1mOH0RA7Ec891M2iSvgqQ)
- Azure Static Web Apps (Standard plan with Enterprise Grade Edge)
- GitHub Actions for CI/CD
- Azure Application Insights
![resource-visualizer](https://private-user-images.githubusercontent.com/1897307/363947761-4a83e392-6962-47b5-84a8-cc8848c68a36.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MDg2MjEsIm5iZiI6MTczOTgwODMyMSwicGF0aCI6Ii8xODk3MzA3LzM2Mzk0Nzc2MS00YTgzZTM5Mi02OTYyLTQ3YjUtODRhOC1jYzg4NDhjNjhhMzYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMTYwNTIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWJmOWNjZjdiYzdlMDUzNWY0YTQyN2U0MDcyYWVjMWFhODdjZWIyYjg0MWZmMTI3NTdkZjQ1MjNhY2E4YjQxZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.IjkmoKZjwWKFeeEgaTT6ABiGIHoLoo0RnxkvLkfIxoE)
The PoultryPro application is built on a modern, scalable architecture leveraging Azure cloud services:
- The frontend is a React-based Single Page Application (SPA) currently hosted on Azure Static Web Apps. I also set up an App Service for the frontend as displayed in the diagram. Pros and cons are listed below.
- Backend services are provided by Azure App Service, with custom autoscaling for performance and cost optimization.
- Authentication is handled through Firebase, integrated with the React frontend and Express backend.
- State management is centralized using Redux Toolkit for predictable data flow.
- Continuous Integration and Deployment (CI/CD) is implemented using GitHub Actions, automatically deploying to Azure on code changes to the main branch.
- Application performance and user behavior is monitored using Azure Application Insights.
This architecture ensures high performance, scalability, and maintainability while providing a smooth development and deployment workflow.
- Pros:
- Highly scalable
- Integrates well with other Azure services
- More control over server environment
- Cons:
- More expensive for simple applications
- More complex to set up and manage
- Can have cold start times
- Pros:
- Cost-effective for static content
- Global content distribution
- Free SSL certificates
- Cons:
- Less flexible for complex configurations
- Some resource limitations
- Primarily for static and JavaScript-based apps