A comprehensive time tracking system built for Student Government Association with Django REST API backend and Next.js frontends. Features role-based access control, IP-restricted kiosk mode, and comprehensive administrative tools.
- π Access Code Authentication: Simple 6-digit access codes for secure login
- β° Clock In/Out System: Track work hours with automatic IP logging
- π₯οΈ Dual Interface: Separate kiosk and administrative interfaces
- π₯ Role-Based Access: Admin, Chair, and Member roles with appropriate permissions
- π IP Restrictions: Secure kiosk access with IP allowlisting
- π Activity Tracking: Real-time activity logs and timesheet management
- π’ Committee Management: Organize users by committees and track team performance
- π Analytics: Time tracking reports and export capabilities
sga-time-tracking/
βββ apps/
β βββ clock-kiosk/ # Shared kiosk interface (Next.js) - Port 3000
β βββ members-hub/ # Administrative dashboard (Next.js) - Port 3001
β βββ api/ # Django REST API backend - Port 8000
βββ packages/
β βββ ui/ # Shared UI components (shadcn/ui)
β βββ eslint-config/ # Shared ESLint configuration
β βββ typescript-config/ # Shared TypeScript configuration
βββ docker-compose.yml # Docker orchestration
βββ CONTRIBUTING.md # Contribution guidelines
- Docker Desktop: Download here
- Node.js 20+: Download here
- pnpm: Install with
npm install -g pnpm
# 1. Clone the repository
git clone https://github.com/Computer-Science-Club-SCSU-University/sga-time-tracking.git
cd sga-time-tracking
# 2. Start Docker Desktop (choose your OS)
pnpm docker:start:mac # macOS
pnpm docker:start:linux # Linux
pnpm docker:start:win # Windows
# 3. Bootstrap the project (installs dependencies, sets up database)
pnpm bootstrap
# 4. Start all services
pnpm dev- Clock Kiosk: http://localhost:3000 (IP-restricted for shared terminals)
- Members Hub: http://localhost:3001 (Administrative interface)
- Django API: http://localhost:8000/api (REST API backend)
- Alice Johnson (Admin):
123456 - Bob Smith (Chair):
234567 - Carol Lee (Member):
345678
- Purpose: Shared terminal interface for quick clock in/out
- Security: IP-restricted access for authorized locations
- Features:
- Simple access code login
- One-click clock in/out
- Real-time activity log
- 2-minute session timeout for security
- Automatic logout and code clearing
- Purpose: Administrative dashboard for management
- Access: Role-based permissions (Admin, Chair, Member)
- Features:
- User and committee management
- Time tracking analytics
- Timesheet exports
- System administration
- Team oversight tools
- Purpose: REST API backend with role-based endpoints
- Features:
- Django REST Framework
- Session-based authentication
- PostgreSQL database
- Django migrations
- Custom middleware for IP restrictions
# Development
pnpm dev # Start all services
pnpm dev:detached # Start in background
pnpm dev:rebuild # Rebuild and start
pnpm logs # View logs
pnpm restart # Restart services
pnpm cleanup # Stop all services
# Database
pnpm db:migrate # Apply migrations
pnpm db:makemigrations # Create new migrations
pnpm db:reset # Reset database (WARNING: deletes data)
pnpm db:shell # PostgreSQL shell
pnpm api:shell # Django shell
# Code Quality
pnpm lint # Run linting
pnpm format # Format code
pnpm build # Build all packagesPOST /api/login/- Login with access codePOST /api/logout/- Logout current sessionGET /api/me/- Get current user information
POST /api/time-logs/clock_in/- Clock inPOST /api/time-logs/clock_out/- Clock outGET /api/time-logs/- Get user's time logsGET /api/time-logs/current_status/- Get current clock statusGET /api/time-logs/export_csv/- Export timesheet as CSV
GET /api/team/- Get team membersGET /api/team/{id}/member_timesheet/- Get member timesheetGET /api/committees/- Committee managementGET /api/admin/- System statistics (Admin only)
GET /api/users/- User managementPOST /api/admin/create_user/- Create new userDELETE /api/admin/{id}/delete_user/- Delete userGET /api/allowed-ips/- IP allowlist management
- Session-based Authentication: Secure session management with role-based access
- IP Restrictions: Clock kiosk access limited to authorized IP addresses
- CSRF Protection: API endpoints with proper CSRF handling
- CORS Configuration: Secure cross-origin resource sharing
- Environment Variables: Sensitive configuration externalized
- App-Specific Sessions: Separate session configurations for kiosk vs admin
users: Organization members with access codes and rolestime_logs: Clock in/out records with IP and timestamp trackingcommittees: Organizational committees and team structuresuser_committees: Many-to-many relationship between users and committeesallowed_ips: IP addresses authorized for kiosk access
The application runs in a containerized environment:
sga-time-tracking-db: PostgreSQL 15 databasesga-time-tracking-api: Django REST API backendsga-time-tracking-clock-kiosk: Next.js kiosk interfacesga-time-tracking-members-hub: Next.js administrative interface
All services communicate through a Docker network with proper health checks and dependency management.
To add components to your app, run the following command at the root:
pnpm dlx shadcn@latest add button -c apps/clock-kiosk
# or
pnpm dlx shadcn@latest add button -c apps/members-hubThis will place the UI components in the packages/ui/src/components directory.
Import components from the shared UI package:
import { Button } from "@workspace/ui/components/button"
import { Card, CardContent, CardHeader } from "@workspace/ui/components/card"The project uses Django migrations as the single source of truth for database schema:
# Create new migrations after model changes
pnpm db:makemigrations
# Apply migrations
pnpm db:migrate
# View migration status
docker compose exec api python manage.py showmigrationsWe welcome contributions! Please see our CONTRIBUTING.md for detailed guidelines on:
- Setting up the development environment
- Making changes and submitting pull requests
- Code style guidelines
- Project structure and common tasks
Look for issues labeled with:
good first issue- Great for beginnershelp wanted- We need help with thesedocumentation- Help improve our docs
Docker not starting?
# Make sure Docker Desktop is running
pnpm docker:start:mac # or linux/win
# Check if containers are running
docker compose psDatabase connection issues?
# Reset the database
pnpm db:reset
# Check database logs
docker compose logs dbCORS errors?
- Ensure you're accessing the correct ports (3000 for kiosk, 3001 for hub)
- Check that the API is running on port 8000
IP restrictions blocking access?
- Clock Kiosk (port 3000) has IP restrictions for security
- Members Hub (port 3001) should work from any IP
- Check allowed IPs with:
pnpm api:shellthenAllowedIP.objects.all()
This project is maintained by the Computer Science Club at SCSU University for the Student Government Association.
- GitHub Issues: Report bugs or request features
- GitHub Discussions: Ask questions and share ideas
- CS Club Discord: Join our community for real-time support
Built with β€οΈ by the CS Club Community for SGA