A web application that calculates the Nth prime number using a distributed task system. Built with React, Flask, Dramatiq, PostgreSQL, and Redis.
- Docker
- Docker Compose
- Clone the repository:
git clone <repository-url>
cd <project-directory>
- Build and start the containers:
docker-compose up --build
This will start the following services:
- Frontend (React) - http://localhost:80
- Backend (Flask) - http://localhost:4200
- PostgreSQL Database - localhost:5432
- Redis - localhost:6379
- Two worker nodes for processing prime number calculations
The project consists of two main components:
-
Frontend (
/frontend
):- React application with TypeScript
- Material-UI for styling
- JWT authentication
-
Backend (
/backend
):- Flask REST API
- PostgreSQL database
- Redis for task queue
- Dramatiq for distributed task processing
- User registration and authentication
- Calculate Nth prime number with progress tracking
- Cancel running calculations
- View calculation history
- Delete completed calculations
POST /api/auth/register
- Register new userPOST /api/auth/login
- User loginGET /api/tasks
- List all tasksPOST /api/tasks
- Create new calculation taskGET /api/tasks/:id
- Get task detailsPOST /api/tasks/:id/cancel
- Cancel running taskDELETE /api/tasks/:id
- Delete completed task
To make changes to the code and see them reflected:
docker-compose down
docker-compose up --build
To stop and remove all containers:
docker-compose down -v
The -v
flag also removes the persistent volume used by PostgreSQL.
Distributed under the MIT License. See LICENSE for more information.