A web application for solving systems of linear equations using Cramer's rule. The solution is computed asynchronously via Celery workers, allowing users to track progress in real time.
- User registration and JWT-based authentication
- Submit matrix systems (up to 12×12) for solving
- Asynchronous task processing with Celery + Redis
- Real-time progress tracking per task
- Task history with results and execution time
- Input via keyboard or
.txtfile upload - Cancel in-progress tasks
- Scalable backend with multiple FastAPI replicas behind Nginx
| Layer | Technology |
|---|---|
| Frontend | |
| Backend | |
| Task Queue | |
| Message Broker / Result Backend | |
| Database | |
| Reverse Proxy | |
| Containerization |
.
├── backend/
│ └── app/
│ ├── main.py # FastAPI app entry point
│ ├── auth.py # Registration, login, JWT
│ ├── tasks.py # Celery task (Cramer's rule solver)
│ ├── tasks_routes.py # REST endpoints for tasks
│ ├── models.py # SQLAlchemy ORM models
│ ├── schemas.py # Pydantic schemas
│ ├── crud.py # DB helper functions
│ ├── db.py # DB engine and session
│ └── celery_app.py # Celery configuration
├── frontend/
│ ├── index.html
│ ├── style.css
│ └── app.js
├── nginx/
│ └── default.conf
├── create_tables.py # DB initializer (runs on startup)
├── test_task.py # CLI tool for testing solver
├── docker-compose.yml
├── Dockerfile
└── requirements.txt
- Docker and Docker Compose
Create a .env file in the project root:
DATABASE_URL=postgresql://postgres:yourpassword@db:5432/matrix_solver
POSTGRES_USER=postgres
POSTGRES_PASSWORD=yourpassword
POSTGRES_DB=matrix_solver
SECRET_KEY=your-secret-key-here
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_BACKEND_URL=redis://redis:6379/1# Build and start all services
docker compose up --build
# Initialize the database tables (first run)
docker compose run --rm backend python create_tables.pyThe app will be available at http://localhost.
API documentation (Swagger UI) is available at http://localhost/docs.
docker compose down| Method | Path | Description |
|---|---|---|
POST |
/auth/register |
Register a new user |
POST |
/auth/login |
Log in and receive JWT |
GET |
/auth/me |
Get current user info |
POST |
/tasks |
Submit a new matrix task |
GET |
/tasks |
List all tasks for the current user |
GET |
/tasks/{id}/status |
Poll task status and progress |
DELETE |
/tasks/{id} |
Cancel an in-progress task |
Enter the matrix row by row (space-separated values), then the right-hand side vector (space-separated):
2 1 -1
-3 -1 2
-2 1 2
---
8 -11 -3
The file must contain the matrix, a line with ---, and then the vector:
3 7 12
9 1 19
5 3 17
---
21 23 36
- Maximum matrix size: 12×12 (due to the exponential complexity of Cramer's rule)
- Maximum concurrent active tasks per user: 10
You can test the Celery solver directly without the web UI:
python test_task.pyFollow the prompts to enter data from the keyboard or a .txt file. Requires a running Redis instance and Celery worker.
MIT License — see LICENSE for details.