Skip to main content

Create FastAPI Project

We love ❤️ FastAPI and its ecosystem so we decided to make easier to get started with FastAPI projects. By using the create-fastapi-project CLI tool, you can quickly start building a new FastAPI application with a basic folder structure, with everything set up for you.

To get started, use the following command:

pip install create-fastapi-project
create-fastapi-project

After you that you are going to see an interactive screen like this:

create-app-terminal

Templates

Basic

See More

We're excited to introduce you to our FastAPI Basic Project Template, carefully designed to jumpstart your FastAPI development journey. This template offers you a pre-configured project with a fundamental FastAPI setup and an organized folder structure, allowing you to hit the ground running.

Folder Structure

└───app
  ├───app
  │   ├───api
  │   │   └───v1
  │   │       └───endpoints
  │   ├───core
  │   ├───schemas
  │   └───utils
  │       └───exceptions
  └───test

Langchain Basic

See More

We're thrilled to introduce you to the LangChain project template, designed to accelerate your development process. This template serves as a solid foundation for your project, complete with essential features and an organized folder structure, all thoughtfully configured and ready for use.

Folder Structure

app
    ├───app
    │   ├───api
    │   │   └───v1
    │   │       └───endpoints
    │   ├───core
    │   ├───schemas
    │   ├───templates
    │   │   └───general_pages
    │   └───utils
    │       ├───adaptive_cards
    │       └───exceptions
    └───test

Containers Architecture

langchain-architecture As this project uses Caddy as a reverse proxy, which uses namespaces routing, you can access the documentation with the following path http://fastapi.localhost/docs

ENV Variables

PROJECT_NAME=
OPENAI_API_KEY=
UNSPLASH_API_KEY= # Optional
SERP_API_KEY= # Optional

#############################################
# Caddy variables
#############################################
EXT_ENDPOINT1=127.0.0.1
LOCAL_1=localhost
LOCAL_2=127.0.0.1

Tools

  • Search weather tool weather-tool
  • Search images tool images-tool
  • Search videos tool videos-tool
  • Search pokemon tool pokemon-tool

Full

See More

This is a project template which uses FastAPI, Alembic and async SQLModel as ORM. It shows a complete async CRUD template using authentication. Our implementation utilizes the newest version of FastAPI and incorporates typing hints that are fully compatible with Python 3.10 and later versions. If you're looking to build modern and efficient web applications with Python, this template will provide you with the necessary tools to get started quickly. You can read a short article with the motivations for starting this sample project here.

Why Use This Template?

Developing web applications can be a challenging process, especially when dealing with databases, authentication, asynchronous tasks, and other complex components. Our template is designed to simplify this process and offer you a solid starting point. Some of the highlights of this template include:

  • FastAPI Integration: FastAPI is a modern and efficient web framework that allows you to quickly and easily create APIs. This template uses the latest features of FastAPI and offers type hints that are compatible with Python 3.10 and later versions.
  • Asynchronous Database Management: We use SQLModel, an asynchronous ORM library, to interact with the database efficiently and securely.
  • Asynchronous Tasks with Celery: This template includes examples of how to execute asynchronous and scheduled tasks using Celery, which is ideal for operations that require significant time or resources.
  • Authentication and Authorization: We implement JWT-based authentication and role-based access control to ensure that your APIs are secure and protected.
  • Documentation and Automated Testing: The template is configured to automatically generate interactive documentation for your APIs. It also includes automated tests using pytest to ensure code quality.
  • Development Best Practices: We apply code formatting, type checking, and static analysis tools to ensure that the code is readable, robust, and reliable.

Folder Structure

.
├───.github
│   └───workflows
├───.vscode
├───backend
│   └───app
│       ├───alembic
│       │   └───versions
│       ├───app
│       │   ├───api
│       │   │   └───v1
│       │   │       └───endpoints
│       │   ├───core
│       │   ├───crud
│       │   ├───db
│       │   ├───deps
│       │   ├───models
│       │   ├───schemas
│       │   └───utils
│       │       └───exceptions
│       └───test
│           └───api
├───caddy
├───db_docker
├───docs
├───minio
├───pgadmin
├───sonarqube
├───static
└───terraform

Stack

  • FastAPI - A modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
  • Pydantic - A library for data validation and settings management based on Python type hints.
  • SQLModel - A library for interacting with SQL databases from Python code, with Python objects.
  • Alembic - A lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.
  • Caddy - A powerful, enterprise-ready, open source web server with automatic HTTPS written in Go.
  • Docker - A set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.
  • PostgreSQL - A powerful, open source object-relational database system.
  • PGAdmin - The most popular and feature rich Open Source administration and development platform for PostgreSQL.
  • Celery - A simple, flexible, and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system.
  • Redis - An open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.
  • Minio - A high performance distributed object storage server, designed for large-scale private cloud infrastructure.
  • SonarQube - An open source platform for continuous inspection of code quality.
  • Pytest - A framework that makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries.

Getting Started

The commands in this documentation can be customized on the Makefile. It can be started with and without docker.

After your project is created. First, make sure you have all packages installed:

make install

Run the server:

# Run locally without docker
make run-app
# or
# Run locally with docker in dev mode and force build
make run-dev-build
# or
# Run locally with docker in dev mode
make run-dev-build
# or
# Run locally with docker in prod mode
make run-prod

Learn More

To learn more about Fastapi, take a look at the following resources:

Why use Create FastAPI Project?

create-fastapi-project provides a streamlined way to kickstart your FastAPI projects. Here are some compelling reasons to choose it for your project setup:

Interactive Experience

Running create-fastapi-project (with no arguments) launches an interactive experience that guides you through the process of setting up your project. This interactive approach simplifies the initial configuration and gets you started quickly.

Zero Dependencies

create-fastapi-project has been designed to be lightweight and efficient. It requires zero external dependencies, ensuring that your project remains unburdened by unnecessary packages.

Reliability and Maintenance

create-fastapi-project is maintained by the Allient development team. Our team is composed by a experienced professionals specializing in FastAPI projects and NLP. If you need assistance or support for your project, please don't hesitate to get in touch with us at info@allient.io or schedule a meeting with us here.

You can check out the create-fastapi-project GitHub repository - your feedback and contributions are welcome ❤️!

License

License

  • This project is licensed under the terms of the MIT license

Metadata

Release files for create-fastapi-project 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for create-fastapi-project 0.2.6
File Size Uploaded Provenance
create_fastapi_project-0.2.6.tar.gz 89.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for create-fastapi-project 0.2.6
File Interpreter ABI Platform
create_fastapi_project-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 240.3 kB

Release files / create_fastapi_project-0.2.6.tar.gz

Download URL create_fastapi_project-0.2.6.tar.gz
Size 89.9 kB
Tags Source
SHA-256 checksum
How to use checksums
48fb397487b193f754bddddb5aa12ce6d08042f47152482fd527edd43a217abc
BLAKE2b-256 checksum
How to use checksums
4211d222e4a03059fd48ef3e0e7b9620379fc726bc27897fe7c04ac8966ff7c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

Release files / create_fastapi_project-0.2.6-py3-none-any.whl

Download URL create_fastapi_project-0.2.6-py3-none-any.whl
Size 150.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ecc9e07202631d0a9754e8be072ccb7ee976485f73a403df625f29b718c3c08
BLAKE2b-256 checksum
How to use checksums
26d0482ddcbbb2c6f2f97c6a6ce11da690b6b31245b764e1931c1fbab6bdd6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

Security for create-fastapi-project 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page