meti-frontend/ENV_SETUP.md

50 lines
1.3 KiB
Markdown
Raw Normal View History

2025-08-15 23:03:15 +07:00
# Environment Setup
## Required Environment Variables
Create a `.env.local` file in the root directory with the following variables:
```bash
# External API Configuration
2025-08-15 23:16:19 +07:00
NEXT_PUBLIC_API_BASE_URL=https://evoting-be.apskel.org
2025-08-15 23:03:15 +07:00
NEXT_PUBLIC_API_AUTH_HEADER=••••••
# JWT Secret (for local token generation)
JWT_SECRET=your-secret-key-change-this
# Environment
NODE_ENV=development
# Base URL for the application
NEXT_PUBLIC_BASE_URL=http://localhost:3000
```
## API Endpoints
The application expects the following external API endpoints:
- `POST /api/v1/auth/login` - User authentication
- `POST /api/v1/auth/logout` - User logout
- `GET /api/v1/auth/verify` - Token verification
## Testing the API
Use this curl command to test the login endpoint:
```bash
curl --location 'localhost:4000/api/v1/auth/login' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data-raw '{
"email": "superadmin@example.com",
"password": "ChangeMe!Super#123"
}'
```
## Notes
- Replace `••••••` with your actual API authorization header
- The `NEXT_PUBLIC_` prefix makes variables available in the browser
- Keep your `.env.local` file secure and never commit it to version control
- Update the JWT_SECRET to a secure random string in production