A full-featured issue tracking system built with Next.js 14, featuring real-time updates, role-based access control, and comprehensive issue management capabilities.
- Issue Management: Create, read, update, and delete issues
- Rich Text Editor: Markdown support for issue descriptions with live preview
- User Authentication: Secure Google OAuth integration via NextAuth
- Issue Assignment: Assign issues to team members
- Status Workflow: Track issues through OPEN β IN_PROGRESS β CLOSED states
- Priority Management: Set issue priorities (LOW, MEDIUM, HIGH)
- Comments System: Markdown-supported comments with user attribution
- Activity Timeline: Complete audit trail of all issue changes
- Advanced Search: Debounced search across issue titles and descriptions
- Smart Filtering: Filter by status, assignee, and priority
- Role-Based Access Control (RBAC): Three-tier permission system (ADMIN, USER, VIEWER)
- Pagination: Efficient data loading with customizable page sizes
- Responsive Design: Mobile-friendly interface using Radix UI
- Dashboard Analytics: Visual representation of issue statistics
- Status Distribution Charts: Interactive charts using Recharts
- Issue Trends: Track open vs closed issues over time
- Framework: Next.js 14.2.23 (App Router)
- Language: TypeScript 5.7.2
- Database: PostgreSQL with Prisma ORM 5.22.0
- Authentication: NextAuth 4.24.13 with Google Provider
- UI Components: Radix UI Themes 3.2.1
- Styling: Tailwind CSS 3.4.18
- Forms: React Hook Form 7.69.0 + Zod 3.25.76
- State Management: TanStack Query 5.70.1
- Charts: Recharts 2.15.0
- Markdown: React Markdown 9.0.4
- Editor: SimpleMDE 1.32.1
Before you begin, ensure you have the following installed:
- Node.js 18.x or higher
- npm or yarn
- PostgreSQL database (local or hosted)
- Google Cloud Console account for OAuth credentials
-
Clone the repository
git clone <your-repo-url> cd issue-tracker
-
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in the root directory (or copy from.env.example):# Environment NODE_ENV=development # Database DATABASE_URL="postgresql://username:password@host:port/database" # NextAuth Configuration NEXTAUTH_SECRET="your-secret-key-here" # Application URL (automatically switches based on environment) # Development: http://localhost:3000 # Production: https://your-production-domain.com NEXTAUTH_URL="http://localhost:3000" # Google OAuth Credentials GOOGLE_CLIENT_ID="your-google-client-id" GOOGLE_CLIENT_SECRET="your-google-client-secret"
-
Generate NextAuth Secret
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))" -
Set up Google OAuth
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy Client ID and Client Secret to your
.envfile
-
Initialize the database
npx prisma migrate dev npx prisma generate
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
The application uses the following main models:
- User: Authentication and role management
- Issue: Core issue tracking with status, priority, and assignments
- Comment: User comments on issues with markdown support
- ActivityLog: Audit trail of all issue changes
- Label: Categorization tags for issues
issue-tracker/
βββ app/
β βββ api/ # API routes
β β βββ issues/ # Issue CRUD operations
β β βββ users/ # User management
β β βββ auth/ # NextAuth configuration
β βββ auth/ # Authentication utilities
β β βββ authOptions.ts # NextAuth config
β β βββ Provider.tsx # Session provider
β β βββ authorization.ts # RBAC helpers
β βββ components/ # Shared components
β βββ issues/ # Issue-related pages
β β βββ [id]/ # Issue detail pages
β β βββ list/ # Issue list with filters
β β βββ new/ # Create issue
β β βββ _components/ # Issue components
β βββ lib/ # Utility functions
β β βββ activityLogger.ts # Activity logging
β βββ layout.tsx # Root layout
β βββ page.tsx # Dashboard
β βββ validationSchemas.ts # Zod schemas
βββ prisma/
β βββ schema.prisma # Database schema
β βββ client.ts # Prisma client
βββ public/ # Static assets
βββ types/ # TypeScript declarations
Issues progress through three states:
- OPEN: Newly created issues
- IN_PROGRESS: Issues being worked on
- CLOSED: Completed issues
Three user roles with different permissions:
- ADMIN: Full access to all operations
- USER: Can create and edit own issues, comment on any issue
- VIEWER: Read-only access
- Markdown support with live rendering
- User attribution with timestamps
- Real-time updates via React Query
- Cascade deletion when issue is removed
Tracks all changes including:
- Issue creation
- Status changes
- Priority updates
- Assignment changes
- Description modifications
- Search: Debounced search across titles and descriptions
- Status Filter: Filter by issue status
- Assignee Filter: View issues by assignee or unassigned
- Combined Filters: All filters work together seamlessly
Three priority levels:
- π΄ HIGH: Urgent issues requiring immediate attention
- π‘ MEDIUM: Standard priority (default)
- π’ LOW: Non-urgent issues
GET /api/issues- List all issues with filtersPOST /api/issues- Create new issueGET /api/issues/[id]- Get issue detailsPATCH /api/issues/[id]- Update issueDELETE /api/issues/[id]- Delete issue
GET /api/issues/[id]/comments- Get issue commentsPOST /api/issues/[id]/comments- Add comment
GET /api/issues/[id]/activities- Get issue activity log
GET /api/users- List all users
| Variable | Description | Required | Example |
|---|---|---|---|
NODE_ENV |
Environment mode | β | development or production |
DATABASE_URL |
PostgreSQL connection string | β | postgresql://user:pass@host:5432/db |
NEXTAUTH_SECRET |
Secret for JWT signing (32+ chars) | β | Generate with crypto |
NEXTAUTH_URL |
Application URL (environment-specific) | β | http://localhost:3000 (dev)https://app.com (prod) |
GOOGLE_CLIENT_ID |
Google OAuth Client ID | β | From Google Cloud Console |
GOOGLE_CLIENT_SECRET |
Google OAuth Client Secret | β | From Google Cloud Console |
# Development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lint
# Prisma commands
npx prisma studio # Open Prisma Studio
npx prisma migrate dev # Create migration
npx prisma generate # Generate Prisma Client
npx prisma db push # Push schema changes-
Update environment variables for production
Update your
.envfile or hosting platform's environment variables:NODE_ENV=production DATABASE_URL="your-production-database-url" NEXTAUTH_SECRET="your-secret-key" NEXTAUTH_URL="https://your-production-domain.com" # β οΈ Important: Update this! GOOGLE_CLIENT_ID="your-google-client-id" GOOGLE_CLIENT_SECRET="your-google-client-secret"
Important: Don't forget to update the authorized redirect URI in Google Cloud Console:
- Add:
https://your-production-domain.com/api/auth/callback/google
- Add:
-
Build the application
npm run build
-
Test the production build locally (optional)
npm start
-
Deploy
The application can be deployed to:
- Vercel (recommended for Next.js) - Auto-detects environment
- AWS (Amplify, EC2, or ECS)
- Google Cloud Platform (Cloud Run or App Engine)
- Railway or Render
- Any Node.js hosting platform
Note: Most hosting platforms allow you to set environment variables directly in their dashboard.
- Verify
DATABASE_URLis correct - Ensure PostgreSQL server is running
- Check firewall settings for database port
- Verify Google OAuth credentials
- Check redirect URIs match in Google Console
- Ensure
NEXTAUTH_SECRETis set
- Clear
.nextfolder:rm -rf .next - Regenerate Prisma Client:
npx prisma generate - Delete node_modules and reinstall:
rm -rf node_modules && npm install
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.