A Python-based backend for the HubHive social networking application, providing real-time chat, event management, and location-based services for connecting local communities.
- User Management: Registration, authentication, and profile management
- Real-time Chat: Socket.io powered chatrooms with location-based discovery
- Event Management: Create, discover, and manage local events
- Business Accounts: Special privileges for business owners
- Location Services: Geo-based chatroom and event discovery
- Payment Integration: Stripe integration for premium features
- RESTful APIs: Well-structured API endpoints
- Database Migrations: Alembic-based schema management
- Backend: Python 3.10+, Flask 2.3.3
- Database: PostgreSQL with SQLAlchemy ORM
- Real-time: Flask-SocketIO 5.3.6
- Authentication: JWT with Flask-JWT-Extended
- API Documentation: OpenAPI/Swagger (TBD)
- Payments: Stripe API integration
- Migrations: Flask-Migrate with Alembic
-
Install and install PostgreSQL and set up a database with username
hubhive_userand passwordpassword. This is a good guide if you haven't done this before, assuming Docker is installed. -
Create a virtual environment.
python -m venv .venv -
Activate virtual environment.
source .venv/bin/activate -
Install packages.
pip install -r requirements.txt -
Run the setup database script (first time only).
python setup_database.py -
Pull any potential database updates and update the database (if code was updated).
alembic upgrade head -
Start the actual backend.
python run.py
By default, the backend runs on port 8000.
hubhive-backend/
├── app/
│ ├── models/ # Database models
│ ├── routes/ # API route handlers
│ ├── services/ # Business logic layer
│ ├── utils/ # Utilities and helpers
│ ├── database/ # Database configuration
│ ├── migrations/ # Database migrations
│ └── static/ # Static files
├── requirements.txt
├── run.py
├── setup_database.py # Database initialization
└── .env.example