A full-stack time tracking application built with FastAPI and React. Track your time across projects with a modern Progressive Web App (PWA) interface.
- 🔐 JWT Authentication - Secure user registration and login
- 📊 RESTful API - Complete CRUD operations for users, projects, and time entries
- 🗄️ PostgreSQL Database - Robust data storage with SQLAlchemy ORM
- 🔄 Database Migrations - Alembic for schema management
- 📚 Auto-generated Documentation - Interactive API docs with Swagger/OpenAPI
- ⚡ Async Support - High-performance async database operations
- ⏱️ Real-time Timer - Start/stop time tracking with live duration updates
- 📱 Progressive Web App - Installable, works offline
- 🎨 Modern UI - Responsive design with Tailwind CSS and dark mode support
- 🔒 Protected Routes - Secure navigation with authentication
- 📊 Dashboard - Overview of daily/weekly time tracking statistics
- 🏷️ Project Management - Create and organize projects with color coding
- 📝 Time Entry Management - Edit, delete, and organize time entries
- 🌐 Offline Support - Works without internet connection (PWA features)
- FastAPI - Modern, fast web framework for Python
- SQLAlchemy - SQL toolkit and ORM
- PostgreSQL - Advanced open source database
- Alembic - Database migration tool
- Pydantic - Data validation using Python type annotations
- JWT - JSON Web Token for authentication
- bcrypt - Password hashing
- React 18 - Modern React with hooks
- TypeScript - Type-safe JavaScript
- Vite - Next generation frontend tooling
- Tailwind CSS - Utility-first CSS framework
- React Router - Declarative routing
- Zustand - Simple state management
- Axios - HTTP client
- date-fns - Modern date utility library
- Lucide React - Beautiful icons
- Docker - Containerization
- docker-compose - Multi-container Docker applications
timetracker/
├── backend/ # FastAPI Backend
│ ├── app/
│ │ ├── main.py # FastAPI app entry point
│ │ ├── core/ # Core functionality (config, security, database)
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── api/v1/ # API routes
│ │ └── services/ # Business logic
│ ├── alembic/ # Database migrations
│ ├── requirements.txt
│ └── Dockerfile
├── frontend/ # React PWA Frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API services
│ │ ├── store/ # Zustand stores
│ │ ├── types/ # TypeScript types
│ │ └── utils/ # Utility functions
│ ├── public/
│ ├── package.json
│ └── Dockerfile
├── docker-compose.yml # Development environment
├── .env.example # Environment variables template
└── README.md
- Docker and Docker Compose
- Node.js 18+ (for local development)
- Python 3.11+ (for local development)
-
Clone the repository
git clone <repository-url> cd timetracker
-
Create environment file
cp .env.example .env
-
Start the application
docker-compose up --build
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Navigate to backend directory
cd backend -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up database
# Make sure PostgreSQL is running alembic upgrade head -
Run the server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Navigate to frontend directory
cd frontend -
Install dependencies
npm install
-
Run development server
npm run dev
The API is automatically documented using FastAPI's built-in OpenAPI support. When the backend is running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- Login userGET /api/v1/auth/me- Get current user
GET /api/v1/projects- Get all projectsPOST /api/v1/projects- Create projectPUT /api/v1/projects/{id}- Update projectDELETE /api/v1/projects/{id}- Delete project
GET /api/v1/time-entries- Get all time entriesPOST /api/v1/time-entries- Start new time entryGET /api/v1/time-entries/active- Get active time entryPOST /api/v1/time-entries/{id}/stop- Stop time entryPUT /api/v1/time-entries/{id}- Update time entryDELETE /api/v1/time-entries/{id}- Delete time entry
- Register an account or login
- Navigate to the "Projects" page
- Click "New Project"
- Fill in project details and choose a color
- Save the project
- Go to the Dashboard
- Select a project from the dropdown
- Optionally add a description
- Click "Start Timer"
- The timer will run and show live updates
- Click "Stop Timer" when finished
- Navigate to "Time Entries"
- View all your recorded time
- Edit entries by clicking the edit icon
- Delete unwanted entries
- Stop running timers directly from the list
id: Primary keyemail: Unique email addresshashed_password: Bcrypt hashed passwordfull_name: Optional full nameis_active: Account statuscreated_at: Account creation timestamp
id: Primary keyname: Project namedescription: Optional descriptioncolor: Hex color code for UIuser_id: Foreign key to usersis_active: Project statuscreated_at: Creation timestamp
id: Primary keystart_time: When tracking startedend_time: When tracking stopped (null for running entries)description: Optional descriptionproject_id: Foreign key to projectsuser_id: Foreign key to userscreated_at: Creation timestamp
- Password Hashing: Bcrypt for secure password storage
- JWT Tokens: Stateless authentication
- CORS Configuration: Properly configured for frontend access
- Input Validation: Pydantic schemas validate all inputs
- SQL Injection Protection: SQLAlchemy ORM prevents SQL injection
- Protected Routes: All API endpoints require authentication
- Offline Support: Service worker caches essential assets
- Installable: Can be installed as a native app
- Responsive: Works on desktop, tablet, and mobile
- Network First: API calls with fallback to cache
- App Manifest: Proper PWA configuration
Create a new migration:
cd backend
alembic revision --autogenerate -m "Description of changes"Apply migrations:
alembic upgrade headBackend:
docker build -t timetracker-backend ./backendFrontend:
cd frontend
npm run build
docker build -t timetracker-frontend .DATABASE_URL=postgresql://postgres:postgres@localhost:5432/timetracker
SECRET_KEY=your-secret-key-change-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
VITE_API_URL=http://localhost:8000
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any problems or have questions, please open an issue on GitHub.