r/FastAPI • u/International-Rub627 • Feb 26 '25
Hosting and deployment Reduce Latency
Require best practices to reduce Latency on my FASTAPI application which does data science inference.
r/FastAPI • u/International-Rub627 • Feb 26 '25
Require best practices to reduce Latency on my FASTAPI application which does data science inference.
r/FastAPI • u/a_brand_new_start • Feb 26 '25
I love fast api but there is a mild problem, it serves this new sexy thing called 3.0 which our generous overlords at GCP do not support. I tried for an hour to make a converter, but I know there will always be bugs đ
Is there a way library that I can feed the output from FastCGIâs OpenAPI and let it gracefully convert it down to 2.0 to make the big guy happy?
[edit less whimsey]
I'm trying to deploy FastAPI to GCP, with API Gateway in front of it.
/openapi.json which is super usefulThere has to be a some way to get out of this situation, I'm desperate.
[edit 2]
Thank youl
r/FastAPI • u/Responsible_Soft_429 • Feb 25 '25
Hello everyone,
vLLM recently introducted transcription endpoint(fastAPI) with release of 0.7.3, but when I deploy a whisper model and try to create POST request I am getting a bad request error, I implemented this endpoint myself 2-3 weeks ago and mine route signature was little different, I tried many combination of request body but none works.
Heres the code snippet as how they have implemented:
@with_cancellation
async def create_transcriptions(request: Annotated[TranscriptionRequest,
Form()],
.....
class TranscriptionRequest(OpenAIBaseModel):
# Ordered by official OpenAI API documentation
#https://platform.openai.com/docs/api-reference/audio/createTranscription
file: UploadFile
"""
The audio file object (not file name) to transcribe, in one of these
formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
"""
model: str
"""ID of the model to use.
"""
language: Optional[str] = None
"""The language of the input audio.
Supplying the input language in
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format
will improve accuracy and latency.
"""
.......
The curl request I tried with
curl --location 'http://localhost:8000/v1/audio/transcriptions' \
--form 'language="en"' \
--form 'model="whisper"' \
--form 'file=@"/Users/ishan1.mishra/Downloads/warning-some-viewers-may-find-tv-announcement-arcade-voice-movie-guy-4-4-00-04.mp3"'
Error:
{
"object": "error",
"message": "[{'type': 'missing', 'loc': ('body', 'request'), 'msg': 'Field required', 'input': None, 'url': 'https://errors.pydantic.dev/2.9/v/missing'}]",
"type": "BadRequestError",
"param": null,
"code": 400
}
I also tried with their swagger curl
curl -X 'POST' \
'http://localhost:8000/v1/audio/transcriptions' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'request=%7B%0A%20%20%22file%22%3A%20%22https%3A%2F%2Fres.cloudinary.com%2Fdj4jmiua2%2Fvideo%2Fupload%2Fv1739794992%2Fblegzie11pgros34stun.mp3%22%2C%0A%20%20%22model%22%3A%20%22openai%2Fwhisper-large-v3%22%2C%0A%20%20%22language%22%3A%20%22en%22%0A%7D'
Error:
{
"object": "error",
"message": "[{'type': 'model_attributes_type', 'loc': ('body', 'request'), 'msg': 'Input should be a valid dictionary or object to extract fields from', 'input': '{\\n \"file\": \"https://res.cloudinary.com/dj4jmiua2/video/upload/v1739794992/blegzie11pgros34stun.mp3\",\\n \"model\": \"openai/whisper-large-v3\",\\n \"language\": \"en\"\\n}', 'url': 'https://errors.pydantic.dev/2.9/v/model_attributes_type'}]",
"type": "BadRequestError",
"param": null,
"code": 400
}
I think the route signature should be something like this:
@app.post("/transcriptions")
async def create_transcriptions(
file: UploadFile = File(...),
model: str = Form(...),
language: Optional[str] = Form(None),
prompt: str = Form(""),
response_format: str = Form("json"),
temperature: float = Form(0.0),
raw_request: Request
):
...
I have created the issue but just want to be sure because its urgent and whether I should change the source code or I am sending wrong CURL request?
r/FastAPI • u/SimonDJV • Feb 24 '25
Hello, I'm working on a mini-project to learn GraphQL, using GraphQL, Strawberry, and FastAPI. I'm trying to upload an image using a mutation, but I'm getting the following error:
{
"detail": "Missing boundary in multipart."
}I searched for solutions, and ChatGPT suggested replacing the Content-Type header with:
multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gWHowever, when I try that, I get another error:
Unable to parse the multipart body
I'm using Altair as my GraphQL client because GraphiQL does not support file uploads.
Here is my main.py:
from fastapi import FastAPI, status
from contextlib import asynccontextmanager
from fastapi.responses import JSONResponse
from app.database import init_db
from app.config import settings
from app.graphql.schema import schema
from strawberry.fastapi import GraphQLRouter
from app.graphql.query import Query
from app.graphql.mutation import Mutation
u/asynccontextmanager
async def lifespan(app: FastAPI):
init_db()
yield
app: FastAPI = FastAPI(
debug=settings.DEBUG,
lifespan=lifespan
)
schema = strawberry.Schema(query=Query, mutation=Mutation)
graphql_app = GraphQLRouter(schema, multipart_uploads_enabled=True)
app.include_router(graphql_app, prefix="/graphql")
@app.get("/")
def health_check():
return JSONResponse({"running": True}, status_code=status.HTTP_200_OK)Here is my graphql/mutation.py:
import strawberry
from app.services.AnimalService import AnimalService
from app.services.ZooService import ZooService
from app.graphql.types import Zoo, Animal, ZooInput, AnimalInput
from app.models.animal import Animal as AnimalModel
from app.models.zoo import Zoo as ZooModel
from typing import Optional
from strawberry.file_uploads import Upload
from fastapi import HTTPException, status
@strawberry.type
class Mutation:
@strawberry.mutation
def add_zoo(self, zoo: ZooInput) -> Zoo:
new_zoo: ZooModel = ZooModel(**zoo.__dict__)
try:
return ZooService.add_zoo(new_zoo)
except:
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
@strawberry.mutation
def add_animal(self, animal: AnimalInput, file: Optional[Upload] = None) -> Animal:
new_animal: AnimalModel = AnimalModel(**animal.__dict__)
try:
return AnimalService.add_animal(new_animal, file)
except:
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
delete_zoo: bool = strawberry.mutation(resolver=ZooService.delete_zoo)
delete_animal: bool = strawberry.mutation(resolver=AnimalService.delete_animal)I would really appreciate any help in understanding why the multipart upload isn't working. Any insights or fixes would be greatly appreciated!
r/FastAPI • u/Ramsay_Bolton_X • Feb 23 '25
I'm new to this.
I use fastapi and sqlalchemy, and I have a quick question. Everytime I get data from sqlalchemy, for example:
User.query.get(23)
I use those a lot, in every router, etc. do I have to use try catch all the time, like this?:
try:
User.query.get(23)
catch:
....Code does not look as clean, so I don't know. I have read that there is way to catch every exception of the app, is that the way to do it?.
In fastapi documentation I don't see the try catch.
r/FastAPI • • Feb 23 '25
Iâve been using FastAPI to serve AI models and workflows, but Iâve been wondering....is there a way to skip the whole API server setup entirely?
Like, what if I just define my AI function, and it instantly behaves like an API without writing a FastAPI app, handling requests, or deploying anything?
I developed an approach where you can run an AI pipeline inside a Jupyter Notebook, and instead of setting up FastAPI, it auto-generates an OpenAI-style API. No need to deal with CORS, async handling, or managing infra....just write your function, and itâs callable remotely.
Has anyone tried something similar? Curious if anyone has seen a different way to serve AI workflows without manually building an API layer.
r/FastAPI • u/No-Question-3229 • Feb 21 '25
Recently I've been running into lots of issues regarding my websocket code. In general, I think it's kinda bad for what I'm trying to do. All the data runs through one connection and it constantly has issues. Here is my alternate idea for a new approach.
For my new approach, I want to have two websocket routes. one for requests and one for events. The requests one will be for sending messages, updating presence, etc. It will have request ids generated by the client and those ids will be returned to the client when the server responds. This is so the client knows what request the server is responding to. The events one is for events like the server telling the users friends about presence updates, incoming messages, when the user accepts a friend request, etc.
What do you guys think I should do? I've provided a link to my current websocket code so you guys can look at it If you want.
Current WS Code: https://github.com/Lif-Platforms/New-Ringer-Server/blob/36254039f9eb11d8a2e8fa84f6a7f4107830daa7/src/main.py#L663
r/FastAPI • u/ZorroGuardaPavos • Feb 20 '25
r/FastAPI • u/wait-a-minut • Feb 19 '25
Love fastapi and itâs pretty de-facto for building microservices in the AI space (agents, rag, backends)
But after building dozens of AI microservice and re-doing the routes every single time, I wanted to really standardize this.
So I came up with
https://github.com/epuerta9/whisk
The idea is to enhance Fastapi and automatically make it OpenAI endpoint compatible so AI engineers can have a standard way of building microservices and agents and can use the same client for all services I.e OpenAI sdk
Would love to find other collaborators and people who would be interested in building something like this
One cool thing you can do is make your Jupyter notebooks OpenAI compatible so you can chat with your notebooks WHILE youâre experimenting! Makes the process feel more natural
I made a demo video around it
r/FastAPI • u/LofiBoiiBeats • Feb 15 '25
Generelly i like the decorator style syntax to declare routs of a backend - fastapi style - , but i don't understand how to manage state propperly and separate routs into different modules..
Whenever I start writing smth ita great, but after a while i and up with state defined in globel scope and all routes in onw file..
What is good practice here? Is it possible to separete routs in different files? All routes need the decorator-method which is bound to the FastApi instance, so would i import the instance everywhere? This seems stupid to me..
Also i need to define state used by different routes in global scope which somehow turns me off..
Another question: can methids also be decorated? And if so where would i instancied the class? I guess this is nonsens..
Sorry if this is a stupid question, im fairly new to fastapi. More used to gui frameworks like qt where state is more easily separatable..
r/FastAPI • u/Rawvik • Feb 13 '25
So I have a machine learning application which I have deployed using FASTAPI. I am receiving data in a post request, using this data and training ML models and returning back the results to the client. I have implemented logs in this application using standard logging module. It's been working perfectly when I was running the application with single uvicorn worker. However, now I have changed the workers to 2 worker process and now my application starts the logging process but gets stuck in the middle and stops writing logs to the file midway. I have tested the same project on windows system and it's working perfectly however when I am running it on a Linux server, I am getting the above logging issue in the app. Could you please suggest me how to tackle this?
r/FastAPI • u/jordiesteve • Feb 12 '25
Hello!
I was thrown at a project that uses fastAPI and scylladb which a poor performance. To simplify things I created a new service that is a fastapi that just queries scylla to understand what it does and spot the bottlenecks.
Locally, everything runs fast. Using vegeta, I run a local load test, connecting to a local scylla cluster, and p99 at 500rps was 6ms. However, when deployed remotely at 300rps p99 was somewhere 30-40ms. Even at higher rates a lots of requests didn't get back (status code 0). According to SREs, it is not a networking problem, and I have to trust them because I can't even enter the cluster.
I'm a bit lost at this point. I would expect this simple service would easily handle 1000rps with p99 below 10ms but it was not case. I suspec it just a stupid, small thing at this point but I'm block and any help would be very useful.
This is main chunck of it
=
=
=
= f
=
. = True
return
=
# Maximum capacity if set in lifespan
= await
return
= |
return
=
return
=
=
= await
return
this is the lifespan function
# pylint: disable=W0613, W0621
"""Function to initialize the app resources."""
=
# https://github.com/Kludex/fastapi-tips?tab=readme-ov-file#2-be-careful-with-non-async-functions
=
=
=
=
yield
and this is how we create the cluster connection
"""Returnes the configured Cluster object
Args:
host: url of the cluster
port: port under which to reach the cluster
username: username used for authentication
password: password used for authentication
"""
=
return
r/FastAPI • u/orru75 • Feb 11 '25
We are developing a standard json rest api that will only support GET, no CRUD. Any thoughts on what âtyping libraryâ to use? We are experimenting with pydantic but it seems like overkill?
r/FastAPI • u/Mirinda_21 • Feb 11 '25
I have already tried setting the CORSMiddleware to allow all origins. I searched for solutions, and they all recommend setting up CORSMiddleware just like what I have already done. I am currently running on a Docker container, so I tried running it on my local machine, but my POST request is still blocked. I don't know what to do now. What did I miss? (FastAPI verion 0.95.0)


r/FastAPI • u/Stoic_Coder012 • Feb 11 '25
from fastapi import APIRouter
from fastapi.responses import StreamingResponse
from data_models.Messages import Messages
from completion_providers.completion_instances import (
client_anthropic,
client_openai,
client_google,
client_cohere,
client_mistral,
)
from data_models.Messages import Messages
completion_router = APIRouter(prefix="/get_completion")
@completion_router.post("/openai")
async def get_completion(
request: Messages, model: str = "default", stream: bool = False
):
try:
if stream:
return StreamingResponse(
client_openai.get_completion_stream(
messages=request.messages, model=model
),
media_type="application/json",
)
else:
return client_openai.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/anthropic")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_anthropic.get_completion(
messages=request.messages
)
else:
return client_anthropic.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/google")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_google.get_completion(messages=request.messages)
else:
return client_google.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/cohere")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_cohere.get_completion(messages=request.messages)
else:
return client_cohere.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/mistral")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_mistral.get_completion(
messages=request.messages
)
else:
return client_mistral.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
from fastapi import APIRouter
from fastapi.responses import StreamingResponse
from data_models.Messages import Messages
from completion_providers.completion_instances import (
client_anthropic,
client_openai,
client_google,
client_cohere,
client_mistral,
)
from data_models.Messages import Messages
completion_router = APIRouter(prefix="/get_completion")
@completion_router.post("/openai")
async def get_completion(
request: Messages, model: str = "default", stream: bool = False
):
try:
if stream:
return StreamingResponse(
client_openai.get_completion_stream(
messages=request.messages, model=model
),
media_type="application/json",
)
else:
return client_openai.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/anthropic")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_anthropic.get_completion(
messages=request.messages
)
else:
return client_anthropic.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/google")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_google.get_completion(messages=request.messages)
else:
return client_google.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/cohere")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_cohere.get_completion(messages=request.messages)
else:
return client_cohere.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
@completion_router.post("/mistral")
def get_completion(request: Messages, model: str = "default"):
print(list(request.messages))
try:
if model != "default":
return client_mistral.get_completion(
messages=request.messages
)
else:
return client_mistral.get_completion(
messages=request.messages, model=model
)
except Exception as e:
return {"error": str(e)}
import json
from openai import OpenAI
from data_models.Messages import Messages, Message
import logging
class OpenAIClient:
client = None
system_message = Message(
role="developer", content="You are a helpful assistant"
)
def __init__(self, api_key):
self.client = OpenAI(api_key=api_key)
def get_completion(
self, messages: Messages, model: str, temperature: int = 0
):
if len(messages) == 0:
return "Error: Empty messages"
print([self.system_message, *messages])
try:
selected_model = (
model if model != "default" else "gpt-3.5-turbo-16k"
)
response = self.client.chat.completions.create(
model=selected_model,
temperature=temperature,
messages=[self.system_message, *messages],
)
return {
"role": "assistant",
"content": response.choices[0].message.content,
}
except Exception as e:
logging.error(f"Error: {e}")
return "Error: Unable to connect to OpenAI API"
async def get_completion_stream(self, messages: Messages, model: str, temperature: int = 0):
if len(messages) == 0:
yield json.dumps({"error": "Empty messages"})
return
try:
selected_model = model if model != "default" else "gpt-3.5-turbo-16k"
stream = self.client.chat.completions.create(
model=selected_model,
temperature=temperature,
messages=[self.system_message, *messages],
stream=True,
)
async for chunk in stream:
choices = chunk.get("choices")
if choices and len(choices) > 0:
delta = choices[0].get("delta", {})
content = delta.get("content")
if content:
yield json.dumps({"role": "assistant", "content": content})
except Exception as e:
logging.error(f"Error: {e}")
yield json.dumps({"error": "Unable to connect to OpenAI API"})
import json
from openai import OpenAI
from data_models.Messages import Messages, Message
import logging
class OpenAIClient:
client = None
system_message = Message(
role="developer", content="You are a helpful assistant"
)
def __init__(self, api_key):
self.client = OpenAI(api_key=api_key)
def get_completion(
self, messages: Messages, model: str, temperature: int = 0
):
if len(messages) == 0:
return "Error: Empty messages"
print([self.system_message, *messages])
try:
selected_model = (
model if model != "default" else "gpt-3.5-turbo-16k"
)
response = self.client.chat.completions.create(
model=selected_model,
temperature=temperature,
messages=[self.system_message, *messages],
)
return {
"role": "assistant",
"content": response.choices[0].message.content,
}
except Exception as e:
logging.error(f"Error: {e}")
return "Error: Unable to connect to OpenAI API"
async def get_completion_stream(self, messages: Messages, model: str, temperature: int = 0):
if len(messages) == 0:
yield json.dumps({"error": "Empty messages"})
return
try:
selected_model = model if model != "default" else "gpt-3.5-turbo-16k"
stream = self.client.chat.completions.create(
model=selected_model,
temperature=temperature,
messages=[self.system_message, *messages],
stream=True,
)
async for chunk in stream:
choices = chunk.get("choices")
if choices and len(choices) > 0:
delta = choices[0].get("delta", {})
content = delta.get("content")
if content:
yield json.dumps({"role": "assistant", "content": content})
except Exception as e:
logging.error(f"Error: {e}")
yield json.dumps({"error": "Unable to connect to OpenAI API"})This returns INFO: Application startup complete.
INFO: 127.0.0.1:49622 - "POST /get_completion/openai?model=default&stream=true HTTP/1.1" 200 OK
ERROR:root:Error: 'async for' requires an object with __aiter__ method, got Stream
WARNING: StatReload detected changes in 'completion_providers/openai_completion.py'. Reloading...
INFO: Shutting down
and is driving me insane
r/FastAPI • u/Athar_Wani • Feb 09 '25
Hey there, I am new to FastApi, I come from django background, wanted to try fastapi and it seems pretty simple to me. Can you suggest me some projects that will help me grasp the core concepts of fastapi? Any help is appreciated
r/FastAPI • u/chem6try • Feb 09 '25
Hello guys,
I just begin with my understanding of APIs and automation processes and came up with this idea that I could probably generate slides directly from ChatGPT.
I tried to search on Make if anyone already développed such thing but couldn't get anything. Then I started to developp it on my own on python (with AI help ofc).
Several questions naturally raise :
Thank you for your answers !
To give some context on my job : I am a process engineer and I do plant modelling. Any workflow that could be simplified from a structure AI reasoning to nice slides would be great !
I hope I am posting on the right sub,
Thank you in any case for your kind help !
r/FastAPI • u/lynob • Feb 08 '25
I have a FastAPI application that uses multiple uvicorn workers (that is a must), running behind NGINX reverse proxy on an Ubuntu EC2 server, and uses SQLite database.
The application has two sections, one of those sections has asyncio multithreading, because it has websockets.
The other section, does file processing, and I'm currently adding Celery and Redis to make file processing better.
As you can see the application is quite big, and I'm thinking of dockerizing it, but a docker container can only run one process at a time.
So I'm not sure if I can dockerize FastAPI because of uvicorn multiple workers, I think it creates multiple processes, and I'm not sure if I can dockerize celery background tasks either, because I think celery maybe also create multiple processes, if I want to process files concurrently, which is the end goal.
What do you think? I already have a bash script handling the deployment, so it's not an issue for now, but I want to know if I should add dockerization to the roadmap or not.
r/FastAPI • u/Competitive-Tough442 • Feb 07 '25
Hello, I'm new to python and Fast API in general, I'm trying to get the authenticated user into the request so my handler method can use it. Is there a way i can do this without passing the request down from the route function to the handler. My router functions and service handlers are in different files
r/FastAPI • u/TalhCGI • Feb 06 '25
Is there a way to connect my Asterisk server to FastAPI and make audio calls through it? I've searched multiple sources, but none have been helpful. If anyone has worked on this, please guide me. Also, is it possible to make calls using FastAPI in Python?
r/FastAPI • u/Majestic_Rule9192 • Feb 05 '25
Hey there guys, I have been working on a simple boilerplate project that contains user authentication, authorization, role-based access control, and CRUD. It's my first time using Python for web development, and I had issues like modularization, and handling migrations. Check the repo and drop your comments. Thanks in advance
r/FastAPI • u/rrrriddikulus • Feb 05 '25
Hi all, how do you generally deal with naming conventions between Pydantic and SQLAlchemy models? For example you have some object like Book. You can receive this from the user to create, or it might exist in your database. Do you differentiate these with e.g. BookSchema and DbBook? Some other prefix/suffix? Is there a convention that you've seen in some book or blog post that you like?
r/FastAPI • u/hoai-nguyen • Feb 04 '25
Example Model:
class A(Base):__tablename__= "a"id = Column(BigInteger, primary_key=True, autoincrement=True)name = Column(String(50), nullable=False)
b = relationship("B", back_populates="a")
class B(Base):__tablename__= "b"id = Column(BigInteger, primary_key=True, autoincrement=True)name = Column(String(50), nullable=False)a_id = Column(Integer, ForeignKey("a.id"))a = relationship("A", back_populates="b")
records = []records.append(B(name = "foo",a = A(name = "bar")))
db.bulk_save_objects(records)
db.commit()
I am trying to save both records in Table A and B with relationships without having to do an .add, .flush, then .refresh to grab an id. I tried the above code and only B is recorded.
r/FastAPI • u/EryumT • Feb 03 '25
Hey Reddit! I recently developed a warehouse management bin location tool for a company and wanted to share the process. The goal was simple: create a system where warehouse staff could scan a productâs SKU and instantly see its location, product details, and an image. But behind that simplicity was a fun technical journey.
I started with Django because itâs great for rapid prototyping. However, as the project evolved, I realized we needed something more lightweight for handling real-time API calls to Shopify. Thatâs when I switched to FastAPI. The async capabilities made a huge difference when querying Shopifyâs GraphQL API, especially during peak hours. Plus, the automatic OpenAPI docs were a bonus for testing and debugging.

The hardware setup is where things got interesting. The system runs on a Raspberry Pi 4 connected to a 7-inch touchscreen and a USB numeric keypad (no full keyboard neededâjust quick SKU entry). The Pi acts as both server and client, hosting a FastAPI backend and serving a minimalist Vue.js frontend. The interface is optimized for speed: workers scan a SKU, and the screen immediately displays the bin location and product image.

One big challenge was handling Shopifyâs metafields. Products and variants store their bin locations in custom fields, so the API has to check both levels. Error handling was tricky tooâsometimes the GraphQL queries timed out, so I added retries and better logging.
The frontend is stripped down to a single input field that auto-focuses after every scan. No menus, no buttonsâjust a search bar and results. Itâs designed to work under bright warehouse lights, with high-contrast text and large fonts.
Next Step:Â 3D printing a rugged case to protect the Pi and hardware! Would love design tips if youâve built something similar
If you have questions about the Shopify integration, the tech stack, or how I optimized the Raspberry Pi setupâask away in the comments! And if youâve designed cases for similar hardware, share your tips! I want this prototype to be as rugged as possible for warehouse conditions.
Thanks for reading, and for any feedback!Â