Fast Api Vue

screenshot of Fast Api Vue
vite
vue
daisyui

Simple asynchronous API implemented with Fast-Api framework utilizing Postgres as a Database and SqlAlchemy as ORM . GiHub Actions as CI/CD Pipeline. Vue + Daisy UI for the frontend

Overview

The FastAPI Vue Starter App is a code repository that contains code for an asynchronous example API using the FastAPI framework, Uvicorn server, and Postgres database. The API allows for CRUD operations on notes. Additionally, there is a simple Vue frontend included.

Features

  • Asynchronous example API using FastAPI framework
  • Uvicorn server for running the application locally
  • Postgres database for storing data
  • Swagger documentation for API
  • Optional Vue frontend using vite

Method 1: Run Application Locally

  1. Clone the repository: git clone https://github.com/KenMwaura1/Fast-Api-example
  2. Change into the Fast-Api folder: cd Fast-Api-example
  3. Create a virtual environment: python3 -m venv venv
  4. Activate the virtual environment:
    • For zsh users: source venv/bin/activate.zsh
    • For bash users: source venv/bin/activate.bash
    • For fish users: source venv/bin/activate.fish
  5. Change into the src folder: cd src
  6. Install the required packages: python -m pip install -r requirements.txt
  7. Start the app:
    • If you have a local Postgres database running, add a fast_api_dev database with the required privileges. OR
    • Change the DATABASE_URL variable in the .env file inside the app folder to reflect your database settings.
  8. Check the app on notes by opening your browser and navigating to the swagger documentation for the API.

Optional: Vue Frontend

  1. Ensure you have Node.js installed (version 16 or above).
  2. Change into the vue-client folder: cd vue-client
  3. Install the required dependencies:
    • For NPM: npm install
    • For Yarn: yarn
  4. Start the Vue app:
    • For NPM: npm run dev
    • For Yarn: yarn dev
  5. Open your browser and navigate to notes.

Method 2: Run Locally using Docker

  1. Ensure Docker is installed.
  2. Ensure Docker Compose is installed.
  3. Clone the repository: git clone https://github.com/KenMwaura1/Fast-Api-example
  4. Change into the Fast-Api-example directory: cd Fast-Api-example
  5. Use Docker Compose to spin up containers: docker-compose up -d --build
  6. If everything completes successfully, the app should be available on notes.

Summary

The FastAPI Vue Starter App is a code repository that provides an example API built with the FastAPI framework, Uvicorn server, and Postgres database. It allows for CRUD operations on notes and includes optional Vue frontend functionality. The installation guide provides two methods for running the application locally, either by setting up the environment manually or using Docker Compose. Overall, it is a useful tool for developers looking to start building asynchronous API projects with FastAPI and Vue.

vite
Vite

Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects

vue
Vue

Vue.js is a lightweight and flexible JavaScript framework that allows developers to easily build dynamic and reactive user interfaces. Its intuitive syntax, modular architecture, and focus on performance make it a popular choice for modern web development.

daisyui
daisyUI

daisyUI adds classes to Tailwind CSS for all common UI components. Classes like btn, card, etc. This allows us to focus on important things instead of making basic elements for every project.