Self-managed attendance tracking for Kavelogics employees. Not affiliated with the company — it's a tool we use among ourselves to compare against HR records.
See SPEC.md for the full product specification and policies.md for the rules that drive the math.
- Next.js 16 (App Router) + Tailwind CSS
- Drizzle ORM + PostgreSQL (Supabase)
- NextAuth v5 (email + password)
- Hosted on Vercel
npm install- Create a free project at supabase.com.
- In Project Settings → Database, copy the Connection string (use the Session pooler / Transaction pooler URI for serverless).
- Paste it into
.envasDATABASE_URL.
Copy .env.example to .env and fill in:
cp .env.example .envGenerate AUTH_SECRET:
openssl rand -base64 32npm run db:pushThis creates all tables. For migrations later, use npm run db:generate then npm run db:migrate.
npx tsx scripts/create-admin.ts you@example.com "Your Name" "your-strong-password"npm run devOpen http://localhost:3000 and sign in with the admin you just created.
- Sign in as admin, go to Admin → Departments and add your departments (Development, Design, HR, BD).
- Optionally add Holidays.
- Toggle Settings → Open registration if you don't want to manually approve every signup.
- Share the URL with your team — they self-register, you approve them.
- Everyone uses the Today page to clock in/out. Calendar and Reports show the rest.
The project is built for Vercel:
- Push to GitHub.
- Import the repo into Vercel.
- Add environment variables (
DATABASE_URL,AUTH_SECRET,AUTH_URL,CRON_SECRET,RESEND_API_KEY,EMAIL_FROM,NEXT_PUBLIC_APP_URL). - Deploy.
The vercel.json schedules /api/cron/auto-absent daily at 00:05 UTC to mark missed weekday clock-ins as absent. Set CRON_SECRET to protect the endpoint.
src/
app/
(auth)/ # /login, /register, /forgot, /reset
(app)/ # authenticated app: dashboard, calendar, reports, support, admin
api/ # API routes
pending/ # holding page for users awaiting approval
components/ # ClockButton, AppShell, NotificationBell, TicketThread, UI primitives
db/ # Drizzle schema and client
lib/ # policy.ts (overtime/hours math), attendance.ts (queries), utils.ts
auth.ts # NextAuth config
middleware.ts # session + role gates
scripts/
create-admin.ts # bootstrap the first admin
drizzle/ # generated migrations