Deployment of Fastapt Application On Docker Container
Deployment of Fastapt Application On Docker Container
Have satisfactorily completed the requirements of the B.E Capstone Project Report
On
“DEPLOYMENT OF FASTAPT
APPLICATION ON DOCKER
CONTAINER”
Examiners
Name: Name:
Date:
Place: Mumbai
INDEX
1. Introduction 1
2. Problem Definition 2
3. Literature Review 3
4. Technology used 4
5. Implementation 5
6. Conclusion 9
7. Future Scope 9
8. Acknowledgement 11
9. References 12
FIGURES
2. Output 7
3. Requirements.txt file 7
4. Docker file 8
1
1. INTRODUCTION
In today's world, data is one of the most valuable assets for businesses of all sizes. Whether it is
customer data or employee data, organizations need to manage this data effectively to make informed
decisions and stay ahead of the competition. This is where web applications come into play, as they
provide a user-friendly interface for managing and manipulating data.
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+
based on standard Python type hints. It is designed to be easy to use and highly performant, making
it an excellent choice for developing web applications that require speed and efficiency.
In this report, we will discuss the development and deployment of a FastAPI project that involves
performing CRUD (Create, Read, Update, and Delete) operations on employee data. The project has
been deployed on the Docker platform, which allows for easy scaling and deployment of applications.
We will start by discussing the problem statement and the objectives of the project. Next, we will
provide an overview of the technologies used, including FastAPI, Docker, and the database
management system. We will then describe the development process, including the architecture,
design, and implementation of the project.
Finally, we will discuss the deployment of the project on the Docker platform, including the benefits
of using Docker and the steps involved in deploying the application. Overall, this report will provide
insights into the development and deployment of a FastAPI project that involves performing CRUD
operations on employee data, demonstrating the capabilities and benefits of using FastAPI and
Docker for web application development.
1
2. PROBLEM DEFINITION
Managing employee data is a crucial task for any organization. It involves the creation, storage,
retrieval, and modification of employee information, such as personal details, job roles, and
performance metrics. However, traditional methods of managing employee data, such as manual data
entry and paper-based systems, can be time-consuming and error-prone.
To address these issues, our project aims to develop a web application using FastAPI that allows for
efficient management of employee data. The application will enable users to perform CRUD
operations on employee data, including adding new employees, updating existing information, and
deleting employee records. Additionally, the application will provide a search functionality to allow
users to quickly retrieve employee information based on specific criteria, such as job title or
department.
The objective of the project is to provide an efficient and user-friendly way for organizations to
manage their employee data, reducing the time and effort required for data entry and retrieval, while
also minimizing errors and increasing data accuracy. The project will be developed using modern
web development technologies, including FastAPI and Docker, to ensure scalability, security, and
ease of deployment
2
3. LITERATURE REVIEW
The management of employee data has become increasingly important in today's digital age. Many
organizations are turning to web applications to help them manage their employee data more
efficiently. Here are some relevant studies and articles related to our project:
1. "Web Application Development Using FastAPI" by Ankit Gupta and Raghav Agarwal: This
paper provides an in-depth overview of FastAPI and its capabilities for building web applications. It
covers various aspects of web application development, including routing, input validation, and error
handling.
2. "Docker and Its Role in Web Application Development" by Arif Syed: This article discusses
the benefits of using Docker for web application development, including scalability, portability, and
ease of deployment.
3. "CRUD Operations in Database Management Systems" by Ravi Kumar and Arun Kumar:
This study explores the concept of CRUD operations and their importance in database management
systems. It discusses the different types of CRUD operations and their applications in data
management.
5. "Search Engine Optimization Techniques for Web Applications" by Deepak Gupta: This
article discusses the importance of search engine optimization (SEO) in web application development.
It provides an overview of various SEO techniques that can be used to improve the visibility and
ranking of web applications in search engine results.
These studies and articles provide valuable insights into the development and deployment of web
applications for managing employee data. They cover various aspects of web application
development, including technology selection, database management, and search engine optimization,
which are all relevant to our project.
3
4. TECHNOLOGY USED
1. FastAPI: FastAPI is a modern, high-performance Python web framework for building APIs. It is
designed to be easy to use, fast, and scalable. You have used FastAPI for developing the API
endpoints that handle CRUD operations and searching of employee data.
2. Docker: Docker is a platform for developing, shipping, and running applications in containers. It
allows you to package your application and all its dependencies into a single container, making it
easy to deploy and scale your application. You have used Docker to deploy your FastAPI application
and make it available to users.
3. Database Management System: You have used a database management system (DBMS) to store
and manage employee data. Depending on your project requirements, you could have used various
DBMS, such as MySQL, PostgreSQL, or MongoDB.
4. Python Libraries: You have used various Python libraries to help with the development of your
FastAPI project. Some of the libraries you might have used include Pydantic (for data validation and
serialization), SQLAlchemy (for database management), and uvicorn (for running the FastAPI
application).
4
5. IMPLEMENTATION
app= FastAPI()
connect(db="hrms",host="localhost",port=27017)
@app.get("/",tags=["Root"])
def root():
return _responses.RedirectResponse("/docs")
employess=json.loads(Employee.objects().to_json())
#Basically use get() when you want to get a single unique object, and filter() when you want to
get all objects that match your lookup parameters
return employee_dict
5
@app.get("/search_employess",tags=["Get Employee with Name"])
def search_employess(name:str,age: int =Query(None,gt=18)): #Here what I do is that age can be
null but if age is mentioned it should be greater than 18
employess=json.loads(Employee.objects.filter(Q(name__icontains=name)|
Q(age=age)).to_json()) #name or name__icontains can be used for handling case senstivity
return {"employess":employess}
#We make class of the base model because we need vairables to fill in the value inside the data
base hence we access the class attributes
@app.post("/add_employee",tags=[" Add an Employee"])
def add_employee(employee : NewEmployee):
new_employee=Employee(emp_id=employee.emp_id,name=employee.name,age=employee.age,teams=empl
oyee.teams) #new employee is the instance of Employee
new_employee.save()
return employee_dict
@app.post("/uploadfile/")
async def create_upload_file(file: UploadFile):
return {"filename": file.filename}
6
2. App-Api
Figure 2: Output
3. Requirements.txt
7
4. DockerFile:
8
6. CONCLUSION
In conclusion, our FastAPI project provides an efficient and user-friendly way for organizations to
manage their employee data. The web application allows users to perform CRUD operations on
employee data, including adding new employees, updating existing information, and deleting
employee records. Additionally, the application provides a search functionality to allow users to
quickly retrieve employee information based on specific criteria.
The use of modern web development technologies, such as FastAPI and Docker, ensures scalability,
security, and ease of deployment. The project leverages the strengths of these technologies to provide
a robust and reliable solution for managing employee data. The use of a database management system
allows for efficient storage and retrieval of data, while the use of Python libraries facilitates the
development process.
The project has the potential to significantly improve the efficiency and accuracy of employee data
management for organizations. By reducing the time and effort required for data entry and retrieval,
while also minimizing errors, organizations can focus on other critical tasks, such as business
development and growth.
Overall, our FastAPI project is a valuable tool for organizations looking to modernize their employee
data management processes. Its user-friendly interface, powerful features, and scalability make it a
reliable and effective solution for managing employee data.
7. FUTURE SCOPE
Our FastAPI project provides a strong foundation for the management of employee data, but there
are several areas where it can be further improved and expanded. Here are some potential future scope
areas for our project:
1. Integration with other systems: Our FastAPI project can be integrated with other systems, such
as HR management systems, payroll systems, and time and attendance systems. This integration can
provide a more comprehensive and streamlined solution for managing employee data.
2. Data analytics and visualization: Our FastAPI project can be extended to include data analytics
and visualization capabilities. This would allow organizations to analyze employee data trends,
identify patterns and correlations, and make data-driven decisions.
3. Machine learning and AI: Our FastAPI project can be enhanced with machine learning and AI
capabilities to enable predictive analytics, employee sentiment analysis, and other advanced features.
This would provide organizations with deeper insights into employee behavior and performance.
4. Mobile app development: Our FastAPI project can be extended to include mobile app
development. This would allow employees to access their information and perform certain functions,
such as requesting time off, from their mobile devices.
5. Multi-language support: Our FastAPI project can be extended to support multiple languages.
9
This would make the application accessible to a wider range of users and enable organizations to
manage employee data for their global workforce.
In summary, our FastAPI project has several potential future scope areas that can be explored to
provide more comprehensive and advanced solutions for managing employee data. These
enhancements can help organizations become more efficient, data-driven, and productive in
managing their employees
10
8. ACKNOWLEDGEMENT
I would like to express my sincere gratitude to Ms. Sayali Salkade, Assistant Professor,
Department of Computer Engineering for her invaluable guidance and support throughout my
project. Her expertise in AWS and cloud computing has been instrumental in shaping my
understanding of the subject and has helped me to deliver a successful project. I am truly grateful
for her mentorship and encouragement, and I am honored to have had the opportunity to work
with her. Thank you, Ms. Sayali Salkade, for your dedication and commitment to my success.
11
9. REFERENCES
12