Self‑hosted time tracking and leave management for small and mid‑sized companies.
Readme was generated with Cursor. Thanks.
- ⏱️ Clock in / clock out / breaks
- 📊 Live calculation of daily working time
- 📈 Automatic flex time balance
- 🗓️ Automatic public holiday handling (per German state)
- 📝 Request & approval workflow (employee → supervisor / HR / admin)
- 📅 Team calendar with overlaps and department colors
- 🧮 Automatic leave day calculation (incl. weekends/holidays handling)
- 📋 Multiple leave types (vacation, sick, unpaid, special leave, etc.)
- 👑 Admin: Full access, user & department management, manual corrections, reporting
- 👔 Supervisor: Team overview, approval of leave and time correction requests
- 👤 User: Personal time tracking, leave requests, personal reports
- 📊 Monthly and yearly overviews per employee
- 📁 CSV export of monthly timesheets (admin)
- 📝 Audit log for administrative changes and approval/correction history
- 🔔 In-app notifications for leave and time-correction approvals/rejections
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Database: PostgreSQL
- ORM: Prisma
- UI: Tailwind CSS + shadcn/ui
- Auth: NextAuth.js (credentials)
- Deployment: Docker & Docker Compose
- Node.js 20+
- PostgreSQL 16+ (or Docker)
- npm / pnpm / yarn
-
Clone the repository
git clone https://github.com/your-repo/TimeTime.git cd TimeTime -
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env.local # then adjust .env.local (DATABASE_URL, NEXTAUTH_SECRET, etc.) -
Start a local PostgreSQL via Docker (optional)
docker run -d \ --name TimeTime-db \ -e POSTGRES_USER=TimeTime \ -e POSTGRES_PASSWORD=TimeTime_secure_password \ -e POSTGRES_DB=TimeTime \ -p 5432:5432 \ postgres:16-alpine
-
Apply the database schema
npm run db:push
-
Seed demo data
npm run db:seed
-
Start the dev server
npm run dev
-
Open the app
http://localhost:3000
-
Create
.envfor productioncp .env.example .env # adjust: NEXTAUTH_SECRET (32+ chars), POSTGRES_PASSWORD, NEXTAUTH_URL, etc. -
Start services
docker compose up -d
-
Run migrations + seed (one‑time setup)
docker compose --profile setup run migrate
-
Open the app
http://localhost:3000(or behind your reverse proxy, e.g.https://timetime.ecow.dev)
After running npm run db:seed you get the following demo accounts:
| Role | Description | Password | |
|---|---|---|---|
| Admin (CEO) | Management | ceo@TimeTime.local |
admin123 |
| Admin (HR) | HR / People | hr@TimeTime.local |
admin123 |
| Role | Description | Password | |
|---|---|---|---|
| Supervisor | Head of Development | lead.dev@TimeTime.local |
user123 |
| User (FT) | Developer full‑time | anna.dev@TimeTime.local |
user123 |
| User (PT) | Developer part‑time | ben.dev@TimeTime.local |
user123 |
| User (PT) | Developer part‑time | cora.dev@TimeTime.local |
user123 |
| Role | Description | Password | |
|---|---|---|---|
| Supervisor | Head of Sales | lead.sales@TimeTime.local |
user123 |
| User (FT) | Sales full‑time | david.sales@TimeTime.local |
user123 |
| User (PT) | Sales part‑time | eva.sales@TimeTime.local |
user123 |
| User (PT) | Sales part‑time | finn.sales@TimeTime.local |
user123 |
Demo data notes:
- All users have sample time entries for the last weeks and a mix of pending and approved leave requests in the current year.
- Supervisors can approve leave requests and time correction requests for their team members (and for delegated users via the delegation rules).
- All approvals/rejections/cancellations of leave and time-correction requests are written to the central Audit Log and visible on the
/admin/auditpage. - Admins (CEO/HR) have full access, including CSV export under
Reports→ Export (CSV) and the full audit history.
TimeTime/
├── prisma/
│ ├── schema.prisma # Database schema
│ └── seed.ts # Demo data seeding
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── (auth)/ # Auth routes (login)
│ │ ├── (dashboard)/ # Dashboard routes
│ │ └── api/ # API routes
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui components
│ │ ├── layout/ # Layout components
│ │ ├── time/ # Time tracking components
│ │ └── leave/ # Leave management components
│ ├── lib/ # Services, utilities (auth, time, leave, admin)
│ ├── hooks/ # React hooks
│ └── types/ # TypeScript types
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Production Dockerfile (standalone Next.js)
└── README.md
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | – |
NEXTAUTH_SECRET |
Secret for NextAuth | – |
NEXTAUTH_URL |
Public app URL | http://localhost:3000 |
TZ |
Time zone | Europe/Berlin |
DEFAULT_REGION |
Default region for holidays (DE-XX) | DE-BY |
DEFAULT_ANNUAL_LEAVE_DAYS |
Default leave entitlement | 30 |
Supported federal states (ISO 3166‑2 codes) for automatic holiday calculation:
- DE-BW, DE-BY, DE-BE, DE-BB, DE-HB, DE-HH, DE-HE,
- DE-MV, DE-NI, DE-NW, DE-RP, DE-SL, DE-SN, DE-ST, DE-SH, DE-TH
This project exposes an OpenAPI 3 spec and a Swagger UI:
- OpenAPI JSON:
GET /api/openapi - Swagger UI:
GET /docs
Most routes require an authenticated session (NextAuth). The OpenAPI spec uses a cookie-based security scheme (sessionCookie) as the default.
- Yes (runtime): All API routes under
src/app/api/**/route.tsare available when the app is running. - OpenAPI coverage: The spec currently lists all major endpoints (admin, time, leave, profile, notifications, audit, auth). Some request/response bodies are still described on a higher level (we can incrementally add full schemas).
GET /api/healthPOST /api/auth/signin # login
POST /api/auth/signout # logout
GET /api/auth/session # current sessionPOST /api/time/clock # clock in/out, start/end break
GET /api/time/status # today's status (entries, totals, flex)
GET /api/time/summary # monthly daily summaries
GET /api/time/entries # raw time entries for a period
GET /api/time/corrections # own correction requests
GET /api/time/corrections/pending # pending corrections for supervisor/admin
POST /api/time/corrections # create correction request
POST /api/time/corrections/:id/approve # approve correction
POST /api/time/corrections/:id/reject # reject correctionGET /api/leave # own leave requests
POST /api/leave # create leave request
GET /api/leave/:id # request details
POST /api/leave/:id/approve # approve (supervisor/admin)
POST /api/leave/:id/reject # reject (supervisor/admin)
GET /api/leave/balance # current leave balance
GET /api/leave/calendar # team calendar
GET /api/leave/pending # pending approvals for supervisor/adminGET /api/notifications # latest per-user notifications (derived from AuditLog / Notification)Contributions are welcome!
Feel free to open an issue or a pull request if you find bugs or want to add features.
This project is licensed under the GNU General Public License v3.0 (GPL‑3.0).
See LICENSE for the full license text.
Built with ❤️ for modern, transparent time tracking.