FastQuora is a question-and-answer platform, similar to Quora, where users can ask questions, provide answers, and vote on responses. It features a search functionality that allows users to find relevant questions and answers based on keywords. To enhance performance, a caching layer is implemented.
The project follows the repository pattern
to manage data operations via repositories and controllers. Below is the high-level architecture of the project:
This project utilizes a number of modern technologies:
FastQuora uses FastAPI as the backend framework and PostgreSQL for database management. It integrates Elasticsearch to index and search questions and answers, and uses Redis as a caching layer to boost performance.
The application is containerized using Docker and managed with Kubernetes. For monitoring and observability, the project employs Jaeger for distributed tracing and OpenTelemetry for telemetry data collection. Unit tests are written with pytest to ensure code reliability.
Additionally, GitHub Actions is used for continuous integration and deployment (CI/CD) to automate testing and deployment pipelines. Every pull request triggers the test suite, ensuring that the code is always in a working state. The CI/CD process includes:
- Build and push the image
- Running all unit tests with
pytest
to validate changes. - Running all unit tests on a production-like environment.
- Deploying the application to cloud infrastructure.
This project integrates monitoring features using OpenTelemetry, which collects, processes, and exports telemetry data like traces, metrics, and logs. The metrics are visualized using Jaeger.
Below is an example of the Jaeger metrics:
FastQuora includes a simple authentication system that allows users to register and log in. It uses JWT tokens to authenticate users and protect routes.
Users can view profiles to learn more about who has answered their questions. They can also update their own profiles to highlight their best features. The project does not collect any personal information, so users have the option to remain anonymous.
The question component is the core of FastQuora. Users can ask, view, and update questions. With the search functionality, users can find questions based on specific keywords.
The answer component allows users to respond to questions, view answers, and update their own answers.
FastQuora includes a voting system that allows users to upvote or downvote answers. To increase performance, votes are initially stored in Redis and then written to the database by a background task.
FastQuora can be run using Docker Compose or Kubernetes in either a local or production environment.
To access the project, you should first clone the repository and then navigate to the project directory. Run the following commands in your terminal:
- Clone the repository:
git clone https://github.com/mohamad-liyaghi/FastQuora.git
- Navigate to the project directory:
cd FastQuora/
After you've cloned the repository and navigated to the project directory, you can run FastQuora using Docker Compose by following these steps:
- Run the application:
For production mode, use:
make run
make deploy
To run FastQuora using Kubernetes:
- Create the ConfigMaps:
For production ConfigMaps, use:
make local_confmap
make prod_confmap
- Deploy the application:
make k8s
The application will now be running on your local machine. You can access the backend at http://localhost:8000 and Jaeger at http://localhost:16686.
Unit tests cover most parts of the application to ensure code quality and reliability. To run all tests:
make test
After running the tests, you should see the following output: