🌟 Note: This repository contains the backend code for FCIS Overflow, an API that emulates the functionality of Stack Overflow. It's especially for computer science students
The FCIS Overflow API is designed to replicate the core functionalities of Stack Overflow. It provides a robust backend for a platform where users can ask questions, post answers, and engage in discussions related to computer science courses. This project serves as a comprehensive guide for understanding how a Q&A platform operates and is an excellent resource for both beginners and experienced developers interested in Django and RESTful API development.
- 👤 User Registration and Email Verification via JWT
- 🛡️ User Login with Session Authentication or JWT
- 📌 User Profiles with Profile Pictures and Additional Information
- 📝 Asking Questions with Multiple Attachments
- 💬 Answering Questions and Voting (Up/Down)
- 📊 Filtering Questions by Title, Level, and Course with Pagination
- 🔍 Searching Questions by Title or Content with Pagination
- 📚 Admin API for Managing Levels and Courses
- 🔗 Retrieving Question and Their Answers
- 🗨️ Group Chat Creation, Member Management, and Real-time Updates with Django Channels
- 🔒 Blocking User Accounts with Admin Intervention
- 🐳 Docker and Docker Compose for Development
- Python (Django Rest Framework): Server-side Logic
- Django Channels: Real-time WebSocket Communication
- PostgreSQL: Database
- Django ORM: Object-Relational Mapping
- JWT Authentication: User Verification
- Docker-compose: Containerization for Development and Deployment
- Redis Channel Layer: Real-time Chat Updates
- Signals: Automatic User Blocking
- API Testing: Ensuring Feature Reliability
- Docker and docker-compose: Download and Install
-
Clone the Repository
git clone https://github.com/rengo540/FCIS-overflow-drf.git
-
Navigate to the Directory
cd FCIS-overflow-drf
-
Create
.env
File# Populate with your secret variables and configuration SECRET_KEY='' ALLOWED_HOST= DEBUG= DB_ENGINE=django.db.backends.postgresql DB_DATABASE= DB_USER= DB_PASSWORD= DB_HOST=db (postgres service name) DB_PORT= EMAIL_HOST_USER= EMAIL_HOST_PASSWORD= REDIS_HOST=cache (redis service name) ...
-
Start Docker Compose for Development
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build
-
Create a Superuser (Admin) Account
docker-compose exec fcisoverflow-app-container manage.py createsuperuser
to see the api documentation, you could request this endpoint:
http://localhost:3000/docs/
The FCIS Overflow API includes a WebSocket-based group chat feature that enables real-time communication among users. This chat feature is perfect for collaborative discussions and instant updates within groups.
To use the WebSocket-based group chat feature, follow these steps:
-
Connect to WebSocket
To initiate a WebSocket connection, you need to use WebSocket client libraries or WebSocket-capable tools. You'll connect to the WebSocket server with a URL, typically in the following format:
ws://your-api-domain/chat/
-
Authentication
WebSocket connections can be authenticated using either session authentication or JWT authentication, depending on your setup. Ensure that you include the necessary authentication tokens in the connection request headers.
ws://your-api-domain/chat/?token=access-token
this made by middleware authentication
-
Join a Group
To join a group chat, send a WebSocket message to the server indicating your intent to join a specific group. The server will add your WebSocket connection to the corresponding group channel.
-
Send and Receive Messages
Once connected to a group, you can send and receive messages in real time. Messages can be plain text or structured data, depending on your application's requirements.