If you're developing or running a FastAPI application on Windows, manually opening a terminal and starting Uvicorn every time you sign in gets old quickly.
Windows Task Scheduler provides a built-in way to launch your application automatically when you log in—without turning it into a Windows service.
Windows sign-in startup vs. a Windows service
These are two different approaches:
- Task Scheduler at sign-in: Starts your FastAPI application after you sign in to your Windows account.
- Windows service: Can run independently of an interactive user session, including before anyone signs in.
If you're running a local development tool, personal dashboard, or an application you use during your Windows session, Task Scheduler may be sufficient.
If you need an unattended production server, a properly configured Windows service or another dedicated deployment environment may be more appropriate.
Option 1: Configure FastAPI startup manually
Suppose your project lives in:
C:\Projects\my-fastapi-app
And your virtual environment is located at:
C:\Projects\my-fastapi-app\.venv
First, verify that your application starts normally:
cd C:\Projects\my-fastapi-app
.\.venv\Scripts\python.exe -m uvicorn main:app --host 127.0.0.1 --port 8000
Replace main:app with your actual application import path.
Once that works:
- Open Task Scheduler.
- Select Create Task.
- Name the task
FastAPI Startup. - Under Triggers, select At log on for your Windows account.
- Under Actions, select Start a program.
- Set Program/script to
C:\Projects\my-fastapi-app\.venv\Scripts\python.exe. - Set Add arguments to
-m uvicorn main:app --host 127.0.0.1 --port 8000. - Set Start in to
C:\Projects\my-fastapi-app. - Save the task and test it using Run in Task Scheduler.
You should now be able to visit:
http://127.0.0.1:8000/docs
If your application exposes FastAPI's default documentation endpoint, it should be available while Uvicorn is running.
Common problems
The task runs but FastAPI doesn't respond
Check the Python executable path, project working directory, application import path, and whether the expected port is available.
It works in a terminal but fails in Task Scheduler
Your application may rely on environment variables, relative file paths, or an activated virtual environment. Using the virtual environment's Python executable directly and setting the working directory can eliminate some of these problems.
Multiple copies of Uvicorn are running
Check whether you've launched the application manually in addition to the scheduled task. Review the task's settings for handling an instance that is already running.
You need the application running before sign-in
A logon-triggered task is not the right solution for that requirement. Consider a service-based deployment instead.
Option 2: Use a packaged automation kit
The manual Task Scheduler approach is free and may be all you need.
For developers who would rather avoid assembling and managing the startup configuration themselves, Blacktop Logic's FastAPI Auto-Start Kit for Windows is a $19 toolkit designed to launch an existing FastAPI application when you sign in.
The product advertises Windows Task Scheduler integration, process management, duplicate-instance prevention, graceful shutdown, and a simplified setup process.
It's intended for Windows 10 and 11 sign-in workflows—not as a replacement for an unattended production Windows service.
Learn more: FastAPI Auto-Start Kit for Windows
Final thoughts
You don't need to install extra software just to start FastAPI when you sign in to Windows. Task Scheduler can handle the basic job.
The decision is whether you'd prefer to configure and maintain the workflow yourself or use a packaged toolkit that handles more of the setup and process management.
Top comments (0)