Skip to content

Commit bf27aa4

Browse files
feat: Complete security, performance, and documentation overhaul (#21)
1 parent 6db6a5e commit bf27aa4

27 files changed

+1988
-176
lines changed

.env.example

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# GitHub PR Dashboard Environment Variables
2+
# Copy this file to .env.local and update the values as needed
3+
4+
# ================================
5+
# GitHub API Configuration
6+
# ================================
7+
8+
# GitHub API base URL
9+
# Default: https://api.github.com
10+
# For GitHub Enterprise Server, use your enterprise URL (e.g., https://ghe.company.com/api/v3)
11+
VITE_GITHUB_API_URL=https://api.github.com
12+
13+
# GitHub Avatar URL (optional - will be auto-detected from API URL if not set)
14+
# Default: https://avatars.githubusercontent.com (for github.com)
15+
# For GitHub Enterprise Server: https://avatars.ghe.company.com
16+
# VITE_GITHUB_AVATAR_URL=https://avatars.githubusercontent.com
17+
18+
# GitHub Base URL (optional - will be auto-detected from API URL if not set)
19+
# Default: https://github.com (for github.com)
20+
# For GitHub Enterprise Server: https://ghe.company.com
21+
# VITE_GITHUB_BASE_URL=https://github.com
22+
23+
# ================================
24+
# Rate Limiting Configuration
25+
# ================================
26+
27+
# Maximum number of requests per minute to GitHub API
28+
# Default: 200 (conservative limit to avoid rate limiting)
29+
# GitHub's rate limit for authenticated requests is 5000/hour (83/minute)
30+
# Adjust based on your usage patterns and GitHub plan
31+
# Range: 1-5000
32+
VITE_MAX_REQUESTS_PER_MINUTE=200
33+
34+
# ================================
35+
# Development Configuration
36+
# ================================
37+
38+
# Node environment (automatically set by Vite)
39+
# Values: development | production | test
40+
# This is automatically handled by Vite and doesn't need to be set manually
41+
# NODE_ENV=development
42+
43+
# ================================
44+
# Optional Configuration
45+
# ================================
46+
47+
# Enable debug logging (not currently implemented but reserved for future use)
48+
# VITE_DEBUG=false
49+
50+
# Custom theme configuration (not currently implemented but reserved for future use)
51+
# VITE_DEFAULT_THEME=light
52+
53+
# Session timeout in milliseconds (not currently implemented but reserved for future use)
54+
# Default is 8 hours (28800000 ms) as set in TokenManager
55+
# VITE_SESSION_TIMEOUT=28800000
56+
57+
# ================================
58+
# Production Deployment Notes
59+
# ================================
60+
61+
# For production deployments:
62+
# 1. Set VITE_GITHUB_API_URL to your GitHub instance
63+
# 2. Adjust VITE_MAX_REQUESTS_PER_MINUTE based on your expected load
64+
# 3. Ensure HTTPS is enabled for secure token transmission
65+
# 4. Configure proper CSP headers as documented in docs/SECURITY.md
66+
67+
# For GitHub Enterprise Server:
68+
# VITE_GITHUB_API_URL=https://ghe.your-company.com/api/v3
69+
# VITE_GITHUB_AVATAR_URL=https://avatars.ghe.your-company.com
70+
# VITE_GITHUB_BASE_URL=https://ghe.your-company.com
71+
72+
# Example for ACME GitHub Enterprise:
73+
# VITE_GITHUB_API_URL=https://ghe.acme.com/api/v3
74+
# VITE_GITHUB_AVATAR_URL=https://avatars.ghe.acme.com
75+
# VITE_GITHUB_BASE_URL=https://ghe.acme.com
76+
77+
# For high-traffic deployments, you may increase the rate limit:
78+
# VITE_MAX_REQUESTS_PER_MINUTE=500

.env.local.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Local Development Environment
2+
# This file is for local development only and will be ignored by git
3+
4+
# ================================
5+
# GitHub API Configuration
6+
# ================================
7+
8+
# For local development, you can use the default GitHub API
9+
VITE_GITHUB_API_URL=https://api.github.com
10+
11+
# For ACME GitHub Enterprise (uncomment to use):
12+
# Replace 'acme.com' with your actual GitHub Enterprise domain
13+
# VITE_GITHUB_API_URL=https://ghe.acme.com/api/v3
14+
# VITE_GITHUB_AVATAR_URL=https://avatars.ghe.acme.com
15+
# VITE_GITHUB_BASE_URL=https://ghe.acme.com
16+
17+
# ================================
18+
# Development Rate Limiting
19+
# ================================
20+
21+
# For development, you might want a lower rate limit to test rate limiting behavior
22+
# Or a higher limit if you're doing intensive testing
23+
VITE_MAX_REQUESTS_PER_MINUTE=100
24+
25+
# ================================
26+
# Development Notes
27+
# ================================
28+
29+
# 1. This file should be copied to .env.local for your local development
30+
# 2. .env.local is gitignored and won't be committed to the repository
31+
# 3. Values in .env.local override values in .env.example
32+
# 4. Vite automatically loads .env.local in development mode
33+
34+
# For testing with GitHub Enterprise Server:
35+
# VITE_GITHUB_API_URL=https://ghe.your-company.com/api/v3
36+
# VITE_GITHUB_AVATAR_URL=https://avatars.ghe.your-company.com
37+
# VITE_GITHUB_BASE_URL=https://ghe.your-company.com
38+
39+
# Note: Avatar and Base URLs are auto-detected from API URL if not specified

README.md

Lines changed: 118 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@ The GitHub PR Dashboard is a comprehensive tool designed to streamline the monit
66

77
[Go to demo -->](https://akharytonchyk.github.io/git-pull-request-dashboard/)
88

9+
## Documentation
10+
11+
- 📖 [Deployment Guide](docs/DEPLOYMENT.md) - Production deployment and CSP configuration
12+
- 🔒 [Security Guidelines](docs/SECURITY.md) - Token management and security best practices
13+
-[Performance Guidelines](docs/PERFORMANCE.md) - Optimization and caching strategies
14+
915
## Features
1016

11-
- **Connect with GitHub**: Securely connect using GitHub Personal Access Tokens (PAT).
17+
- **Secure GitHub Integration**: Securely connect using GitHub Personal Access Tokens (PAT) with enhanced token management and automatic expiration.
1218
- **Organization and Repository Selection**: Choose which organizations and repositories you want to monitor within the dashboard.
1319
- **Pull Request Overview**: Get a consolidated view of all pull requests across your selected repositories.
14-
- **Issue Overview**: Get a consolidate view of all issues actross you selected repositories and organizations.
15-
- **Dark Mode**: Toggle between light and dark themes.
20+
- **Issue Overview**: Get a consolidated view of all issues across your selected repositories and organizations.
21+
- **Dark Mode**: Toggle between light and dark themes with persistent user preferences.
1622
- **Settings Management**: Easily manage your settings within the app. Setting sharing is now available via raw setting toggle.
1723
- **Repository Focus View**: Access repository view and navigate to see PRs and Issues for this particular repository.
24+
- **Enhanced Error Handling**: User-friendly error messages and notifications with automatic retry mechanisms.
25+
- **Performance Optimizations**: Efficient caching, rate limiting, and lazy loading for improved user experience.
1826

1927
## UI Example
2028

@@ -66,37 +74,140 @@ Follow these instructions to get your GitHub PR Dashboard up and running on your
6674
cd github-pr-dashboard
6775
```
6876

69-
3. Install the necessary dependencies:
77+
3. Configure environment variables (optional):
78+
79+
```bash
80+
cp .env.example .env.local
81+
```
82+
83+
Edit `.env.local` to customize API endpoints and rate limiting if needed. See [Environment Configuration](#environment-configuration) for details.
84+
85+
4. Install the necessary dependencies:
7086

7187
```bash
7288
npm install
7389
```
7490

75-
4. Start the application:
91+
5. Start the application:
7692

7793
```bash
7894
npm start
7995
```
8096

81-
This will run the app in development mode. Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
97+
This will run the app in development mode. Open [http://localhost:5173](http://localhost:5173) to view it in the browser.
98+
99+
## Security and Performance
100+
101+
This application implements enterprise-grade security and performance optimizations. For detailed information, see:
102+
103+
- 🔒 **[Security Guidelines](docs/SECURITY.md)** - Token security, CSP configuration, and best practices
104+
-**[Performance Guidelines](docs/PERFORMANCE.md)** - Caching strategies, optimization techniques, and monitoring
105+
- 🚀 **[Deployment Guide](docs/DEPLOYMENT.md)** - Production deployment with dynamic CSP and environment configuration
106+
107+
## Environment Configuration
108+
109+
The application can be customized using environment variables. Copy `.env.example` to `.env.local` and modify as needed:
110+
111+
```bash
112+
cp .env.example .env.local
113+
```
114+
115+
### Available Variables
116+
117+
| Variable | Default | Description |
118+
|----------|---------|-------------|
119+
| `VITE_GITHUB_API_URL` | `https://api.github.com` | GitHub API endpoint. Use your GitHub Enterprise Server URL if applicable |
120+
| `VITE_GITHUB_AVATAR_URL` | Auto-detected | GitHub avatar URL (optional - auto-detected from API URL) |
121+
| `VITE_GITHUB_BASE_URL` | Auto-detected | GitHub base URL (optional - auto-detected from API URL) |
122+
| `VITE_MAX_REQUESTS_PER_MINUTE` | `200` | Rate limit for API requests (1-5000) |
123+
124+
### Examples
125+
126+
**GitHub.com (default):**
127+
```env
128+
VITE_GITHUB_API_URL=https://api.github.com
129+
VITE_MAX_REQUESTS_PER_MINUTE=200
130+
```
131+
132+
**ACME GitHub Enterprise:**
133+
```env
134+
VITE_GITHUB_API_URL=https://ghe.acme.com/api/v3
135+
VITE_GITHUB_AVATAR_URL=https://avatars.ghe.acme.com
136+
VITE_GITHUB_BASE_URL=https://ghe.acme.com
137+
VITE_MAX_REQUESTS_PER_MINUTE=300
138+
```
139+
140+
**GitHub Enterprise Server:**
141+
```env
142+
VITE_GITHUB_API_URL=https://ghe.your-company.com/api/v3
143+
VITE_GITHUB_AVATAR_URL=https://avatars.ghe.your-company.com
144+
VITE_GITHUB_BASE_URL=https://ghe.your-company.com
145+
VITE_MAX_REQUESTS_PER_MINUTE=300
146+
```
147+
148+
**High-traffic deployment:**
149+
```env
150+
VITE_GITHUB_API_URL=https://api.github.com
151+
VITE_MAX_REQUESTS_PER_MINUTE=500
152+
```
153+
154+
### Features
155+
156+
- **Auto-detection**: Avatar and base URLs are automatically derived from the API URL if not specified
157+
- **Dynamic CSP**: Content Security Policy headers are automatically generated based on your GitHub environment
158+
- **Validation**: All URLs are validated during application startup
82159

83160
## How to Use
84161

85162
### Setting Up Your Personal Access Token
86163

87-
1. Log in to your GitHub account.Fv
164+
1. Log in to your GitHub account.
88165
2. Navigate to Settings > Developer settings > Personal access tokens > Generate new token.
89166
3. Select `repo` and `read:org` scopes.
90167
4. Generate the token and copy it.
91168

169+
**Security Note**: Your token is stored securely in session storage with automatic expiration for enhanced security.
170+
92171
### Connecting Your GitHub Account
93172

94173
- On the GitHub PR Dashboard, enter your PAT and connect your GitHub account.
174+
- The application will validate your token and provide feedback on successful authentication.
175+
- Your authentication session will automatically expire for security purposes.
95176

96177
### Selecting Repositories
97178

98179
- Choose the organizations and repositories you want to monitor through the dashboard.
99180

181+
## Troubleshooting
182+
183+
### Common Issues
184+
185+
**Authentication Failures**
186+
- Verify your token has the correct permissions (`repo` and `read:org`)
187+
- Check if your token has expired
188+
- Ensure you're connected to the internet
189+
190+
**No Pull Requests Showing**
191+
- Confirm you've selected repositories in the settings
192+
- Check if the repositories have any open pull requests
193+
- Verify your token has access to the selected repositories
194+
195+
**Rate Limiting**
196+
- The application automatically handles GitHub API rate limits
197+
- If you encounter rate limiting, wait a few minutes and try again
198+
- Consider reducing the number of monitored repositories if the issue persists
199+
200+
**Performance Issues**
201+
- Clear your browser cache and session storage
202+
- Reduce the number of monitored repositories
203+
- Check your internet connection speed
204+
- See [Performance Guidelines](docs/PERFORMANCE.md) for optimization tips
205+
206+
**Need Help?**
207+
- 📖 [Deployment Guide](docs/DEPLOYMENT.md) for production setup
208+
- 🔒 [Security Guidelines](docs/SECURITY.md) for token and security issues
209+
-[Performance Guidelines](docs/PERFORMANCE.md) for performance optimization
210+
100211
## Contributing
101212

102213
We welcome contributions to the GitHub PR Dashboard! Please read our [Contributing Guide](CONTRIBUTING.md) (when it will be available) for details on our code of conduct and the process for submitting pull requests to us.

0 commit comments

Comments
 (0)