Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ihfaz297/MND/llms.txt
Use this file to discover all available pages before exploring further.
Backend Environment Variables
The backend uses a.env file in the MND-backend/ directory.
Example .env File
Required Variables
Google Distance Matrix API key for calculating travel times and distances.How to get:
- Go to Google Cloud Console
- Enable Distance Matrix API
- Create credentials (API key)
- Restrict key to Distance Matrix API only
Server Configuration
Port number the server listens on.Examples:
Environment mode. Affects logging and error handling.Valid values:
development- Verbose logging, detailed errorsproduction- Minimal logging, sanitized errorstest- Test mode
Authentication (Optional)
The backend includes magic link authentication for user favorites.Secret key for signing JWT tokens. Auto-generated if not provided.Generate a secure secret:Example:
Email Configuration (Optional)
For sending magic link emails. If not configured, tokens are logged to console.Sender email address for magic links.Example:
SMTP server hostname.Common providers:
- Gmail:
smtp.gmail.com - Outlook:
smtp.office365.com - SendGrid:
smtp.sendgrid.net
SMTP server port.Standard ports:
587- TLS (recommended)465- SSL25- Unencrypted (not recommended)
SMTP authentication username (usually your email).
SMTP authentication password.For Gmail:
Use an App Password, not your regular password.
Frontend Environment Variables
The React frontend uses Vite’s environment variable system.Create .env File
Create.env in MND-frontend/:
Vite Environment Variables
Backend API base URL.Development:Production (same server):Production (separate server):
Google Maps JavaScript API key for map display (optional).Note: This is different from the Distance Matrix API key. This key is exposed to clients, so restrict it to your domain.
Using Environment Variables in Code
In React components:Flutter Environment Variables
The Flutter app usesflutter_dotenv package.
Create .env File
Create.env in mnd_flutter/:
Backend API base URL.Local development (emulator):Local development (physical device):Production:
Google Maps API key for Android/iOS.Restrict this key to your app’s bundle ID/package name.
Using in Flutter Code
Load .env on Startup
Inmain.dart:
.env.example Template
Provide a template for other developers: MND-backend/.env.example:Security Best Practices
Add to .gitignore
Rotate API Keys
- Rotate Google API keys every 90 days
- Use different keys for development and production
- Restrict keys to specific APIs and domains
Server-Side vs Client-Side
Server-side (backend .env):- Keys are never exposed to clients
- Can contain sensitive secrets
- Used for Distance Matrix API, email passwords, etc.
- Keys are exposed in compiled code
- Must be restricted by domain/bundle ID
- Only use for client-side APIs (Maps JavaScript API)
Environment-Specific Configuration
Create multiple environment files:NODE_ENV: