Skip to content

AnTS-Groups/Rope

Repository files navigation

Rope Web Backend Framework

Logo

Version Python Ruby License

SS1 SS2 SS3 SS4

Modern dual-language web framework with built-in authentication and MySQL database support

Developed by Ananda Rauf Maududi
Powered by PT. Ananda Technology Solution


📋 Table of Contents


✨ Features

  • 🔐 Complete Authentication System - User registration, login, and session management
  • 🎨 Modern UI/UX - Premium design with gradient effects, glassmorphism, and smooth animations
  • 🗄️ MySQL Database - Robust data persistence with ORM support
  • 🐍 Python Support - Flask framework with Pony ORM
  • 💎 Ruby Support - Sinatra framework with ActiveRecord
  • 🔒 Secure Passwords - Bcrypt hashing for password security
  • 📱 Responsive Design - Works perfectly on desktop, tablet, and mobile
  • 🚀 Production Ready - Gunicorn server configuration included
  • 📊 User Dashboard - Personalized dashboard with user information

🛠️ Technology Stack

Python Version (Recommended)

  • Web Framework: Flask 2.3+
  • ORM: Pony ORM 0.7+
  • Database Driver: PyMySQL 1.1+
  • Password Hashing: bcrypt 4.0+
  • Production Server: Gunicorn 21.2+
  • Database: MySQL 8.0+

Ruby Version (Alternative)

  • Web Framework: Sinatra 3.0+
  • ORM: ActiveRecord 7.0+
  • Database Driver: mysql2 0.5+
  • Password Hashing: bcrypt 3.1+
  • Production Server: Puma 6.0+
  • Database: MySQL 8.0+

📁 Project Structure

Rope_Web_Backend_Framework/
├── controller/
│   ├── views_controller.py      # Flask routes and controllers
│   └── views_controller.rb      # Sinatra routes and controllers
├── models/
│   ├── models_db.py             # Pony ORM User model
│   └── models_db.rb             # ActiveRecord User model
├── database/
│   ├── config_db.py             # Python database configuration
│   ├── config_db.rb             # Ruby database configuration
│   └── setup_database.sql       # SQL schema creation script
├── views/
│   ├── login.html               # Login page
│   ├── register.html            # Registration page
│   ├── dashboard.html           # User dashboard
│   └── assets/
│       ├── auth.css             # Authentication pages styles
│       └── dashboard.css        # Dashboard styles
├── run_rope.py                  # Python application entry point
├── gunicorn_config.py           # Gunicorn production configuration
├── requirements.txt             # Python dependencies
├── Gemfile                      # Ruby dependencies
├── .env.example                 # Environment variables template
├── Procfile                     # Deployment configuration
└── README.md                    # This file

📋 Prerequisites

For Python Version:

  • Python 3.8 or higher
  • MySQL 8.0 or higher
  • pip (Python package manager)

For Ruby Version:

  • Ruby 3.0 or higher
  • MySQL 8.0 or higher
  • Bundler (Ruby gem manager)

Common Requirements:

  • MySQL Server running on your machine
  • Terminal/Command Prompt access

🚀 Installation

Python Version (Recommended)

1. Clone or Navigate to the Project Directory

cd "c:\Users\NFI\Downloads\Punya Rauf\Rope_Web_Backend_Framework"

2. Install Python Dependencies

pip install -r requirements.txt

3. Configure Environment Variables (Optional)

Copy .env.example to .env and update with your settings:

copy .env.example .env

Edit .env file:

DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=rope_db
SECRET_KEY=your-secret-key-here

Ruby Version (Alternative)

1. Install Ruby Dependencies

bundle install

2. Configure Environment Variables

Same as Python version - create .env file with database credentials.


🗄️ Database Setup

Method 1: Automatic Setup (Recommended)

The framework will automatically create the database and tables when you run the application for the first time.

Method 2: Manual Setup

Create Database:

