This commit is contained in:
Jake Kasper
2025-08-21 07:14:28 -05:00
parent 2a46f7261e
commit b3662ea35e
11 changed files with 648 additions and 100 deletions

138
README.md
View File

@@ -56,17 +56,19 @@ TurfTracker is a comprehensive web application designed for homeowners to track
### 🚧 Planned Features
- **Google Maps Integration** - Enhanced satellite view and area calculation
- **GPS Speed Monitoring** - Real-time speed feedback during applications
- **Mobile App** - Native iOS/Android applications
- **Advanced Reporting** - PDF reports and data export
- **IoT Integration** - Sensor data integration
## Technology Stack
- **Frontend**: React 18, Tailwind CSS, React Router, React Query
- **Frontend**: React 18, Tailwind CSS, React Router, React Query, Leaflet Maps
- **Backend**: Node.js, Express.js, PostgreSQL
- **Authentication**: JWT, OAuth2 (Google)
- **Authentication**: JWT, OAuth2 (Authentik)
- **Infrastructure**: Docker, Nginx
- **APIs**: OpenWeatherMap, Google Maps (planned)
- **Maps**: OpenStreetMap via Leaflet, Esri Satellite Imagery
- **APIs**: OpenWeatherMap
## Quick Start
@@ -85,23 +87,32 @@ TurfTracker is a comprehensive web application designed for homeowners to track
2. **Environment Configuration**
Create environment files with your API keys:
Copy the example environment file and configure it:
```bash
cp .env.example .env
```
**Backend Environment** (create `.env` in root):
**Required Configuration** - Edit the `.env` file:
```env
# Database
DATABASE_URL=postgresql://turftracker:password123@db:5432/turftracker
# Database - Use separate fields OR full DATABASE_URL
DB_HOST=db
DB_PORT=5432
DB_NAME=turftracker
DB_USER=turftracker
DB_PASSWORD=password123
# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# Google OAuth2 (optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Authentication - GENERATE A SECURE JWT SECRET
JWT_SECRET=your-generated-jwt-secret-here
# Weather API (get free key from OpenWeatherMap)
WEATHER_API_KEY=your-openweathermap-api-key
# Authentik OAuth2 (optional - for SSO)
AUTHENTIK_CLIENT_ID=your-authentik-client-id
AUTHENTIK_CLIENT_SECRET=your-authentik-client-secret
AUTHENTIK_BASE_URL=https://your-authentik-domain.com
AUTHENTIK_CALLBACK_URL=http://localhost:5000/api/auth/authentik/callback
# App URLs
FRONTEND_URL=http://localhost:3000
```
@@ -138,30 +149,87 @@ TurfTracker is a comprehensive web application designed for homeowners to track
- Add custom products or use the pre-loaded database
- Configure application rates
## API Keys Setup
## Environment Configuration Guide
### OpenWeatherMap API Key
### JWT Secret Generation
The JWT secret is used to sign authentication tokens and **MUST** be secure in production.
**Generate a secure JWT secret:**
```bash
# Option 1: Using OpenSSL (recommended)
openssl rand -base64 64
# Option 2: Using Node.js
node -e "console.log(require('crypto').randomBytes(64).toString('base64'))"
# Option 3: Using Python
python3 -c "import secrets; print(secrets.token_urlsafe(64))"
# Option 4: Online generator
# Visit: https://generate-secret.vercel.app/64
```
**⚠️ Security Warning:** Never use the default JWT secret in production! Always generate a unique, random secret for each environment.
### Database Configuration
You can configure the database connection using either:
**Option 1: Separate Fields (Recommended)**
```env
DB_HOST=db
DB_PORT=5432
DB_NAME=turftracker
DB_USER=turftracker
DB_PASSWORD=password123
```
**Option 2: Connection URL**
```env
DATABASE_URL=postgresql://username:password@host:port/database
```
**Note:** If both are provided, `DATABASE_URL` takes precedence.
### API Keys Setup
#### OpenWeatherMap API Key
1. Go to [OpenWeatherMap](https://openweathermap.org/api)
2. Sign up for a free account
3. Get your API key from the dashboard
4. Add it to your `.env` file as `WEATHER_API_KEY`
2. Sign up for a free account (allows 1,000 calls/day)
3. Navigate to "API keys" in your dashboard
4. Copy your API key
5. Add it to your `.env` file as `WEATHER_API_KEY`
### Google OAuth2 (Optional)
#### Authentik OAuth2 Setup (Optional)
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select existing one
3. Enable Google+ API
4. Create OAuth2 credentials
5. Add `http://localhost:5000/api/auth/google/callback` as redirect URI
6. Add client ID and secret to your `.env` file
If you have an Authentik instance for SSO:
### Google Maps API (Future Enhancement)
1. **In Authentik Admin Panel:**
- Go to Applications → Providers
- Create new "OAuth2/OpenID Provider"
- Set Authorization grant type: `authorization-code`
- Set Client type: `confidential`
- Set Redirect URIs: `http://localhost:5000/api/auth/authentik/callback`
- Note the Client ID and Client Secret
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Enable Maps JavaScript API and Geocoding API
3. Create an API key
4. Will be integrated in future updates
2. **In your `.env` file:**
```env
AUTHENTIK_CLIENT_ID=your-client-id-from-authentik
AUTHENTIK_CLIENT_SECRET=your-client-secret-from-authentik
AUTHENTIK_BASE_URL=https://your-authentik-domain.com
AUTHENTIK_CALLBACK_URL=http://localhost:5000/api/auth/authentik/callback
```
3. **In Authentik Applications:**
- Create new Application
- Set Name: `TurfTracker`
- Set Slug: `turftracker`
- Set Provider: (select the provider created above)
**Scopes Required:** `openid profile email`
## Application Structure
@@ -260,10 +328,12 @@ The backend provides a comprehensive REST API. Key endpoints include:
### Project Roadmap
- [ ] Google Maps integration for enhanced property mapping
- [ ] Mobile application development
- [x] OpenStreetMap integration for property mapping and satellite imagery
- [x] Authentik OAuth2 integration for SSO
- [x] Interactive lawn section drawing and area calculation
- [ ] GPS speed monitoring with audio feedback
- [ ] Advanced reporting and analytics
- [ ] Mobile application development
- [ ] Advanced reporting and analytics with PDF export
- [ ] Weather-based application recommendations
- [ ] Integration with IoT sensors
- [ ] Multi-language support