Skip to content

THIS is starting as a clone of FastAPIDockerServiceTEMPLATE to become the OpsPlanSearchCreate Repo for starting development.

License

Notifications You must be signed in to change notification settings

michael-s-downs/OpsPlansSearchCreate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPIDockerServiceAzureTEMPLATE

A starting template for a Python API Server or Microservice using:

  • FastAPI to create & document the API endpoints
  • Uvicorn to serve the APIs
  • Custom Python modules for business logic
  • Dedicated folders for integrations (DBs, LLMs, etc.), models, services, and utils
  • Docker, .env, and requirements.txt for easy local and Azure deployment

Please clone this template and modify it — then push to a different remote that is project-specific.


Project Structure

├── app
│   ├── main.py                # Instantiate FastAPI, include routers, (optionally) CORS & startup tasks
│   ├── routes.py              # API endpoints (routers) — with OPS Plans example stubs
│   └── __init__.py
├── config
│   ├── config.py              # Optional runtime config loader (env + convenience accessors)
│   └── __init__.py
├── extensions                 # Example for framework extensions (placeholders)
│   ├── extension_example1.py
│   ├── extension_example2.py
│   ├── extension_example3.py
│   └── __init__.py
├── integrations               # Outbound calls (DBs, LLMs, services). Stubs only.
│   ├── integration_example1.py
│   └── __init__.py
├── models                     # Pydantic models (request/response/domain). Stubs + examples.
│   ├── model_example1.py
│   ├── model_example2.py
│   ├── model_example3.py
│   ├── model_example4.py
│   └── __init__.py
├── services                   # Business logic grouped by feature area
│   ├── service_grouping_example1.py
│   ├── service_grouping_example2.py
│   └── __init__.py
├── tests                      # Unit tests (pytest). Placeholder.
│   ├── test_sample.py
│   └── __init__.py
├── utils                      # Shared helpers (e.g., logging, schedulers). Includes fake re-indexer.
│   ├── utility.py
│   ├── fake_reindexer.py
│   └── __init__.py
├── .env
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
└── requirements.txt

Quickstart (Local)

  1. Python 3.11 recommended. Create & activate a virtual env:

    python -m venv .venv
    . .venv/bin/activate   # Windows: .venv\Scripts\activate
  2. Install deps:

    pip install -r requirements.txt
  3. Run dev server:

    uvicorn app.main:app --reload
  4. Open Swagger UI: http://127.0.0.1:8000/docs


Docker

Build and run with Docker:

docker build -t fastapi-template .
docker run --rm -p 8000:8000 --env-file .env fastapi-template

Notes

  • app/routes.py includes example endpoints for the "OPS Plans Search and Create" concept, returning fake JSON.
  • utils/fake_reindexer.py includes a fake timer-driven re-indexing job you can wire up on startup if desired.
    • It is disabled by default; see the commented lines in app/main.py to enable.
  • Replace example modules with your actual business logic, integrations, and data models.

About

THIS is starting as a clone of FastAPIDockerServiceTEMPLATE to become the OpsPlanSearchCreate Repo for starting development.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published