Skip to content

A web application that calculates the Nth prime number using a distributed task system. Built with React, Flask, Dramatiq, PostgreSQL, and Redis.

License

Notifications You must be signed in to change notification settings

dudynets/Prime-Number-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime Number Calculator

A web application that calculates the Nth prime number using a distributed task system. Built with React, Flask, Dramatiq, PostgreSQL, and Redis.

Prerequisites

  • Docker
  • Docker Compose

Getting Started

  1. Clone the repository:
git clone <repository-url>
cd <project-directory>
  1. Build and start the containers:
docker-compose up --build

This will start the following services:

Project Structure

The project consists of two main components:

  1. Frontend (/frontend):

    • React application with TypeScript
    • Material-UI for styling
    • JWT authentication
  2. Backend (/backend):

    • Flask REST API
    • PostgreSQL database
    • Redis for task queue
    • Dramatiq for distributed task processing

Features

  • User registration and authentication
  • Calculate Nth prime number with progress tracking
  • Cancel running calculations
  • View calculation history
  • Delete completed calculations

API Endpoints

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - User login
  • GET /api/tasks - List all tasks
  • POST /api/tasks - Create new calculation task
  • GET /api/tasks/:id - Get task details
  • POST /api/tasks/:id/cancel - Cancel running task
  • DELETE /api/tasks/:id - Delete completed task

Development

To make changes to the code and see them reflected:

docker-compose down
docker-compose up --build

Cleanup

To stop and remove all containers:

docker-compose down -v

The -v flag also removes the persistent volume used by PostgreSQL.

License

Distributed under the MIT License. See LICENSE for more information.

About

A web application that calculates the Nth prime number using a distributed task system. Built with React, Flask, Dramatiq, PostgreSQL, and Redis.

Topics

Resources

License

Stars

Watchers

Forks