A FastAPI-based Bank API project.
- Python >= 3.10
- Package manager: uv
- Clone the repository:
git clone [email protected]:shanegrouber/meow_bank_api.git
cd meow_bank_api
- Create and activate a virtual environment:
uv venv
source venv/bin/activate
- Install the project with development dependencies:
uv pip install -e ".[dev]"
This will install both production and development dependencies. The development dependencies include:
- black (code formatting)
- isort (import sorting)
- pre-commit (git hooks)
- ruff (linting)
The application uses a central configuration system based on Pydantic settings. Configuration can be set through:
- Environment variables
.env
file in the project root- Default values in the code
Key configuration options:
ENVIRONMENT
: Set to "development" or "production" (defaults to "development")DATABASE_URL
: Database connection string (defaults to SQLite)MEOW_BANK_API_KEY
: Key to be used for API calls (defaults to "test_api_key")
After installation, set up pre-commit hooks to automatically format and lint your code:
pre-commit install
The project uses SQLite as the database. Starting the server will initialise and create the following tables:
customers
- Stores customer informationaccounts
- Stores bank account informationtransfers
- Records money transfers between accounts
Log files are stored in the logs
directory with the format meow_bank_YYYYMMDD.log
.
Start the FastAPI development server:
uvicorn meow_bank.main:app --reload --port 8000
The API will be available at:
- Local development:
http://localhost:8000
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
- OpenAPI spec:
http://localhost:8000/openapi.json
Include your API key in the X-API-Key
header with every request:
The project uses pytest for testing.
To run all tests:
pytest