A comprehensive full-stack application for learning and practicing data structures and algorithms with interactive visualizations, user authentication, and progress tracking.
π Try it now: aldoy.ykd.dev
The application is live and fully functional! You can:
- Practice sorting algorithm visualizations
- Try the Alpha-Beta pruning interactive exercises
- Create an account to track your progress
- View your score history and statistics
No installation required - just visit the link and start learning!
- 4 Sorting Algorithms: Bubble Sort, Quick Sort, Merge Sort, and Heap Sort
- Real-time Visualization: Watch algorithms work step-by-step with color-coded animations
- Interactive Controls: Adjust array size and speed, generate new arrays
- State Persistence: Save and load your visualization sessions
- Interactive Tree Visualization: Practice alpha-beta pruning on randomly generated game trees
- Scoring System: Get scored based on correctness and efficiency of your solutions
- Score History: Track your progress with persistent score tracking
- Solution Verification: Check your answers against the optimal alpha-beta solution
- Multiple Tree Types: Practice on different tree configurations (depth, branching factor)
- Secure User Registration: Create accounts with username/email validation
- JWT Authentication: Industry-standard token-based authentication
- Session Persistence: Stay logged in across browser sessions
- User Profiles: Track individual progress and scores
- Node.js 20+ and npm
- PostgreSQL 16+ (or use Docker)
The easiest way to run the entire application with frontend, backend, and database:
# Clone the repository
git clone https://github.com/aldoyfa/DSA-virtual-lab.git
cd DSA-virtual-lab
# Start all services with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f
# Access the application
# Frontend: http://localhost:15012
# Backend API: http://localhost:5000
# Database: localhost:5432-
Clone the repository:
git clone https://github.com/aldoyfa/DSA-virtual-lab.git cd DSA-virtual-lab -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open http://localhost:5173 in your browser
-
Navigate to backend directory:
cd backend -
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env # Edit .env with your configuration -
Run database migrations:
npm run prisma:generate npm run prisma:migrate
-
Start the backend server:
npm run dev
-
Backend API will be available at http://localhost:5000
For detailed backend setup instructions, see backend/README.md
Frontend:
npm run buildBackend:
cd backend
npm run prisma:deploy
npm startThe built files will be in the dist directory, ready for deployment.
- Generate Array: Click "Generate New Array" to create a random array
- Adjust Settings: Use sliders to change array size and animation speed
- Select Algorithm: Choose from Bubble, Quick, Merge, or Heap Sort
- Start Sorting: Click "Sort!" to begin the visualization
- Generate Tree: Create a new game tree with specified depth and branching factor
- Fill Values: Input alpha and beta values for each node following the minimax algorithm
- Mark Pruning: Toggle nodes that should be pruned during alpha-beta search
- Check Answer: Verify your solution and receive a score based on correctness
- View History: Track your progress with the score history feature
- Register: Create a new account with username and email
- Login: Sign in to access practice modules and save progress
- Profile: View your statistics and score history
- Logout: Securely end your session
- React 18.3.1 - Modern React with hooks and functional components
- Redux Toolkit 2.2.7 - Simplified Redux with modern patterns
- Vite 5.4.1 - Fast build tool and development server
- ESLint - Code linting and formatting
- Modern CSS - Flexbox, Grid, CSS custom properties
- Node.js 20+ - JavaScript runtime
- Express.js - Web framework
- Prisma 5.20.0 - Modern ORM for PostgreSQL
- PostgreSQL 16 - Relational database
- JWT (jsonwebtoken 9.0.2) - Secure authentication tokens
- Bcrypt.js 2.4.3 - Password hashing and validation
- CORS 2.8.5 - Cross-origin resource sharing
- Cookie Parser 1.4.6 - HTTP cookie parsing middleware
- Docker - Containerization platform
- Docker Compose - Multi-container orchestration
- Nginx - Reverse proxy and load balancer
- Environment Variables - Secure configuration management
- JWT Tokens - Stateless authentication with configurable expiration
- React Context API - Global authentication state management
DSA-virtual-lab/
βββ client/ # Frontend React application
β βββ index.html # Entry HTML file
β βββ package.json # Frontend dependencies
β βββ vite.config.js # Vite configuration
β βββ src/
β βββ main.jsx # React app entry point
β βββ App.jsx # Main app component with routing
β βββ components/ # React components
β β βββ Toolbar/ # Sorting visualizer control panel
β β βββ Visualizer/ # Array visualization component
β β βββ AlphaBeta/ # Alpha-Beta practice components
β β βββ AlphaBeta.jsx # Main Alpha-Beta component
β β βββ AlphaBetaToolbar.jsx # Alpha-Beta toolbar
β β βββ *.css # Component styles
β βββ algorithms/ # Algorithm implementations
β β βββ bubbleSort.js
β β βββ quickSort.js
β β βββ mergeSort.js
β β βββ heapSort.js
β β βββ alphaBeta.js # Alpha-Beta pruning algorithm
β β βββ index.js
β βββ context/ # React Context providers
β β βββ AuthContext.jsx # Authentication context
β βββ store/ # Redux store
β βββ store.js
β βββ slices/
β βββ arraySlice.js
β βββ algorithmSlice.js
β βββ visualizationSlice.js
βββ backend/ # Backend API server
β βββ src/
β β βββ middleware/
β β β βββ auth.js # JWT authentication middleware
β β β βββ errorHandler.js # Error handling middleware
β β βββ routes/
β β β βββ auth.js # Authentication endpoints
β β β βββ states.js # State management endpoints
β β β βββ alphabeta.js # Alpha-Beta score endpoints
β β βββ utils/
β β β βββ jwt.js # JWT utilities
β β β βββ password.js # Password hashing utilities
β β βββ server.js # Express app configuration
β βββ prisma/
β β βββ schema.prisma # Database schema with User, UserState, AlphaBetaScore
β β βββ migrations/ # Database migration files
β βββ package.json # Backend dependencies
β βββ Dockerfile # Backend container configuration
βββ docker-compose.yml # Multi-container orchestration
βββ Dockerfile # Frontend container configuration
βββ README.md # This file
Available Endpoints:
- Authentication:
/api/auth/register,/api/auth/login,/api/auth/logout,/api/auth/verify - State Management:
/api/states(GET, POST, PUT, DELETE) - Alpha-Beta Scores:
/api/alphabeta/scores(GET, POST),/api/alphabeta/stats
Features:
- JWT-based authentication with refresh tokens
- Request/response examples for all endpoints
- Error handling and status codes
- Rate limiting and validation rules
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the ISC License.
- Original concept from the classic sorting visualizer
- Modern React patterns and Redux Toolkit
- Educational focus on algorithm understanding