Skip to main content

Add your description here

Project description

fastAppear

fastAppear is a small FastAPI project that provides a starting template for building REST APIs with async SQLModel + SQLAlchemy, JWT-based authentication, and a clean project layout.

This repository includes:

  • FastAPI application with a simple lifespan handler and middleware
  • Async database helper utilities using SQLAlchemy async engine + SQLModel
  • Simple logger with colored console output
  • Sample auth endpoints (placeholders), a health endpoint, and a documented OpenAPI UI

Table of Contents

  • Features
  • Getting started
    • Prerequisites
    • Installation
    • Environment variables (.env)
  • Running the app
  • Testing
  • Project structure
  • Contributing
  • License

Features

  • FastAPI app with startup/shutdown lifecycle handling
  • Async DB setup (SQLAlchemy async + SQLModel)
  • JWT configuration via environment variables
  • CORS middleware and request timing middleware
  • Ready-to-extend router placeholders for auth

Getting started

Prerequisites

  • Python 3.11 or newer
  • (Optional) Poetry for dependency management or use pip with a virtualenv

Installation (recommended: Poetry)

uv sync

Environment variables (.env)

Copy the example .env file and fill values for your environment. Example variables used by the app:

  • DB_URI (required): Database connection string, e.g. postgresql://user:pass@localhost:5432/fastappear_db or sqlite+aiosqlite:///./dev.db
  • ROOT_PATH (optional): App root path — used if deploying behind a reverse proxy
  • LOGGING_LEVEL: DEBUG/INFO/WARNING/ERROR/CRITICAL
  • JWT_SECRET_KEY (required): A secure secret for JWT signing.
  • JWT_ALGORITHM: default HS512
  • JWT_ACCESS_TOKEN_EXPIRE_MINUTES: default 720
  • JWT_REFRESH_TOKEN_EXPIRE_DAYS: default 7

Tip: You can generate a secure secret via Python secrets.token_urlsafe(64):

python -c "import secrets; print(secrets.token_urlsafe(64))"

Running the app

There are two common ways to run the app locally.

gunicorn -k uvicorn.workers.UvicornWorker -c gunicorn_conf.py src.main:app

Open the following URLs:


Testing

Run the tests with pytest:

pytest -q

Note: The repository includes pytest and pytest-asyncio. If you plan to test DB integration, configure a test DB and pass DB_URI in your environment.


Project structure

Key files and folders:

  • src/main.py — FastAPI app entry point (lifespan, middleware, router configuration)
  • src/config.py — Pydantic-based settings and .env config
  • src/utils/db.py — Async DB engine, session factory, and init helpers
  • src/utils/logger.py — Configured logger with colored output
  • src/static_values/ — (optional) constant/value definitions used across the app
  • test/ — tests for the project

Contributing

Contributions are welcome. A few suggestions:

  • Open a GitHub issue if you'd like to propose a significant change
  • For small fixes or features, submit a PR against main
  • Implement features in small, reviewable changes and include tests

Developer tips:

  • The scripts/ directory contains helper scripts to scaffold modules and tests.
  • The dev_docs/commands.md file has commands and run/debug tips for development.

Notes & TODOs

  • The repository contains placeholders for auth routers and a placeholder create_default_admin_if_missing function. Replace these with your production logic and migrations as needed.
  • For any production deployment, avoid storing secrets in .env files and use a secrets manager instead (AWS Secrets Manager, Hashicorp Vault, etc.).

License

This project uses the repository's LICENSE file — follow the project's license for any reuse.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastappear-0.1.1.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastappear-0.1.1-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

Details for the file fastappear-0.1.1.tar.gz.

File metadata

  • Download URL: fastappear-0.1.1.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for fastappear-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d30fc8b59ed169b4e53b128223eeb17b02bf3eab814b80ca787b2b60aad83514
MD5 dc46ea2b8fea4d7162069caf1dd67fa0
BLAKE2b-256 502966c7bcd76a7c5a6b99902fcb5b2e5be6b425b68d4b27a1066d2a0872bbf7

See more details on using hashes here.

File details

Details for the file fastappear-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fastappear-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 42.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for fastappear-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9ca690c215f082e9e927b5af1e4a61cebd56e7164b203cfb9cb75db82c16db8
MD5 e037f491e4a92730bdcd333f420a4771
BLAKE2b-256 068f55f44eb699fe3ee1d6ff48719f6ef2dc0ec1a43e11f52d7f641790d3fce0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page