Skip to content

The-AgenticFlow/Test-Calculator

Repository files navigation

🧮 Full Stack Calculator (Rust + React)

📌 Project Overview

This project is a simple full-stack calculator application built by students.

The goal is to learn how frontend and backend systems work together by building a calculator from scratch using:

  • Rust for the backend (API + logic)
  • React for the frontend (UI)

Students will implement basic calculator operations and connect the frontend to the backend through HTTP requests.


🎯 Learning Objectives

By the end of this project, you should be able to:

  • Build a REST API in Rust
  • Understand how a frontend communicates with a backend
  • Manage application state in React
  • Handle user input and display results
  • Structure a simple full-stack project

🏗️ Project Structure

calculator-project/
│
├── backend/     # Rust API
├── frontend/    # React app
└── README.md

⚙️ Features

  • Basic arithmetic operations:

    • Addition (+)
    • Subtraction (-)
    • Multiplication (*)
    • Division (/)
  • Input validation

  • Error handling (e.g. divide by zero)

  • API communication between frontend and backend


🚀 Getting Started

1. Clone the repository

git clone <repo-url>
cd calculator-project

2. Backend Setup (Rust)

Make sure Rust is installed:

rustc --version

Run the backend:

cd backend
cargo run

3. Frontend Setup (React)

Make sure Node.js is installed:

node -v

Run the frontend:

cd frontend
npm install
npm start

🔌 API Example

POST /calculate

Request:

{
  "operation": "add",
  "a": 5,
  "b": 3
}

Response:

{
  "result": 8
}

🧠 Rules for Students

  • Do NOT copy full solutions — focus on learning
  • Keep code simple and readable
  • Commit regularly with clear messages
  • Ask questions when stuck

✅ Expected Outcome

A working calculator where:

  • The frontend sends requests
  • The backend processes calculations
  • The result is displayed to the user

💡 Bonus Ideas (Optional)

  • Add more operations (%, power, square root)
  • Add history of calculations
  • Improve UI design
  • Add unit tests

Happy coding 🚀

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors