Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A full-stack application with user authentication and role-based authorization, providing functionality to create, read, update, and delete (CRUD) issues.

Notifications You must be signed in to change notification settings

SajiniWeerasinghe/Issue-Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐞 Issue Tracker

A full-stack MERN (MongoDB, Express.js, React, Node.js) application for tracking and managing issues/bugs with user authentication and authorization.

πŸ“‹ Table of Contents

✨ Features

Authentication & Authorization

  • User registration and login with JWT tokens
  • Protected routes for authenticated users
  • Role-based access control (Admin/User)
  • Automatic token validation and refresh

Issue Management

  • Create, read, update, and delete issues
  • Issue prioritization (High, Medium, Low)
  • Issue status tracking (Open, In Progress, Closed)
  • Detailed issue descriptions and timestamps
  • User ownership and permission-based editing

User Interface

  • Responsive design with Tailwind CSS
  • Clean and intuitive user interface
  • Real-time feedback and loading states
  • Search and filter capabilities
  • Mobile-friendly design

πŸ“Έ Demo Screenshots

Authentication Pages

Login Page

Login Page User login with email and password validation

Register Page

Register Page New user registration with form validation

Issue Management

Issue List

Issue List Main dashboard showing all issues with search and filter options

Issue Details

Issue Details Detailed view of individual issue

Create Issue Form

Create Issue Form to create new issues

Edit Issue Form

Edit Issue Form to update existing issues

Note: Screenshots are located in the screenshots/ folder.

🌐 Live Demo

The application is successfully deployed and accessible online:

Deployment Status

  • βœ… Frontend: Successfully deployed on Vercel
  • βœ… Backend: Successfully deployed on Railway
  • βœ… Database: MongoDB Atlas (Cloud)

πŸ› οΈ Tech Stack

Frontend

  • React 19.1.0 - User interface library
  • React Router DOM 7.7.0 - Client-side routing
  • Axios 1.11.0 - HTTP client for API requests
  • Tailwind CSS 4.1.11 - Utility-first CSS framework
  • Lucide React 0.525.0 - Beautiful icon library
  • Vite - Fast build tool and development server

Backend

  • Node.js - JavaScript runtime
  • Express.js 5.1.0 - Web application framework
  • MongoDB - NoSQL database
  • Mongoose 8.16.4 - MongoDB object modeling
  • JWT (jsonwebtoken 9.0.2) - Authentication tokens
  • bcryptjs 3.0.2 - Password hashing
  • CORS 2.8.5 - Cross-origin resource sharing

πŸ“‹ Prerequisites

Before running this application, make sure you have the following installed:

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/SajiniWeerasinghe/Issue-Tracker.git
cd Issue-Tracker

2. Install Backend Dependencies

cd server
npm install

3. Install Frontend Dependencies

cd ../frontend
npm install

βš™οΈ Configuration

Backend Configuration

  1. Create a .env file in the server directory:
cd server
touch .env
  1. Add the following environment variables to the .env file:
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/issue-tracker
# For MongoDB Atlas: mongodb+srv://<username>:<password>@<cluster>.mongodb.net/issue-tracker
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRES_IN=7d

# Server Configuration
PORT=5000
NODE_ENV=development

# CORS Configuration
CLIENT_URL=http://localhost:5173

Frontend Configuration

The frontend is configured to connect to the backend at http://localhost:5000. If you need to change this:

  1. Update the API base URL in the frontend authentication context and components
  2. The default Vite development server runs on http://localhost:5173

🎯 Usage

Development Mode

  1. Start the Backend Server:
cd server
npm run dev

The server will start on http://localhost:5000 with nodemon for auto-restart.

  1. Start the Frontend Development Server:
cd frontend
npm run dev

The frontend will start on http://localhost:5173.

  1. Access the Application:

Open your browser and navigate to http://localhost:5173

First Time Setup

  1. When you first access the application, you'll be redirected to the login page
  2. Click "Create an account" to register a new user
  3. After registration/login, you'll be redirected to the issue list
  4. Click "Create Issue" to add first issue

οΏ½ Deployment

This application has been successfully deployed using modern cloud platforms:

