This document explains how to set up environment variables for the SecureShift2 project.
# API Configuration
EXPO_PUBLIC_API_BASE_URL=http://localhost:5000/api/v1
# Development Environment
NODE_ENV=developmentThe employer panel uses React environment variables. Create a .env file in the app-frontend/employer-panel/ directory:
# API Configuration
REACT_APP_API_BASE_URL=http://localhost:5000/api/v1
# Development Environment
NODE_ENV=developmentNote: The employer panel now uses a centralized Axios instance with authorization interceptors in src/lib/http.js.
The backend API runs on http://localhost:5000/api/v1 by default.
Both applications now have centralized Axios instances that:
- Automatically attach JWT tokens from storage (AsyncStorage for React Native, localStorage for React)
- Handle 401 Unauthorized errors by clearing tokens and triggering logout
- Use environment variables for API base URLs
- Include proper timeout handling (20 seconds)
- Employer Panel: Uses
REACT_APP_API_BASE_URL
Employer Panel:
src/lib/http.js- New centralized Axios instancesrc/pages/Login.js- Updated to use centralized instancesrc/pages/2FA.js- Updated to use centralized instancesrc/pages/createShift.js- Updated to use centralized instancesrc/pages/ExpressionOfInterest.js- Updated to use centralized instancepackage.json- Added axios dependency.env.example- Created for reference
- Copy the respective
.env.examplefiles to.envin each application directory - Update the API base URL if your backend runs on a different port
- Install dependencies:
npm installin each application directory - Start the applications as usual
The centralized Axios instances will automatically handle authentication and error management.