Giter Site home page Giter Site logo

douglaschalegre / fastapi-template Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 0.0 113 KB

๐Ÿ”จ This is a template that serves as a kickstarter for a back-end API application. Implemented with FastAPI, Pydantic, SQLAlchemy with a layered architecture structure.

Python 100.00%
backend backend-api fast-api fastapi postgresql pydantic pydantic-v2 python sqlalchemy

fastapi-template's Introduction

About ๐Ÿง‘๐Ÿปโ€๐Ÿ’ป

This repository contains a simple API that serves as a kickstart for new projects using FastAPI, SQLAlchemy and PostgreSQL. It's built with a simple layered architecture, containing domain, service, repository and controller layers. With this layered architecture approach, it's possible to separate concerns and make the codebase more maintainable and scalable.

It's also possible to add more layers if responsibilities grow within a specific layer. That being said, it's important to keep in mind that layers should be as independent as possible, and the dependencies should always point inwards, otherwise, could lead to ciclic dependencies mainly because of Pydantic schemas.

How to run ๐Ÿƒ๐Ÿปโ€โ™‚๏ธโ€โžก๏ธ

Install Python

Install Python (version 3.10).

Set and activate virtual environment โš™

In project folder, execute the following commands:

pip install pipenv
export PIPENV_VENV_IN_PROJECT="enabled"
mkdir .venv
pipenv shell
source .venv/Scripts/activate

Set environment variables โš™

Create a .env file with the required environment variables see [.env.example]

Install required dependencies

Run the following installation command:

pipenv install --dev

Run server ๐Ÿš€

On virtual environment, execute

pipenv run start

Documentation ๐Ÿ“š

While running the server, one can access the API documentation.

fastapi-template's People

Contributors

douglaschalegre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.