A modern, scalable social networking API built with Flask, featuring real-time interactions, secure authentication, and comprehensive social features.
-
🔐 Authentication & Authorization
- JWT-based authentication
- Role-based access control
- Secure password handling
- Token refresh mechanism
-
👥 User Management
- User registration and profiles
- Follow/unfollow functionality
- User search and discovery
- Profile customization
-
📝 Content Management
- Posts and comments
- Media uploads
- Content moderation
- Rich text formatting
-
💬 Real-time Interactions
- WebSocket support
- Instant notifications
- Live updates
- Chat functionality
-
🔍 Search & Discovery
- Advanced search capabilities
- Content recommendations
- User discovery
- Trending topics
-
📊 Analytics & Monitoring
- User engagement metrics
- Content performance
- System health monitoring
- Error tracking
- Backend: Flask, Python 3.8+
- Database: PostgreSQL
- Cache: Redis
- Authentication: JWT
- Real-time: Socket.IO
- Monitoring: Prometheus, Grafana
- Testing: pytest
- Documentation: Swagger/OpenAPI
- Python 3.8 or higher
- PostgreSQL
- Redis
- Node.js (for Socket.IO)
- Clone the repository:
git clone https://github.com/yourusername/social-connect-api.git
cd social-connect-api
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration
- Initialize the database:
flask db upgrade
- Run the application:
flask run
The API documentation is available at /api/v1/docs
when running the application.
All API endpoints (except registration and login) require authentication using JWT tokens.
- Register a new user:
curl -X POST http://localhost:5000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"username": "user", "email": "user@example.com", "password": "password123"}'
- Login to get tokens:
curl -X POST http://localhost:5000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password123"}'
- Use the access token for authenticated requests:
curl -X GET http://localhost:5000/api/v1/users/me \
-H "Authorization: Bearer <access_token>"
pytest
flake8
black .
flask db migrate -m "description of changes"
flask db upgrade
The application can be deployed using Docker:
docker-compose up -d
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email labanrotich6544@gmail.com or join our Slack channel.