Frontend Deployment (Vercel)

  • Platform: Vercel
  • Build Command: npm run build
  • Output Directory: dist
  • Environment Variables: None required (API URL configured)

Backend Deployment (Railway)

  • Platform: Railway
  • Start Command: npm start
  • Environment Variables:
    • MONGO_URI - MongoDB Atlas connection string
    • JWT_SECRET - JWT signing secret
    • PORT - Auto-assigned by Railway
    • NODE_ENV=production

Database

  • MongoDB Atlas - Cloud-hosted MongoDB database
  • Configured for production with proper connection pooling
  • Secured with IP whitelisting and authentication

Deployment Features

  • βœ… Automatic deployments on push to main branch
  • βœ… HTTPS enabled for both frontend and backend
  • βœ… Environment-specific configurations
  • βœ… CORS properly configured for cross-origin requests
  • βœ… Production-optimized builds

οΏ½πŸ”— API Endpoints

Authentication Routes (/api/auth)

Method Endpoint Description Auth Required
POST /register Register a new user No
POST /login Login user No
GET /profile Get user profile Yes

Issue Routes (/api/issues)

Method Endpoint Description Auth Required
GET / Get all issues No
GET /:id Get single issue No
POST / Create new issue Yes
PUT /:id Update issue Yes
DELETE /:id Delete issue Yes (Owner/Admin)

πŸ§ͺ API Testing

All API endpoints have been tested using Postman for proper functionality, authentication, and error handling.

Base URL: http://localhost:5000/api

Sample Requests

Authentication:

POST /auth/register
POST /auth/login
GET /auth/profile (Protected)

Issues:

GET /issues
POST /issues (Protected)
PUT /issues/:id (Protected)
DELETE /issues/:id (Owner/Admin only)

πŸ“ Project Structure

Issue-Tracker/
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ public/              # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ IssueList.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ IssueDetails.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ IssueCreate.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ IssueEdit.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   └── ProtectedRoute.jsx
β”‚   β”‚   β”œβ”€β”€ context/         # React Context providers
β”‚   β”‚   β”‚   └── AuthContext.jsx
β”‚   β”‚   β”œβ”€β”€ assets/          # Images and icons
β”‚   β”‚   β”œβ”€β”€ App.jsx          # Main App component
β”‚   β”‚   β”œβ”€β”€ main.jsx         # Entry point
β”‚   β”‚   └── index.css        # Global styles
β”‚   β”œβ”€β”€ package.json         # Frontend dependencies
β”‚   └── vite.config.js       # Vite configuration
β”œβ”€β”€ server/                  # Express backend application
β”‚   β”œβ”€β”€ models/              # Mongoose models
β”‚   β”‚   β”œβ”€β”€ Issue.js
β”‚   β”‚   └── User.js
β”‚   β”œβ”€β”€ routes/              # API routes
β”‚   β”‚   β”œβ”€β”€ issues.js
β”‚   β”‚   └── auth.js
β”‚   β”œβ”€β”€ middleware/          # Custom middleware
β”‚   β”‚   └── auth.js
β”‚   β”œβ”€β”€ server.js            # Main server file
β”‚   └── package.json         # Backend dependencies
└── README.md               # Project documentation

πŸ” Authentication Flow

  1. Registration/Login: Users register or login with email and password
  2. JWT Token: Server returns a JWT token valid for 7 days
  3. Token Storage: Frontend stores token in localStorage
  4. Auto-Login: Token is automatically included in API requests
  5. Route Protection: Protected routes redirect to login if no valid token
  6. Auto-Logout: Invalid/expired tokens trigger automatic logout

πŸ“± User Permissions

  • Any User: View issues, register, login
  • Authenticated Users: Create issues, edit any issue
  • Issue Owner/Admin: Delete issues (only their own or if admin)

🚦 Available Scripts

Frontend

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

Backend

  • npm start - Start production server
  • npm run dev - Start development server with nodemon

πŸ‘¨β€πŸ’» Author

Sajini Weerasinghe

About

A full-stack application with user authentication and role-based authorization, providing functionality to create, read, update, and delete (CRUD) issues.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages