Skip to content

erktec/march-pushups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

March Pushups Challenge

A web application for tracking pushups throughout the month of March. Users can register, log their daily pushups, view leaderboards, and track their progress with charts.

Features

  • User Registration & Authentication: Simple username/password registration and login
  • Pushup Tracking: Enter pushups for any date in March (not future dates)
  • Leaderboard: See rankings of all participants
  • Progress Charts: Visualize your pushup progress over time
  • Entry Management: Edit or delete previous entries

Tech Stack

  • Backend: FastAPI (Python 3.11)
  • Database: PostgreSQL 15
  • Frontend: Server-rendered HTML with Jinja2 templates
  • Styling: Porto HTML5 theme
  • Deployment: Docker Compose

Quick Start

Prerequisites

  • Docker and Docker Compose installed
  • Port 8090 available (or configure a different port)

Running with Docker Compose

  1. Clone the repository:
cd march-pushups
  1. Create a .env file (optional, defaults are provided):
POSTGRES_USER=pushups
POSTGRES_PASSWORD=pushups_pass
POSTGRES_DB=pushups_db
SECRET_KEY=your-secret-key-here
PORT=8090
ENVIRONMENT=development
  1. Start the application:
docker-compose up -d
  1. Access the application:
  • Open your browser to http://localhost:8090
  • Register a new account or login

Database Migrations

The database tables are automatically created on first startup. If you need to run migrations manually:

docker-compose exec backend alembic upgrade head

Project Structure

march-pushups/
├── backend/
│   ├── app/
│   │   ├── routes/          # API routes
│   │   ├── templates/       # Jinja2 templates
│   │   ├── static/          # Static files (CSS, JS, themes)
│   │   ├── models.py        # SQLAlchemy models
│   │   ├── schemas.py       # Pydantic schemas
│   │   ├── auth.py          # Authentication utilities
│   │   ├── db.py            # Database configuration
│   │   └── main.py          # FastAPI application
│   ├── alembic/             # Database migrations
│   ├── Dockerfile
│   └── requirements.txt
├── docker-compose.yml
└── README.md

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login
  • GET /api/auth/me - Get current user info
  • POST /api/auth/logout - Logout

Pushups

  • GET /api/pushups/ - Get user's pushup entries
  • POST /api/pushups/ - Create a new entry
  • PUT /api/pushups/{id} - Update an entry
  • DELETE /api/pushups/{id} - Delete an entry
  • GET /api/pushups/all - Get all entries (for dashboard)

Dashboard

  • GET /api/dashboard/stats - Get dashboard statistics and leaderboard
  • GET /api/dashboard/user/{id}/stats - Get specific user stats

Development

Running Locally (without Docker)

  1. Install dependencies:
cd backend
pip install -r requirements.txt
  1. Set up PostgreSQL database

  2. Set environment variables:

export DATABASE_URL=postgresql://pushups:pushups_pass@localhost:5432/pushups_db
export SECRET_KEY=your-secret-key
  1. Run migrations:
alembic upgrade head
  1. Start the server:
uvicorn app.main:app --reload

Notes

  • The application tracks pushups specifically for March (March 1-31 of the current year)
  • Users cannot enter pushups for future dates
  • Each user can only have one entry per date
  • The leaderboard shows total pushups, days active, and average per day
  • All dates are stored in Eastern Time (US/Eastern)

License

This project is for personal use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors