Skip to content

Latest commit

Β 

History

History
163 lines (120 loc) Β· 4.42 KB

File metadata and controls

163 lines (120 loc) Β· 4.42 KB

πŸ” MQL BackEnd β€” Django REST API MVP Version 🧠

Welcome to the official MQL BackEnd repository β€” This is a backend project built using Django and Django REST Framework (DRF).

To simplify frontend development and interaction with APIs, a dedicated apiHandler.js file has been provided. This utility streamlines API communication and makes the behavior of each endpoint clearer and more accessible for frontend developers.

πŸš€ Key Features User registration and login functionality for clients

Ability for users to submit orders with detailed descriptions and a list of required tools

An admin panel to track and manage submitted orders

⚠️ Note: This is an MVP (Minimum Viable Product) version – the initial functional release intended to demonstrate the core features.


πŸš€ Key Features

  • βœ… User Registration & Login APIs
  • πŸ” Token-based Authentication System
  • πŸ“¦ RESTful API built with Django REST Framework
  • ⚑ Frontend Integration via fetch() (JavaScript)
  • 🧱 SQLite Database for lightweight development
  • πŸ”§ Modular, Scalable Django Architecture
  • πŸ“ Frontend-friendly API handler (apiHandeler.js)

πŸ“‚ Project Structure

MQL-BackEnd/ β”œβ”€β”€ MQL/ # Main Django settings & root config β”‚ β”œβ”€β”€ settings.py β”‚ └── urls.py β”œβ”€β”€ AuthenticationSystem/ # Authentication app (core logic) β”‚ β”œβ”€β”€ models.py # User model(s) and logic β”‚ β”œβ”€β”€ views.py # API endpoints β”‚ β”œβ”€β”€ serializers.py # DRF serializers β”‚ └── admin.py β”œβ”€β”€ apiHandeler.js # JS utility for API requests β”œβ”€β”€ manage.py # Django management script β”œβ”€β”€ db.sqlite3 # Development SQLite DB └── requirements.txt # Python dependencies

yaml Copy Edit


🧠 Technologies Used

Area Technology
Backend Django, Django REST Framework
Auth Token Authentication (DRF Token)
Database SQLite
Frontend Vanilla JavaScript (fetch)
API Format REST / JSON

πŸ“¦ Installation & Setup

1. Clone the Repository

git clone https://github.com/EstarioRios/MQL-BackEnd.git
cd MQL-BackEnd

2. Create a Virtual Environment

Copy
Edit
python -m venv venv
source venv/bin/activate     # Linux/macOS
venv\Scripts\activate        # Windows

4. Install Dependencies

Copy
Edit
pip install -r requirements.txt

5. Run Migrations

Copy
Edit
python manage.py migrate

6. Start the Development Server

Copy
Edit
python manage.py runserver
The backend will be available at: http://127.0.0.1:8000/

πŸ”Œ API Endpoints

Endpoint Method Description

 βœ… Signup normal user (user_type="normal")
     POST /api/signup/
     Required fields: email, phone_number, password, first_name, last_name

 βœ… Login (JWT-based, fallback to manual login if token not valid)
     POST /api/login/
     Required fields: email, password
     Optional field: remember (boolean)

 βœ… Manually login if JWT not present or failed
    POST /api/manual-login/
    Required fields: email, password

 βœ… Create new admin user (Requires JWT and must be admin)
     POST /api/create-admin/
     Required fields: first_name, last_name, email, password, phone_number

 βœ… Submit a new order (Authenticated users only)
    POST /api/sub-order /
    Required fields: title, description, tools_description

These endpoints are implemented inside the AuthenticationSystem app using Django REST views and serializers.

πŸ§ͺ Frontend Integration

The file apiHandeler.js contains utility methods to:

Call /register and /login endpoints using fetch()

Store and reuse the token for authenticated requests

Add Authorization headers automatically

Ideal for static sites, SPAs, or mobile hybrid apps.

βœ… Use Cases

Full-stack starter authentication for Django projects

Backend for React/Vue frontend with token-based login

Educational use for learning DRF + Auth patterns

πŸ‘¨β€πŸ’» Maintainer

Built with ❀️ by Abolfazl Khezri GitHub: @EstarioRios

πŸ“ƒ License

This project is licensed under the MIT License.

✨ Future Enhancements (Optional Ideas)

βœ… Add JWT support with refresh tokens

βœ… Email confirmation during registration

βœ… Rate limiting and login throttling

βœ… Admin dashboard or user management panel

βœ… Docker support for production deployment