docs: ✏️ stack

added stack
This commit is contained in:
Stan Girard 2023-12-29 11:52:34 +01:00
parent 126c0dbf73
commit 3eda24975c

View File

@ -1,60 +1,177 @@
---
sidebar_position: 3
title: Stack
---
Quivr is using FastAPI to provide a RESTful API for the backend. The API is currently in beta and is subject to change. The API is available at [https://api.quivr.app](https://api.quivr.app).
Welcome to the official documentation of **Quivr**, the RESTful Second Brain crafted for efficiency, speed, and reliability. Designed for developers who prioritize performance and ease of use, Quivr leverages the robust capabilities of **FastAPI**.
You can find the Swagger documentation for the API at [https://api.quivr.app/docs](https://api.quivr.app/docs).
## Backend Stack
## Overview
### FastAPI: The Foundation of Quivr
This documentation outlines the key points and usage instructions for interacting with the API backend. Please follow the guidelines below to use the backend services effectively.
FastAPI is central to Quivr's high-performance capabilities. Here, we explore its role and the benefits it brings to the table.
## FastAPI
<AccordionGroup>
<Accordion title="Introduction to FastAPI">
FastAPI is a leading-edge web framework for building APIs with Python 3.6+. It stands out for its speed, efficiency, and compatibility with modern development needs.
- **Speed**: FastAPI is one of the fastest web frameworks for Python...
- **Type Checking**: Utilizes Python type hints for validation...
- **Asynchronous Coding**: Supports asynchronous request handling...
</Accordion>
<Accordion title="Choosing FastAPI for Quivr">
Our selection of FastAPI aligns perfectly with Quivr's design philosophy...
- **Performance and Scalability**: FastAPI's speed makes Quivr highly efficient...
- **Ease of Use**: Its intuitive design allows for rapid development...
- **Rich Feature Set**: FastAPI comes with built-in support for data validation...
</Accordion>
<Accordion title="FastAPI vs Other Frameworks">
FastAPI's performance metrics are superior when compared to counterparts like Flask and Django...
- **Flask**: While Flask is simpler, FastAPI provides built-in support...
- **Django**: Django is a full-stack framework, but for API development...
</Accordion>
</AccordionGroup>
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. FastAPI is a class-based API framework that is built on top of Starlette and Pydantic. FastAPI is a great choice for building APIs because it is easy to use, fast, and has a lot of great features.
### Authentication: Secure Access to Quivr
We decided to choose FastAPI because it is a modern, fast, and easy-to-use API framework. FastAPI is also very well documented and has a lot of great features that make it easy to build APIs. FastAPI is also very well supported by the community and has a lot of great features that make it easy to build APIs.
Secure and streamlined authentication is key to accessing Quivr's features.
## Authentication
<Steps>
<Step title="Account Creation">
Sign up for Quivr and navigate to the `/user` page on your user dashboard.
</Step>
<Step title="API Key Generation">
Generate your unique API key in the settings, your access token to Quivr's backend services.
</Step>
<Step title="API Key Usage">
Include the generated API key in the request header for secure access.
</Step>
</Steps>
The API uses API keys for authentication. You can generate an API key by signing in to the frontend application and navigating to the `/config` page. The API key will be required to authenticate your requests to the backend.
### The Architecture of Our Kingdom: Robust and Scalable
When making requests to the backend API, include the following header:
Quivr's architecture is a testament to modern, scalable web service design:
```http
Authorization: Bearer {api_key}
```
<CardGroup cols={2}>
<Card title="Load Balancer" icon="network-wired">
The Load Balancer efficiently manages incoming traffic, ensuring optimal performance.
</Card>
<Card title="Container Service" icon="docker">
Our Container Service orchestrates digital services, maintaining operational harmony.
</Card>
<Card title="Queue" icon="crown">
The Queue system prioritizes and manages task execution.
</Card>
<Card title="Celery Worker" icon="list">
Celery Worker handles queued tasks, ensuring timely and effective execution.
</Card>
</CardGroup>
Replace `{api_key}` with the generated API key obtained from the frontend
### Words of Wisdom: Keeping Your API Secure
You can find more information in the [Authentication](/docs/Developers/useQuivr/get_your_api_key) section of the documentation.
<Warning>
Always protect your API key. It's crucial for maintaining the security and integrity of your access to Quivr.
</Warning>
## Architectural Schema
### The Balance of Power: Pros and Cons Analysis
Understanding the pros and cons of FastAPI helps in making informed decisions:
<AccordionGroup>
<Accordion title="Advantages of Using FastAPI">
FastAPI enhances development with its swift performance...
</Accordion>
<Accordion title="Considerations for FastAPI">
While advantageous, FastAPI requires understanding of modern programming concepts...
</Accordion>
</AccordionGroup>
### Interactive API Sandbox: Experience Quivr in Action
Engage with Quivr's functionality in real-time in our interactive API sandbox:
<Info>
🌐 [Test and refine your API calls using our sandbox.](/https://api.quivr.app/docs)
</Info>
## Frontend
### Next.js and Vercel: The Dynamic Duo
Quivr's frontend is crafted with Next.js, a cutting-edge React framework, and is hosted on Vercel, a platform tailored for frontend frameworks like Next.js. This combination provides a seamless, efficient, and scalable user experience.
### Next.js: The Power of React Enhanced
Next.js is chosen for its robust features that elevate the React development experience:
<AccordionGroup>
<Accordion title="Server-Side Rendering & Static Generation">
Next.js supports SSR and Static Generation, crucial for performance and SEO. This ensures Quivr's pages are pre-rendered for faster load times and improved search engine visibility.
</Accordion>
<Accordion title="API Routes">
Next.js allows the creation of API endpoints within the application, enabling a seamless blend of client and server-side logic.
</Accordion>
<Accordion title="Enhanced Development Experience">
With features like fast refresh and built-in CSS support, Next.js streamlines the development process, boosting developer productivity.
</Accordion>
<Accordion title="Scalability">
Next.js's architecture facilitates easy scaling of applications to meet growing user bases and complex features.
</Accordion>
</AccordionGroup>
### Vercel: Optimized Hosting for Next.js
Vercel, renowned for its global deployment capabilities and serverless functions, hosts Quivr's frontend:
<div style={{ textAlign: 'center' }}>
<img src="/images/architectural-high-level.png" alt="Quivr architecture" style={{ width: '60%' }} />
</div>
<CardGroup cols={2}>
<Card title="Optimized for Next.js" icon="react">
Vercel, built by the creators of Next.js, ensures seamless integration and optimal performance for Quivr's frontend.
</Card>
<Card title="Edge Network" icon="network-wired">
Leveraging Vercel's Edge Network reduces latency and speeds up content delivery, enhancing user experience.
</Card>
<Card title="Continuous Deployment" icon="octopus-deploy">
Continuous deployment on Vercel allows for swift and efficient updates, keeping Quivr's frontend up-to-date.
</Card>
<Card title="Scalable Infrastructure" icon="layer-group">
Vercel's infrastructure automatically scales to meet user demand, ensuring consistent performance even during peak times.
</Card>
</CardGroup>
### Load Balancer
The role of the load balancer is to catch the incoming traffic and redirect to the corresponding server. It is also responsible for the SSL termination.
<Tip>
By combining Next.js and Vercel, Quivr achieves a robust, scalable, and responsive web application, meeting the demands of modern web users and developers.
</Tip>
This integration of Next.js and Vercel is a testament to Quivr's commitment to delivering high-quality, responsive, and dynamic web applications, catering to modern web development needs.
### Container Service
### The Art of Customization: Tailwind CSS
The role of this service is to manage the replicas of all the services. It hold the information about the number of replicas of each service and the corresponding server.
Tailwind CSS offers extensive customization options for your Quivr integration:
### Queue
<Tip>
Utilize Tailwind CSS to style and transform your components, adding a personalized touch to your projects.
</Tip>
The role of the queue it to store "tasks" that are long to run and that can be run asynchronously. In our case we use it to embed the files and to index them as it can take a lot of time.
## Architectural Overview
### Celery Worker
Explore the intricacies of Quivr's architecture through this detailed diagram:
The role of the celery worker is to run the tasks that are stored in the queue. It is a distributed task queue that can run tasks asynchronously.
<Frame>
<img src="/images/architectural-high-level.png" alt="Quivr Architecture Diagram"/>
</Frame>
### Supabase
## Quivr Community
Your input is invaluable in shaping the future of Quivr. Connect with us:
<Tabs>
<Tab title="Feedback">
Share your feedback and suggestions to enhance Quivr.
</Tab>
<Tab title="Community">
Engage with peers in our forums and social platforms for support and collaboration.
</Tab>
</Tabs>
---
*Embrace the capabilities of Quivr, a tool designed to revolutionize your development workflow. Dive into a world where efficiency meets innovation.*
Supabase is used to do the authentication and to store the users information. It is a great open-source alternative to Firebase. It is currently used as a database, an authentication service, a vector store and a file store.