Skip to content

BruceGoodGuy/uno-tracker-v2-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Uno Tracker Backend API

License: MIT FastAPI Python PostgreSQL

๐Ÿšง Currently in Development - This API is actively being developed and is not yet ready for production use.

Backend API for the Uno Tracker application - A FastAPI-based REST API that handles user authentication, game management, and score tracking for Uno games.

โœจ Features

  • ๐Ÿ” JWT Authentication - Secure user authentication with access tokens
  • ๐Ÿ‘ค OAuth Integration - Google OAuth support for easy sign-in
  • ๐ŸŽฎ Game Management - Create, join, and manage Uno game sessions
  • ๐Ÿ“Š Score Tracking - Real-time score updates and game history
  • ๐Ÿ—„๏ธ PostgreSQL Database - Robust data persistence with SQLAlchemy ORM
  • ๐Ÿ”„ Database Migrations - Alembic for database schema management
  • ๐Ÿ“ API Documentation - Auto-generated OpenAPI/Swagger documentation
  • ๐ŸŒ CORS Support - Configured for frontend integration
  • โšก High Performance - Built with FastAPI for maximum speed

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8 or later
  • PostgreSQL 13 or later
  • pip (Python package manager)

Installation

  1. Clone the repository:
git clone https://github.com/BruceGoodGuy/uno-tracker-v2-backend.git
cd uno-tracker-backend
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
cp .env.example .env  # Create environment file
# Edit .env with your configuration

Required environment variables:

# Database
DATABASE_URL=postgresql://username:password@localhost:5432/uno_tracker
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_DB=uno_tracker

# JWT Configuration
SECRET_KEY=your-super-secret-jwt-key
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7

# OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# Frontend
FRONTEND_URL=http://localhost:3000
  1. Set up the database:
# Run database migrations
alembic upgrade head
  1. Start the development server:
uvicorn src.main:app --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000

๐Ÿ› ๏ธ Built With

๐Ÿ“ Project Structure

uno-tracker-backend/
โ”œโ”€โ”€ alembic/                    # Database migrations
โ”‚   โ”œโ”€โ”€ versions/              # Migration files
โ”‚   โ””โ”€โ”€ env.py                 # Migration environment
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ auth/                  # Authentication module
โ”‚   โ”‚   โ”œโ”€โ”€ models.py         # User and OAuth models
โ”‚   โ”‚   โ”œโ”€โ”€ router.py         # Auth endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ schemas.py        # Pydantic schemas
โ”‚   โ”‚   โ””โ”€โ”€ service.py        # Auth business logic
โ”‚   โ”œโ”€โ”€ core/                  # Core functionality
โ”‚   โ”‚   โ”œโ”€โ”€ config.py         # Configuration settings
โ”‚   โ”‚   โ”œโ”€โ”€ database.py       # Database connection
โ”‚   โ”‚   โ””โ”€โ”€ security.py       # Security utilities
โ”‚   โ”œโ”€โ”€ game/                  # Game management module
โ”‚   โ”‚   โ”œโ”€โ”€ models.py         # Game and score models
โ”‚   โ”‚   โ”œโ”€โ”€ router.py         # Game endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ schemas.py        # Game schemas
โ”‚   โ”‚   โ””โ”€โ”€ service.py        # Game business logic
โ”‚   โ”œโ”€โ”€ dependencies.py        # Shared dependencies
โ”‚   โ””โ”€โ”€ main.py               # FastAPI application
โ”œโ”€โ”€ alembic.ini               # Alembic configuration
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ””โ”€โ”€ README.md                # This file

๐Ÿ”Œ API Endpoints

Authentication

  • POST /auth/register - Register a new user
  • POST /auth/login - User login
  • POST /auth/refresh - Refresh access token
  • GET /auth/google - Google OAuth login
  • POST /auth/logout - User logout
  • GET /auth/me - Get current user info

Games (Coming Soon)

  • POST /games - Create a new game
  • GET /games - List user's games
  • GET /games/{game_id} - Get game details
  • POST /games/{game_id}/join - Join a game
  • POST /games/{game_id}/scores - Update game scores
  • DELETE /games/{game_id} - Delete a game

๐Ÿ“š API Documentation

Once the server is running, you can access:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc
  • OpenAPI JSON: http://localhost:8000/openapi.json

Manual Deployment

  1. Set environment variables for production
  2. Install dependencies: pip install -r requirements.txt
  3. Run migrations: alembic upgrade head
  4. Start with Gunicorn: gunicorn src.main:app -w 4 -k uvicorn.workers.UvicornWorker

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“‹ Development Roadmap

  • JWT Authentication system
  • Google OAuth integration
  • Database models and migrations
  • Complete game management endpoints
  • Real-time score tracking
  • User profile management
  • Game statistics and analytics
  • WebSocket support for live updates
  • API rate limiting
  • Docker containerization
  • CI/CD pipeline

๐Ÿ› Known Issues

  • Game management endpoints are still under development
  • WebSocket functionality not yet implemented
  • Comprehensive error handling needs improvement

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

BruceGoodGuy

๐Ÿ™ Acknowledgments

  • Thanks to the FastAPI team for the excellent framework
  • SQLAlchemy for the powerful ORM
  • PostgreSQL for robust data storage
  • All contributors and testers

โญ Star this repository if you find it helpful!

Releases

No releases published

Packages

 
 
 

Contributors