SprintIQ is built with a modern, scalable architecture using a Next.js frontend with a Node.js/Express backend, PostgreSQL database, and Clerk authentication.
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: TailwindCSS with custom design system
- UI Components: Radix UI primitives with custom styling
- State Management: Zustand for client state, TanStack Query for server state
- Charts: Recharts for data visualization
- Authentication: Clerk React components
- Framework: Express.js with TypeScript
- Database: PostgreSQL with Prisma ORM
- Authentication: Clerk backend SDK
- Job Queue: BullMQ for background processing
- Validation: Zod for request validation
- Logging: Custom logger utility
- Primary Database: PostgreSQL 15+
- ORM: Prisma for type-safe database access
- Migrations: Prisma migrate for schema management
- Schema: See
prisma/schema.prismafor complete data model
- Provider: Clerk for user management
- OAuth: GitHub OAuth integration
- Middleware: Custom Clerk middleware for API routes
- Frontend: Clerk React hooks and components
sprintiq/
├── src/ # Frontend source code
│ ├── app/ # Next.js app directory
│ │ ├── api/ # API route handlers
│ │ ├── dashboard/ # Dashboard pages
│ │ ├── sign-in/ # Clerk sign-in pages
│ │ └── ... # Other pages
│ ├── components/ # React components
│ │ ├── ui/ # Base UI components
│ │ ├── dashboard/ # Dashboard-specific components
│ │ ├── auth/ # Authentication components
│ │ └── layout/ # Layout components
│ ├── lib/ # Utility libraries
│ │ └── utils.ts # Common utilities
│ ├── stores/ # Zustand stores
│ ├── types/ # TypeScript type definitions
│ └── middleware.ts # Next.js middleware
├── server/ # Backend source code
│ ├── routes/ # Express route handlers
│ ├── middleware/ # Express middleware
│ ├── services/ # Business logic services
│ ├── utils/ # Backend utilities
│ └── index.ts # Server entry point
├── prisma/ # Database schema and migrations
│ ├── schema.prisma # Prisma schema
│ └── migrations/ # Database migrations
└── public/ # Static assets
- Frontend: Clerk components handle sign-in/sign-up UI
- Middleware: Next.js middleware protects routes
- Backend: Clerk SDK validates tokens on API routes
- Database: User data synced between Clerk and PostgreSQL
- Frontend APIs: Next.js API routes for client-server communication
- Backend APIs: Express routes for business logic
- Database: Prisma ORM for type-safe database operations
- Validation: Zod schemas for request/response validation
- User Action: Frontend component triggers action
- API Call: TanStack Query manages API requests
- Authentication: Clerk middleware validates requests
- Business Logic: Express routes handle business logic
- Database: Prisma ORM executes database operations
- Response: Data flows back through the stack
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_..."
CLERK_SECRET_KEY="sk_..."
# Database
DATABASE_URL="postgresql://user:pass@localhost:5432/sprintiq"
# GitHub Integration (optional)
GITHUB_TOKEN="ghp_..."
# OpenAI (optional)
OPENAI_API_KEY="sk-..."# 1. Update prisma/schema.prisma
# 2. Generate new migration
npx prisma migrate dev --name descriptive-name
# 3. Generate Prisma client
npx prisma generate# Backend API routes (Express)
server/routes/*.ts
# Frontend API routes (Next.js)
src/app/api/*/route.ts# Pages
src/app/*/page.tsx
# Components
src/components/*/- Frontend: Vercel or similar Next.js hosting
- Backend: Railway, Render, or containerized deployment
- Database: PostgreSQL (Supabase, Railway, or managed service)
- Authentication: Clerk production environment
- Knowledge Graph: Neo4j-backed graph (with in-memory fallback) that stores entities such as commits, pull requests, issues, tasks, and documents
- Temporal Layer: Automatic
HAPPENED_BEFOREedges capture chronological sequences with deltaHours/deltaDays metadata for trend traversal - Trend Queries: Graph RAG prompt templates highlight temporal edges so agents can analyze how upstream changes (e.g., PR churn) influence downstream signals (e.g., incident volume)
- Database: Set up PostgreSQL instance
- Clerk: Configure production Clerk application
- Environment: Set production environment variables
- Deployment: Deploy frontend and backend separately
- Clerk handles password security and OAuth flows
- JWT tokens validated on every API request
- Role-based access control (RBAC) implemented
- Request validation with Zod schemas
- Rate limiting on sensitive endpoints
- CORS configuration for cross-origin requests
- SQL injection prevention via Prisma ORM
- User data encrypted at rest (database level)
- HTTPS enforced in production
- Environment variables for sensitive configuration
- Structured logging with custom logger utility
- Request/response logging on API routes
- Error tracking and monitoring
- Database query optimization with Prisma
- API response caching where appropriate
- Frontend performance monitoring
- Jest for TypeScript/JavaScript testing
- React Testing Library for component testing
- Prisma testing with test database
- API endpoint testing with Supertest
- Database integration testing
- End-to-end testing with Playwright
# Run tests
npm test
# Run with coverage
npm run test:coverage
# E2E tests
npm run test:e2e- ✅ Authentication migrated to Clerk
- ✅ Database migrated to PostgreSQL/Prisma
- ✅ API routes updated for new architecture
- ✅ Frontend updated to use Clerk hooks
- ✅ All Firebase dependencies removed
- Authentication flow completely changed
- Database schema restructured
- API endpoints updated
- Environment variables changed