A modern, full-stack volleyball team management website with roster, stats, and video galleries.
A modern, responsive volleyball team management website with roster, stats, and video galleries.
- Frontend: React 19 + TypeScript + Vite → GitHub Pages (free)
- Backend: FastAPI + Python → Render (free tier)
- Database: MongoDB Atlas M0 (free tier, 512MB)
# Clone the repository
git clone https://github.com/castellbranco/ATP-website.git
cd ATP-website
# Run setup script (creates .env files)
chmod +x setup.sh
./setup.shFrontend (.env):
VITE_API_URL=http://localhost:8000
# For production builds set:
# VITE_API_URL=https://atp-volleyball-api.onrender.comBackend (backend/.env):
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/...
DATABASE_NAME=atp_volleyball
ADMIN_TOKEN_SECRET=your-secret-hereGitHub Actions automatically runs tests on every PR and deploys to GitHub Pages:
- Tests: Run on every pull request (frontend + backend)
- Deploy: Automatic deployment to GitHub Pages on push to
dev - Status: Check badges at the top of this README
View workflow runs in the Actions tab.
See backend/.env.example for detailed instructions.
Terminal 1 - Backend:
cd backend
pdm install # or: pip install -r requirements.txt
pdm run dev # or: uvicorn app.main:app --reloadTerminal 2 - Frontend:
npm install
npm run devVisit: http://localhost:5173
Pick the guide under deployment/ that matches how you like to work:
QUICK-DEPLOY.md– 5-minute GitHub Pages push for a frontend-only launch.DEPLOYMENT-CHECKLIST.md– Complete checklist that covers frontend, backend, and MongoDB with status boxes.DEPLOYMENT-CHECKLIST-RENDER.md– Render-specific variant if you're hosting everything there.DEPLOYMENT.md– Long-form reference with troubleshooting notes and background context.DEPLOYMENT-SETUP-SUMMARY.md– One-page TL;DR plus the exact commands to run.RENDER-DEPLOYMENT.md– Full Render walk-through powered bydeployment/render.yaml.
- Phase 1 – Frontend only (≈5 min): push the repo to GitHub, enable Pages, confirm the SPA loads (data is ephemeral).
- Phase 2 – Full stack (+≈30 min): provision MongoDB Atlas, deploy the FastAPI backend (Render/Railway), set
VITE_API_URL, and verify admin CRUD.
# Push your latest changes
git add .
git commit -m "Deploy volleyball app"
git push origin dev- Frontend (React SPA) – Lives in
src/, deploys to GitHub Pages, renders roster, stats, videos, and admin UI. - Backend (FastAPI) – Lives in
backend/, deploys to Render/Railway, exposes REST endpoints for persistent data. - Database (MongoDB Atlas) – Stores players, stats, videos, and admin accounts that power the backend.
- Code lives on GitHub and CI passes.
- GitHub Pages serves the site at
https://<user>.github.io/<repo>/. - Backend health check (
/healthor/docs) responds from Render/Railway. - Admin panel loads with
?admin=true, accepts credentials, and saves data. - Added players/stats persist across refreshes.
- Use the troubleshooting sections inside
deployment/DEPLOYMENT.mdfor build, backend, or database issues. - Inspect GitHub Actions logs for frontend build errors and Render logs for backend issues.
- Search the exact error message—most fixes are already documented in those guides.
src/App.tsxnow bootstraps roster, stats, and season data fromVITE_API_URLon load. The existing Spark/IndexedDB store remains as a local cache that powers the public tabs and the admin UI.- Backend exposes a
GET /snapshotendpoint that returns all public data in one shot; the SPA now relies exclusively on this endpoint for reads, keeping free-tier traffic to a single request per load. - Local development: keep
VITE_API_URL=http://localhost:8000and runbackend(pdm run dev). - Production build: set
VITE_API_URL=https://atp-volleyball-api.onrender.com(or your Render URL) before runningnpm run build. - GitHub Pages deploy workflow already passes along the
VITE_API_URLsecret—set it in Settings → Secrets → Actions so production builds point to the Render API automatically.
Want to deploy to production? See RENDER-DEPLOYMENT.md for a complete step-by-step guide to deploy:
- Backend to Render (free)
- Database on MongoDB Atlas (free)
- Frontend to GitHub Pages (free)
Total cost: $0/month 🎉
npm run dev # Start dev server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLintcd backend
pdm run dev # Development server with auto-reload
pdm run start # Production serverAPI Documentation: http://localhost:8000/docs
The frontend uses Vitest and React Testing Library for testing.
# Run all frontend tests
npm run test
# Run tests in watch mode
npm run test -- --watch
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverageTest Coverage:
- UI Components (Button, Badge, Card)
- Custom Hooks (useIsMobile)
- Utility Functions (cn)
- Total: 29 frontend tests
The backend uses pytest for testing.
# Navigate to backend directory
cd backend
# Install dependencies
pip install -r requirements.txt
# Run all tests
pytest tests/ -v
# Run tests with coverage
pytest tests/ -v --cov=app --cov-report=term-missing
# Run specific test file
pytest tests/test_players.py -vTest Coverage:
- Player Routes/Endpoints (12 tests)
- Stats Routes/Endpoints (9 tests)
- Season Routes/Endpoints (7 tests)
- Service Layer (14 tests)
- Models/Data Validation (11 tests)
- Total: 50 backend tests
The project includes automated code formatting and linting tools to maintain code quality and consistency.
The repository uses pre-commit to automatically check and format code before commits:
# Install pre-commit (if not already installed)
pip install pre-commit
# Install the git hooks
pre-commit install
# Run pre-commit manually on all files
pre-commit run --all-filesFormat and lint frontend code:
npm run precommitThis runs:
- ESLint - Lints and auto-fixes JavaScript/TypeScript code
- Prettier - Formats code for consistent style
Individual commands:
npm run lint # Lint code
npm run lint:fix # Lint and auto-fix
npm run format # Format with PrettierFormat and lint backend code:
cd backend
pdm run precommitThis runs:
- isort - Sorts Python imports
- black - Formats Python code
- flake8 - Lints Python code
Individual commands:
pdm run isort app/ tests/ # Sort imports
pdm run black app/ tests/ # Format code
pdm run flake8 app/ tests/ # Lint codeFrontend:
Backend:
Both:
- pre-commit - Git hook framework
ATP-website/
├── src/ # Frontend React app
│ ├── components/
│ │ ├── sections/ # Main page sections
│ │ ├── admin/ # Admin components
│ │ └── ui/ # shadcn/ui components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities & API config
│ └── App.tsx # Main app component
│
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── main.py # FastAPI app entry
│ │ ├── config.py # Configuration
│ │ ├── database.py # MongoDB connection
│ │ ├── models/ # Pydantic models
│ │ ├── routes/ # API endpoints
│ │ └── services/ # Business logic
│ ├── requirements.txt
│ └── pyproject.toml
│
├── .github/workflows/ # GitHub Actions
│ └── deploy.yml # Auto-deploy to GitHub Pages
│
├── deployment/ # Deployment docs & configs
│ ├── render.yaml
│ ├── DEPLOYMENT.md
│ ├── DEPLOYMENT-CHECKLIST.md
│ ├── DEPLOYMENT-CHECKLIST-RENDER.md
│ ├── DEPLOYMENT-SETUP-SUMMARY.md
│ ├── QUICK-DEPLOY.md
│ └── RENDER-DEPLOYMENT.md
- React 19 with TypeScript
- Vite for blazing-fast builds
- Tailwind CSS v4 for styling
- shadcn/ui component library
- Framer Motion for animations
- Recharts for data visualization
- FastAPI for modern Python APIs
- MongoDB with Motor async driver
- Pydantic for data validation
- python-dotenv for environment management
- Go to Settings → Pages
- Source: GitHub Actions
- Add secret:
VITE_API_URLwith your Render backend URL - Push to
mainbranch → Auto-deploys!
- Connect your GitHub repo to Render
- Use the included
deployment/render.yamlfor one-click setup - Add environment variables (MongoDB URI, secrets)
- Deploy!
See RENDER-DEPLOYMENT.md for detailed instructions.
- Never commit
.envfiles (already in.gitignore) - Generate strong secrets:
openssl rand -hex 32 - Use environment variables for all credentials
- MongoDB Atlas IP whitelist configured
- CORS properly configured for production
- deployment/QUICK-DEPLOY.md - 5 minute GitHub Pages launch.
- deployment/DEPLOYMENT-CHECKLIST.md - Step-by-step full stack checklist.
- deployment/DEPLOYMENT-CHECKLIST-RENDER.md - Render-specific tasks.
- deployment/DEPLOYMENT-SETUP-SUMMARY.md - One-page overview + prereqs.
- deployment/DEPLOYMENT.md - Long-form reference + troubleshooting.
- deployment/RENDER-DEPLOYMENT.md - Full Render walkthrough and
render.yaml. - Backend API Docs - Swagger UI (when running)
- backend/README.md - Backend-specific setup
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally
- Submit a pull request
MIT License - feel free to use this project!
Made with ❤️ for ATP Volleyball Team