CREATE DATABASE rope_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Create Users Table:

USE rope_db;

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL UNIQUE,
    email VARCHAR(100) NOT NULL UNIQUE,
    password_hash VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_username (username),
    INDEX idx_email (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Or use the SQL script:

mysql -u root -p < database/setup_database.sql

▶️ Running the Application

Python Version

Development Mode:

python run_rope.py

The application will start at: http://localhost:5000

Production Mode (with Gunicorn):

gunicorn -c gunicorn_config.py run_rope:app

Ruby Version

Development Mode:

ruby controller/views_controller.rb

Production Mode (with Puma):

puma controller/views_controller.rb

🌐 API Endpoints

Method Endpoint Description
GET / Home page (redirects to login or dashboard)
GET /register User registration page
POST /register Process user registration
GET /login User login page
POST /login Process user login
GET /dashboard User dashboard (requires authentication)
GET /logout Logout and clear session

🎨 Screenshots

Login Page

SS Login

Premium authentication interface with gradient backgrounds and smooth animations.

Registration Page

SS Register

Modern sign-up form with client-side validation and error handling.

Dashboard

SS Dashboard

Professional user dashboard showing welcome message, user statistics, and account information.


🚀 Deployment

Heroku Deployment

The Procfile is already configured for Heroku:

# Login to Heroku
heroku login

# Create new app
heroku create your-app-name

# Add MySQL addon
heroku addons:create cleardb:ignite

# Get database URL
heroku config:get CLEARDB_DATABASE_URL

# Set environment variables
heroku config:set SECRET_KEY=your-secret-key

# Deploy
git push heroku main

VPS Deployment

  1. Install Python, MySQL, and Nginx
  2. Clone the repository
  3. Install dependencies: pip install -r requirements.txt
  4. Configure Nginx as reverse proxy
  5. Run with Gunicorn: gunicorn -c gunicorn_config.py run_rope:app
  6. Set up as systemd service for auto-restart

🔧 Troubleshooting

Database Connection Error

Problem: ✗ Database connection failed

Solutions:

  1. Ensure MySQL server is running
  2. Check database credentials in .env or environment variables
  3. Verify database rope_db exists
  4. Test connection: mysql -u root -p

Import Errors

Problem: ModuleNotFoundError

Solutions:

  1. Install dependencies: pip install -r requirements.txt
  2. Verify Python version: python --version (should be 3.8+)
  3. Use virtual environment (recommended)

Port Already in Use

Problem: Port 5000 already in use

Solutions:

  1. Stop other application using port 5000
  2. Change port in run_rope.py or gunicorn_config.py
  3. On Windows: netstat -ano | findstr :5000 to find process

Password Hashing Error

Problem: bcrypt errors

Solutions:

  1. Reinstall bcrypt: pip install --upgrade bcrypt
  2. On Windows, may need Visual C++ Build Tools

🔐 Security Notes

  1. Change Secret Key: Always change SECRET_KEY in production
  2. Database Credentials: Never commit .env file to version control
  3. HTTPS: Use HTTPS in production for secure data transmission
  4. Password Policy: Current minimum is 6 characters - adjust as needed
  5. Session Timeout: Default is 1 hour - configure in views_controller.py

📝 Development Notes

Adding New Routes

Python (Flask):

@app.route('/new-route')
def new_route():
    return render_template('new_page.html')

Ruby (Sinatra):

get '/new-route' do
  erb :new_page
end

Database Migrations

When modifying models, update both Python and Ruby versions to maintain compatibility.


📄 License

This project is licensed under the MIT License.


👨‍💻 Developer

Ananda Rauf Maududi
Profesional Developer
Version 1.0.0

Powered by: PT. Ananda Technology Solution


🤝 Support

For issues, questions, or contributions, please contact the development team.


Built with ❤️ using Python & Ruby

About

Rope is web backend framework implemented Python and Ruby.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors