Skip to content

ios-lab-up/backwell-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏫 Backwell API 🚀

Backwell API is a robust application designed to create optimal schedule combinations for students by leveraging two powerful microservices: a Rust-based scheduling engine and a Django backend for managing courses and instructors.

Backwell API Banner

📖 Table of Contents

🌟 Features

  • Microservices Architecture: Separates scheduling logic and course management for scalability.
  • Rust Performance: Utilizes Rust's actix-web framework for high-performance API operations.
  • Django Backend: Manages courses, professors, subjects, and classrooms efficiently.
  • Dockerized Setup: Simplifies deployment and environment consistency.
  • JSON-Based API: Easy integration with other systems and services.

📦 Technologies Used

  • Rust 🦀
  • Django 🐍
  • Docker 🐳
  • Actix-web 🔗
  • PostgreSQL 🐘

🔧 Installation

Prerequisites

Before getting started, ensure you have the following installed on your system:

  • Git - Version control system
  • Docker - Containerization platform
  • Docker Compose - Tool for defining and running multi-container Docker applications

Steps

  1. Clone the Repository

    git clone https://github.com/your-username/backwell-api.git
    cd backwell-api
  2. Download Docker

    If you haven't installed Docker yet, follow the official Docker installation guide for your operating system.

  3. Build and Run the Containers

    docker-compose up --build

    This command will build the Docker images and start the containers for both the Rust API and Django backend.

  4. Verify Services are Running

    Ensure that the following services are up and running:

    • Web-1 (Django Backend)
    • DB-1 (PostgreSQL Database)
    • Rust App (Backwell API)

    You can verify by checking the Docker containers:

    docker ps
  5. Access the Services

🚀 Running the Application

Once the Docker containers are up and running, the microservices can be accessed via the following ports:

  • Django Backend API: http://localhost:8001
  • Rust Scheduling API: https://localhost:8082

You can interact with the APIs using tools like Postman or cURL.

🛠️ Services Overview

🔨 Rust App — Backwell API

Backwell API is built using Rust and the actix-web framework. It is responsible for generating class schedules based on available courses and professors.

  • Endpoint: /generate_schedule
  • Method: POST
  • Purpose: Generates compatible schedule groupings based on the provided course data.

Key Features:

  • High-performance scheduling algorithms
  • Secure communication with the Django backend
  • JSON-based request and response handling

🐍 Django Backend

The Django backend manages the core data for the application, including courses, professors, subjects, and classrooms. It provides RESTful endpoints for data retrieval and management.

Key Features:

  • CRUD operations for courses, professors, subjects, and classrooms
  • Admin interface for easy data management
  • Integration with the Rust API for scheduling

📚 API Endpoints

Generate Schedule

  • URL: https://localhost:8082/v1/api/generate_schedule
  • Method: POST
  • Description: Generates schedule combinations based on selected courses.

Request Body Example:

{
  "courses": ["Ética", "Persona y sociedad"],
  "minimum": 1
}

Course Management

The Django backend provides several endpoints to manage courses and related entities:

  • Courses: http://localhost:8001/api/cursos
  • Professors: http://localhost:8001/api/profesores
  • Subjects: http://localhost:8001/api/materias
  • Classrooms: http://localhost:8001/api/salones

Each endpoint supports GET, POST, PUT, and DELETE methods for comprehensive data management.

📄 Example Usage

Generating a Schedule

Use the following cURL command to generate a schedule:

curl -X POST https://localhost:8082/v1/api/generate_schedule \
     -H "Content-Type: application/json" \
     -d '{
           "courses": ["Mathematics", "Physics"],
           "minimum": 2
         }'

Expected Response:

{
  "schedule_groups": [
    [
      {
        "id": 1,
        "materia": {"id": 101, "codigo": "MATH101", "nombre": "Mathematics", "no_de_catalogo": "101"},
        "profesor": {"id": 5, "nombre": "Dr. Smith"},
        "salon": {"id": 10, "nombre": "Room A", "capacidad": 30},
        "hora_inicio": "08:00",
        "hora_fin": "10:00",
        "lunes": true,
        "martes": false,
        "miércoles": true,
        "jueves": false,
        "viernes": true
      },
      ...
    ],
    ...
  ]
}

This response provides groups of compatible course schedules, ensuring no conflicts in timings, instructors, or classrooms.

📝 Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the Repository

  2. Create a New Branch

    git checkout -b feature/YourFeatureName
  3. Commit Your Changes

    git commit -m "Add some feature"
  4. Push to the Branch

    git push origin feature/YourFeatureName
  5. Open a Pull Request

Please ensure your code follows the project's coding standards and includes appropriate tests.

📜 License

This project is licensed under the MIT License.

📫 Contact

For any inquiries or support, please contact:


Empowering students with optimized scheduling solutions!

About

App to create schedule combinations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published