The Etros Basketball SPA is a single-page application built with React that serves as a comprehensive website for a basketball team named "Etros". The website provides information about the team, news, schedule, player details, and includes an administrative section for content management.
Follow these steps to run the project locally:
-
Clone the repository and navigate to project directory
cd etros-spa
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser
- The application will be running at
http://localhost:5173
- You should see the Etros Basketball homepage
- Note: The backend API may take 30 seconds to 1 minute to wake up on first request, as it's hosted on a free tier service that goes to sleep after inactivity
- The application will be running at
You can use these accounts to test different roles in the application:
Email: admin@example.com
Password: TestPassword123
Email: user1@example.com
Password: TestPassword123
Email: user2@example.com
Password: TestPassword123
- Frontend Framework: React 19
- Routing: React Router 7
- Styling: Tailwind CSS 4
- HTTP Client: Axios
- Date Management: date-fns
- Build Tool: Vite 6
etros-spa/
├── public/ # Static assets
├── src/ # Source code
│ ├── api/ # API integration modules
│ ├── components/ # React components organized by feature
│ ├── context/ # React context for state management
│ ├── hooks/ # Custom React hooks
│ ├── layout/ # Layout components
│ ├── services/ # Business logic services
│ ├── utils/ # Utility functions
│ ├── App.jsx # Main application component
│ ├── App.css # Global styles
│ └── main.jsx # Application entry point
├── index.html # HTML entry point
├── package.json # Project dependencies and scripts
└── vite.config.js # Vite configuration
-
Public-Facing Pages:
- Home page with team highlights, latest news, upcoming matches, and sponsors
- Team roster and player details
- Match schedule and match details
- News section with articles
- About page
-
Authentication System:
- User registration
- User login
- Protected routes
-
Admin Panel:
- News management (create, update, delete articles)
- Matches management (schedule, results)
- Players management (roster, profile information)
- Player statistics management
The application uses React Router for navigation with the following route structure:
/
- Home page/team
- Team roster/team/player/:id
- Individual player profile/schedule
- Match schedule/match/:id
- Individual match details/news
- News listings/news/article/:id
- Individual news article/about
- About the team/login
- Login page (accessible only to non-authenticated users)/register
- Registration page (accessible only to non-authenticated users)
/admin
- Admin dashboard (default: news management)/admin/news
- News management/admin/matches
- Matches management/admin/players
- Players management/admin/player-statistics
- Player statistics management
The application uses React Context API for state management:
UserContext
- Manages user authentication state, provides login and logout functionality
The application communicates with a backend API through the following modules:
authApi.js
- Authentication operations (login, register, profile)articleApi.js
- News article operationsplayerApi.js
- Player information operationsmatchApi.js
- Match scheduling and results operationsplayerStatsApi.js
- Player statistics operationscommentApi.js
- User comments operations
Components are organized by feature/page:
Admin/
- Administrative interface componentsAuth/
- Authentication componentsHome/
- Homepage componentsNews/
- News-related componentsTeam/
- Team roster and player componentsMatch/
- Match details componentsSchedule/
- Schedule-related componentsAbout/
- About page componentsNavigation/
- Header navigation componentsFooter/
- Footer componentsshared/
- Reusable UI components
The application implements authentication using JWT tokens:
- Tokens are stored in localStorage
- Protected routes redirect unauthenticated users
- Admin routes are restricted to admin users only
To work with this project:
-
Installation:
npm install
-
Development Server:
npm run dev
-
Build for Production:
npm run build
-
Preview Production Build:
npm run preview
Potential areas for future development:
- Implement real-time updates for match scores
- Add user comments and interaction features on news articles
- Enhance player statistics visualization
- Add multi-language support
- Implement performance optimizations for image loading