A professional-grade web application for tracking and analyzing running activities through Strava integration. Built with modern web technologies and industry best practices.
- Secure Authentication: JWT-based user registration and login with bcrypt password hashing
- Strava Integration: OAuth flow for connecting and syncing Strava running activities
- Activity Dashboard: Comprehensive view of running metrics with search, filtering, and pagination
- Goal Tracking: Built-in 2025 goal tracking with progress visualization
- Real-time Sync: Refresh activities from Strava with token management
- Responsive Design: Professional UI that works on desktop and mobile devices
- TypeScript: Full type safety across the application
- Security-First: Rate limiting, input validation, and secure token storage
- Node.js 18.x or later
- npm or yarn
- AWS Account (for DynamoDB)
- Strava Developer Account
-
Clone the repository
git clone <repository-url> cd double-dash
-
Install dependencies
# Backend cd backend npm install # Frontend cd ../client npm install
-
Environment Setup
Backend (.env)
cd backend cp .env.example .env # Edit .env with your actual values
Frontend (.env.local)
cd client cp .env.example .env.local # Edit .env.local with your actual values
-
Start Development Servers
# Terminal 1 - Backend cd backend npm run dev # Terminal 2 - Frontend cd client npm start
-
Access the Application
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
backend/src/
βββ controllers/ # Request handlers and business logic
βββ middleware/ # Authentication, validation, error handling
βββ models/ # Data models and database interactions
βββ routes/ # API route definitions
βββ utils/ # Helper functions and utilities
βββ validators/ # Input validation schemas
βββ config/ # Database and configuration
Key Features:
- Modular Architecture: Clean separation of concerns
- Security Middleware: Helmet, CORS, rate limiting
- Input Validation: Joi schemas for all endpoints
- Error Handling: Centralized error management
- JWT Authentication: Secure token-based auth
- AWS DynamoDB: NoSQL database for scalability
client/src/
βββ components/ # React components
βββ types/ # TypeScript type definitions
βββ styles/ # Styled-components theme and components
βββ utils/ # Helper functions
βββ config.ts # Environment configuration
Key Features:
- TypeScript: Full type safety
- Styled Components: Modern CSS-in-JS architecture
- Responsive Design: Mobile-first approach
- Component Library: Reusable UI components
- Theme System: Consistent design tokens
Backend Scripts:
npm start # Start production server
npm run dev # Start development server with nodemon
npm run deploy # Deploy to AWS Elastic Beanstalk
npm run lint # Code linting (to be configured)
npm run format # Code formatting (to be configured)Frontend Scripts:
npm start # Start development server
npm run build # Create production build
npm test # Run test suite
npm run deploy # Deploy to AWS S3/CloudFrontBackend Testing:
cd backend
npm test # Run backend tests (to be implemented)Frontend Testing:
cd client
npm test # Run React tests
npm test -- --watch # Run tests in watch mode
npm test -- --coverage # Run tests with coverageLinting and Formatting:
# Frontend
npm run lint # ESLint
npm run format # Prettier
# Backend
npm run lint # ESLint
npm run format # Prettier| Variable | Description | Required | Example |
|---|---|---|---|
STRAVA_CLIENT_ID |
Strava OAuth client ID | β | 12345 |
STRAVA_CLIENT_SECRET |
Strava OAuth client secret | β | abc123... |
AWS_ACCESS_KEY_ID |
AWS access key | β | AKIA... |
AWS_SECRET_ACCESS_KEY |
AWS secret key | β | xyz789... |
AWS_REGION |
AWS region | β | us-west-2 |
JWT_SECRET |
JWT signing secret | β | random-string |
JWT_REFRESH_SECRET |
JWT refresh token secret | β | random-string |
NODE_ENV |
Environment | β | development |
PORT |
Server port | β | 3001 |
| Variable | Description | Required | Example |
|---|---|---|---|
REACT_APP_API_BASE_URL |
Backend API URL | β | http://localhost:3001 |
REACT_APP_FRONTEND_URL |
Frontend URL | β | http://localhost:3000 |
REACT_APP_STRAVA_CLIENT_ID |
Strava client ID | β | 12345 |
The application is deployed using the following AWS services:
- Frontend: S3 + CloudFront + Route 53
- Backend: Elastic Beanstalk
- Database: DynamoDB
- DNS: Route 53
Frontend Deployment:
cd client
npm run deployBackend Deployment:
cd backend
npm run deployProduction URLs:
- Frontend: https://doubledash.ai
- Backend API: https://api.doubledash.ai
Development URLs:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
Register a new user account.
Request Body:
{
"email": "user@example.com",
"password": "SecureP@ssw0rd"
}Response:
{
"message": "User registered successfully",
"user": {
"userId": "uuid",
"email": "user@example.com",
"preferences": {},
"createdAt": "2025-01-01T00:00:00.000Z"
},
"token": "jwt-token"
}Authenticate an existing user.
Request Body:
{
"email": "user@example.com",
"password": "SecureP@ssw0rd"
}Get current user profile (requires authentication).
Exchange Strava authorization code for access token.
Request Body:
{
"code": "strava-auth-code"
}Get user's stored activities.
Refresh activities from Strava.
All endpoints return consistent error responses:
{
"error": "Error message",
"code": "ERROR_CODE",
"details": {}
}- Password Hashing: bcrypt with salt rounds
- JWT Tokens: Secure authentication tokens
- Rate Limiting: Protection against brute force attacks
- Input Validation: Joi schemas for all inputs
- CORS: Configured for specific origins
- Helmet: Security headers middleware
- Environment Variables: No secrets in code
Backend won't start:
# Check if .env file exists and has all required variables
ls -la backend/.env
cat backend/.env.example
# Check DynamoDB connection
# Ensure AWS credentials are validFrontend build fails:
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
# Check TypeScript errors
npm run buildStrava OAuth fails:
# Verify Strava client ID and redirect URI
# Check if REACT_APP_STRAVA_CLIENT_ID is set
# Ensure redirect URI matches Strava app settingsEnable debug logging:
# Backend
DEBUG=* npm run dev
# Frontend
REACT_APP_DEBUG=true npm start- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use TypeScript for all new code
- Follow existing naming conventions
- Add JSDoc comments for functions
- Write tests for new features
- Use semantic commit messages
- Code splitting with React.lazy()
- Image optimization
- Bundle analysis with webpack-bundle-analyzer
- Service worker for caching
- DynamoDB indexing for fast queries
- Connection pooling
- Response caching
- Compression middleware
This project is licensed under the MIT License - see the LICENSE file for details.
- Strava API for activity data
- Create React App for frontend boilerplate
- Express.js for backend framework
- AWS for cloud infrastructure
Built with β€οΈ by the DoubleDash team