A modern, responsive music playlist management system built with Next.js and TypeScript, implementing a Singly Linked List data structure for efficient playlist operations. This project demonstrates practical application of data structures and algorithms in web development with real-time database integration and a stunning purple/pink gradient UI.
PlayChain is a web-based playlist management system that leverages the power of Linked List data structures to provide efficient song management operations. The project combines front-end web technologies with back-end database integration to create a fully functional music playlist manager. Users can add, edit, delete, and reorder songs while the system maintains data using a singly linked list implementation, providing both educational insight into data structures and practical utility.
- Linked List Operations: Implementation of core data structure operations
insert()- Add songs at the end of the playlistinsertAtFront()- Add songs at the beginninginsertAt(index)- Insert songs at specific positionsremove()- Remove the last songremoveAtFront()- Remove the first songprint()- Display the linked list structure
- Dynamic Playlist Management: Add, edit, delete, and reorder songs with intuitive UI
- Real-time Search: Filter songs by title or artist instantly
- Statistics Dashboard: View total songs, duration, and unique artists count
- Database Integration: MySQL database with XAMPP for persistent data storage
- Live Status Indicator: Real-time database connection monitoring
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Visual Data Structure: Interactive visualization of the linked list structure
- Touch-Optimized UI: Large tap targets and mobile-friendly interactions
playchain/
βββ app/
β βββ api/ # API routes
β β βββ db-status/ # Database connection status endpoint
β β βββ songs/ # CRUD operations for songs
β β β βββ [id]/ # Individual song operations
β β βββ stats/ # Playlist statistics endpoint
β βββ components/ # React components
β β βββ DatabaseStatus.tsx # Database connection indicator
β β βββ Player.tsx # Music player UI component
β β βββ Playlist.tsx # Playlist management component
β βββ globals.css # Global styles and responsive design
β βββ layout.tsx # Root layout component
β βββ page.tsx # Home page
βββ database/
β βββ playchain.sql # Database schema and sample data
βββ lib/
β βββ backend.ts # Backend API utility functions
β βββ db.ts # MySQL connection pool configuration
β βββ dbStatus.ts # Database status checker
β βββ linkedList.ts # Singly Linked List implementation
βββ public/
β βββ uploads/ # Upload directory
βββ package.json # Project dependencies
βββ README.md # Project documentation
- Next.js 16: React-based framework for server-side rendering and routing
- React 19: Component-based UI library
- TypeScript: Static typing for JavaScript
- Tailwind CSS v4: Utility-first CSS framework
- Lucide React: Icon library for modern UI elements
- MySQL: Relational database for data persistence
- mysql2: MySQL client for Node.js
- Next.js API Routes: Serverless API endpoints
- ESLint: Code linting and quality assurance
- XAMPP: Local development server (Apache + MySQL)
- Node.js (v18 or later) and npm
- XAMPP or similar MySQL server
- Web browser (Chrome, Firefox, Safari, or Edge)
- Clone the repository and navigate to the project directory
- Install dependencies:
npm install - Start XAMPP and enable MySQL service
- Import the database schema from
database/playchain.sqlinto phpMyAdmin - Configure database credentials in
lib/db.tsif needed - Run the development server:
npm run dev - Open http://localhost:3000 in your browser
The project implements a Singly Linked List with the following structure:
- Node: Contains song data and a pointer to the next node
- LinkedList Class: Manages the chain of nodes with methods for insertion, deletion, and traversal
- Type-Safe Implementation: Written in TypeScript for type safety and better development experience
| Operation | Time Complexity | Description |
|---|---|---|
insert() |
O(n) | Add to end of list |
insertAtFront() |
O(1) | Add to beginning |
insertAt(index) |
O(n) | Add at specific position |
remove() |
O(n) | Remove from end |
removeAtFront() |
O(1) | Remove from beginning |
print() |
O(n) | Display all elements |
- Color Scheme: Purple (#8b5cf6) to Pink (#ec4899) gradients
- Glass Morphism: Translucent cards with backdrop blur effects
- Smooth Animations: Transitions, hover effects, and loading states
- Responsive Grid: Adapts from 5-column table to mobile cards
- Dark Theme: Space-themed gradient background
The songs table structure:
id: Primary key (auto-increment)title: Song title (VARCHAR)artist: Artist name (VARCHAR)duration: Song duration (VARCHAR)position: Position in playlist (INT)created_at: Record creation timestampupdated_at: Last update timestamp
This is an academic project for HNDSE - Programming Data Structures and Algorithms coursework.
This project is created for educational purposes as part of the NIBM HNDSE program.
For questions or issues related to this project, please refer to the course materials or contact your instructor.
- NIBM for providing the coursework framework
- Next.js team for excellent documentation
- Lucide for beautiful icon set
- Open-source community for inspiration and support
Project Course: Programming Data Structures and Algorithms - 1
Institution: NIBM (National Institute of Business Management)
Program: Higher National Diploma in Software Engineering (HNDSE)
Course Code: GAHDSE251F-001
- Click "Import" tab
- Choose file: database/playchain.sql
- Click "Go" to execute
- Verify the
playchaindatabase andsongstable are created
-
Configure database connection
- Open
lib/db.ts - Update MySQL credentials if needed (default: root/no password)
host: 'localhost', user: 'root', password: '', // Add your MySQL password if set database: 'playchain',
- Open
-
Run the development server
npm run dev # or yarn dev -
Open in browser
- Navigate to http://localhost:3000
- You should see the PlayChain interface with sample songs
- Click "Add Song" button
- Select insertion position:
- End (insert) - Adds to the end of playlist
- Front (insertAtFront) - Adds to the beginning
- At Index (insertAt) - Adds at specific position
- Fill in song title, artist, and duration (e.g., 3:45)
- Click "Add Song" to confirm
- Play Song: Click on any song in the list
- Edit Song: Click the edit icon (pencil)
- Delete Song: Click the delete icon (trash)
- Reorder: Use up/down arrows to change position
- Search: Type in the search bar to filter songs
- Remove First: Removes the first song (removeAtFront)
- Remove Last: Removes the last song (remove)
- Print List: Displays linked list structure in console format
- Color Scheme: Purple (#8b5cf6) to Pink (#ec4899) gradients
- Glass Morphism: Translucent cards with backdrop blur
- Animations: Smooth transitions, hover effects, loading states
- Responsive Grid: Adapts from 5-column table to mobile cards
- Dark Theme: Space-themed gradient background
| Endpoint | Method | Description |
|---|---|---|
/api/songs |
GET | Fetch all songs |
/api/songs |
POST | Add new song |
/api/songs/[id] |
PUT | Update song |
/api/songs/[id] |
DELETE | Delete song |
/api/stats |
GET | Get playlist statistics |
/api/db-status |
GET | Check database connection |
The PlaylistLinkedList class (lib/linkedList.ts) implements:
- Node-based structure with
dataandnextpointers - Core operations: insert, remove, search, print
- Helper methods: getSize, isEmpty, toArray
- Type-safe TypeScript implementation
Database not connecting?
- Ensure XAMPP MySQL is running
- Check credentials in
lib/db.ts - Verify database exists:
SHOW DATABASES;in phpMyAdmin
Ports conflict?
- Change Next.js port:
npm run dev -- -p 3001 - Change MySQL port in XAMPP config if needed
Build errors?
- Clear cache:
rm -rf .next - Reinstall dependencies:
rm -rf node_modules && npm install
β Star this repo if you find it helpful!