Skip to content

pratheekv39/FNFI_Intern_Progress_Tracker

Repository files navigation

Intern Progress Tracker

A full‑stack web application for managing internship programs: task tracking, quizzes, analytics, notifications, and role‑based access for Admins, Managers, Trainers, and Interns.

Monorepo Layout

InternProgressTracker.sln
intern-progress-tracker-ui/          # React + TypeScript + Vite frontend
InternProgressTracker.API/           # ASP.NET Core Web API backend (NET 8)
InternProgressTracker.Domain/        # Domain models
InternProgressTracker.Application/   # Application layer (DTOs, mapping)

Tech Stack

  • Frontend: React 19, TypeScript, Vite, Bootstrap 5, Axios, Chart.js, React Router
  • Backend: ASP.NET Core 8 Web API, Entity Framework Core, AutoMapper, JWT Auth
  • Database: SQL Server LocalDB (dev default)

Prerequisites

  • Node.js 18+ and npm
  • .NET SDK 8.0+
  • SQL Server (LocalDB for development is fine)

Quick Start

1) Backend: API

cd InternProgressTracker.API
dotnet restore
dotnet build
dotnet run

Defaults (from Properties/launchSettings.json and appsettings.json):

  • API URL: http://localhost:5192
  • Swagger: http://localhost:5192/swagger
  • DB: Data Source=(localdb)\\MSSQLLocalDB; Initial Catalog=InternProgressTrackerDb

The app seeds roles and an initial admin on startup (see Seed Data below).

2) Frontend: React app

cd intern-progress-tracker-ui
npm install
npm run dev

Defaults:

  • Dev server: http://localhost:5173
  • API base URL (configured in code/env): http://localhost:5192/api

Open the app in your browser. You should be able to navigate to the login page and sign in with the seeded admin.

Configuration

Backend configuration (InternProgressTracker.API/appsettings.json)

{
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=InternProgressTrackerDb;Integrated Security=True;Encrypt=False;Trust Server Certificate=True"
  },
  "Jwt": {
    "Key": "dev-secret-key-change-in-production-please",
    "Issuer": "InternProgressTracker",
    "Audience": "InternProgressTracker.Client"
  },
  "Admin": {
    "Email": "[email protected]",
    "Password": "Admin@12345"
  }
}
  • Update the connection string for your SQL Server instance in non‑dev environments.
  • Replace the JWT Key in production.

CORS and URLs

  • CORS policy AllowReactApp allows:
    • http://localhost:5173, http://localhost:5174

Frontend environment

intern-progress-tracker-ui/src/lib/api.ts uses an env override:

baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5192/api'

Optional .env in intern-progress-tracker-ui/:

VITE_API_BASE_URL=http://localhost:5192/api

Authentication & Roles

  • JWT bearer authentication with role‑based authorization.
  • Seeded roles: Admin, Manager, Trainer, Intern.
  • Seeded admin (dev defaults):

Key Auth Endpoints (/api/auth)

  • POST /register (Admin only) – create a user with a role
  • POST /login – returns { accessToken, user }
  • GET /profile (Auth) – current user profile
  • PUT /profile (Auth) – update display name and password
  • Admin management:
    • GET /users
    • GET /users/{role}
    • PUT /users/{userId}
    • DELETE /users/{userId}

Frontend automatically attaches the JWT from localStorage.token and handles 401s by redirecting to /login (see src/lib/api.ts).

Frontend Notes

  • Scripts (intern-progress-tracker-ui/package.json):
    • npm run dev – Vite dev server
    • npm run build – TypeScript build then Vite build
    • npm run preview – preview production build
    • npm run lint – ESLint
  • Styling: Bootstrap 5 and custom CSS inside components as needed.
  • Routing: react-router-dom.

Backend Notes

  • Swagger enabled in Development at /swagger.
  • AutoMapper profile from InternProgressTracker.Application.MappingProfile.
  • JSON options configured for enum strings and DateTime handling (DateTimeConverter).

Database and EF Core

Migrations already exist in InternProgressTracker.API/Migrations. Typical commands if you need to update the schema:

cd InternProgressTracker.API
dotnet ef migrations add <Name>    # requires dotnet-ef tool installed
dotnet ef database update

Install EF tools if needed:

dotnet tool install --global dotnet-ef

Running in Development

  1. Start API (port 5192):
cd InternProgressTracker.API
dotnet run
  1. Start UI (port 5173):
cd intern-progress-tracker-ui
npm run dev
  1. Configure API URL for UI if non‑default:
# in intern-progress-tracker-ui/.env
VITE_API_BASE_URL=http://localhost:5192/api

Build & Deployment (Overview)

  • Backend: publish as a self‑contained or framework‑dependent deployment
    cd InternProgressTracker.API
    dotnet publish -c Release -o ./publish
  • Frontend: build static assets
    cd intern-progress-tracker-ui
    npm run build
  • Serve frontend via your chosen web server and point it to the API base URL.

Troubleshooting

  • CORS errors: Ensure UI origin (5173/5174) is allowed by the API and that the API is reachable at VITE_API_BASE_URL.
  • 401 Unauthorized: Verify JWT config and that you are logged in; the UI will redirect to /login on 401.
  • Database connection: Update ConnectionStrings:DefaultConnection for your SQL Server instance.
  • Port conflicts: Adjust API port in launchSettings.json or run with --urls http://localhost:<port>.

Repository Scripts (summary)

  • API
    • dotnet restore, dotnet build, dotnet run
    • dotnet publish -c Release
  • UI
    • npm run dev, npm run build, npm run preview, npm run lint

Folder Structure Details

InternProgressTracker.API/

  • Controllers/ – REST endpoints (Auth, Users, Assignments, Tasks, Analytics, Notifications, Quizzes)
  • Services/ – business logic and data access services
  • Data/InternProgressTrackerDbContext.cs – EF Core DbContext
  • Profiles/MappingProfile.cs – AutoMapper configuration
  • Models/ – API models and seed helpers (e.g., SeedData.cs, ApplicationUser.cs)
  • Migrations/ – EF Core migrations
  • Program.cs – app startup, DI, CORS, JWT, Swagger

intern-progress-tracker-ui/

  • src/pages/ – pages (e.g., HomePage.tsx)
  • src/components/ – shared UI components (Navbar, Sidebar, ProtectedRoute, etc.)
  • src/context/AuthContext.tsx – auth state and provider
  • src/lib/api.ts – Axios instance with JWT injection and 401 handling
  • src/utils/ – helpers (e.g., date utilities)
  • public/ – static assets (/images/fnf_png.png)

Security Notes

  • Replace the development JWT key and admin credentials before deploying.
  • Store secrets outside of source control (environment variables, secret managers, or secure config stores).

About

An efficient application to track Intern's Progress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5