Skip to content

shhresth/Stratify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stratify

Stratify is a full-stack AI-assisted goal tracking platform for enterprise performance cycles. It supports employees, managers, and admins across the complete goal lifecycle: create goals, submit for approval, manager review, cycle locking, quarterly updates, scoring, reporting, and audit tracking.

Project Structure

  • backend/: Express API, Prisma schema, seed data, scoring logic, role-based workflow rules
  • frontend/: frontend workspace
  • frontend/startify/: active Next.js application

Tech Stack

  • Frontend: Next.js (App Router), React, TypeScript, NextAuth
  • Backend: Express, Node.js, Zod validation, JWT session auth
  • Database: PostgreSQL with Prisma ORM

Core Features

  • Role-based access for EMPLOYEE, MANAGER, ADMIN
  • Goal lifecycle with status transitions:
    • DRAFT
    • SUBMITTED
    • RETURNED
    • APPROVED
    • LOCKED
  • Structured goal measurement via UoM types:
    • MIN
    • MAX
    • TIMELINE
    • ZERO
  • Quarterly employee check-ins with computed achievement scoring
  • Manager check-in comments on approved/locked goals
  • Admin cycle controls (active quarter/year), unlock flow, and audit logs
  • Credentials login + Google OAuth (with frontend-to-backend user sync)

High-Level Architecture

  1. User signs in on Next.js (frontend/startify) using NextAuth.
  2. For Google login, frontend calls backend sync endpoint to upsert user and obtain backend JWT context.
  3. Frontend server routes (app/api/*) proxy workflow actions to Express backend.
  4. Backend enforces role and lifecycle rules, persists data with Prisma, and returns normalized goal/report payloads.

Backend Domain Model (Prisma)

Main entities:

  • User: role, reporting hierarchy (managerId), auth provider identity
  • Goal: ownership, approver manager, target definition, weightage, status
  • QuarterlyUpdate: periodic actuals, status, computed score
  • Approval: manager approval/return events with remarks
  • Checkin: manager comments per goal per cycle
  • AuditLog: locked-goal edit tracking
  • AppConfig: active quarter/year settings

API Overview

Health/auth:

  • GET /health
  • POST /api/auth/login
  • POST /api/auth/google
  • GET /api/auth/me

Reference data:

  • GET /api/users/managers
  • GET /api/public/managers

Goal workflow:

  • GET /api/goals
  • POST /api/goals
  • PUT /api/goals/:id
  • POST /api/goals/:id/submit
  • POST /api/goals/:id/checkin
  • POST /api/goals/:id/approve
  • POST /api/goals/:id/return
  • POST /api/goals/:id/manager-checkin
  • GET /api/goals/:id/checkins

Admin/reporting:

  • POST /api/admin/unlock-goal
  • GET /api/reports/achievement
  • GET /api/admin/completion-dashboard
  • GET /api/admin/cycle
  • POST /api/admin/cycle
  • GET /api/admin/audit

Business Rules Enforced in Backend

  • Auth required for protected routes
  • Role enforcement for manager/admin-only actions
  • Employee submission constraints:
    • maximum 8 goals
    • minimum 10% per-goal weightage
    • total weightage must be exactly 100%
  • Employee edits allowed only in DRAFT/RETURNED states
  • Check-in period must match active cycle (ACTIVE_QUARTER, ACTIVE_YEAR)
  • Admin unlock and locked-goal modifications are audit logged

Local Development Setup

Prerequisites:

  • Node.js 20+
  • npm 10+
  • PostgreSQL database

Create env files:

cp backend/.env.example backend/.env
cp frontend/startify/.env.example frontend/startify/.env.local

Install dependencies:

cd backend && npm install
cd ../frontend/startify && npm install

Initialize database (from backend/):

npm run prisma:generate
npm run db:push
npm run seed

Run development servers:

Terminal 1:

cd backend
npm run dev

Terminal 2:

cd frontend/startify
npm run dev

Defaults:

  • Frontend: http://localhost:3000
  • Backend: http://localhost:4000

Environment Variables

Backend (backend/.env):

  • DATABASE_URL
  • JWT_SECRET
  • NEXTAUTH_SECRET
  • AUTH_SYNC_SECRET
  • PORT
  • ACTIVE_QUARTER
  • ACTIVE_YEAR
  • CORS_ORIGIN

Frontend (frontend/startify/.env.local):

  • NEXTAUTH_URL
  • NEXTAUTH_SECRET
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • BACKEND_URL
  • BACKEND_SYNC_SECRET

Important:

  • NEXTAUTH_SECRET should match across frontend/backend.
  • AUTH_SYNC_SECRET (backend) must match BACKEND_SYNC_SECRET (frontend).

Seeded Demo Accounts

  • admin@demo.com / admin123
  • manager@demo.com / manager123
  • manager2@demo.com / manager234
  • employee@demo.com / employee123

Production

Frontend build:

cd frontend/startify
npm run build
npm run start

Backend start:

cd backend
npm run start

Deployment pattern:

  • Host frontend and backend as separate services.
  • Point frontend BACKEND_URL to backend public URL.
  • Set backend CORS_ORIGIN to frontend public URL.

Notes

  • Keep secrets in env files only; do not commit credentials.
  • If you change Prisma schema, run npm run prisma:generate and npm run db:push again in backend/.

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors