IMPORTANT: Never commit API keys or sensitive credentials to your repository!
β
.env file is in .gitignore - your actual keys are safe
β
.env.example contains only placeholder values
β
All code uses process.env to read environment variables
β
No hardcoded credentials in the codebase
This application requires the following environment variables:
| Variable | Purpose | Where to Get It |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Provided by hosting platform |
SECRET |
Session encryption key | Generate a random string |
BALLDONTLIE_API_KEY |
NBA data API access | https://app.balldontlie.io/signup |
NODE_ENV |
Environment mode | Set to production for deployment |
PORT |
Server port | Usually provided by hosting platform |
-
Copy
.env.exampleto.env:cp .env.example .env
-
Fill in your actual values in
.env -
NEVER commit
.envto git!
Environment variables are set through the Render dashboard:
- Go to your service settings
- Click "Environment"
- Add each variable with its actual value
- Render keeps these secure and encrypted
-
Never commit
.envfiles- Already in
.gitignore - Double-check before pushing
- Already in
-
Use strong secrets
- Generate random strings for
SECRET - Use tools like https://randomkeygen.com/
- Generate random strings for
-
Rotate keys regularly
- Change API keys periodically
- Update in hosting platform dashboard
-
Limit API key permissions
- Use read-only keys when possible
- Monitor API usage
-
Keep dependencies updated
- Run
npm auditregularly - Update packages with security fixes
- Run
If you accidentally commit API keys:
-
Immediately revoke the exposed key
- Go to the API provider (BALLDONTLIE)
- Generate a new key
- Delete the old key
-
Remove from git history
# Remove sensitive file from history git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch .env" \ --prune-empty --tag-name-filter cat -- --all # Force push (be careful!) git push origin --force --all
-
Update all deployments
- Update environment variables in Render
- Redeploy with new keys
If you discover a security vulnerability:
- DO NOT open a public issue
- Email the repository owner directly
- Provide details about the vulnerability
- Allow time for a fix before public disclosure
Remember: Security is everyone's responsibility. Keep your keys safe! π