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
Installation
Method 1: Run Application Locally
- Clone the repository:
git clone https://github.com/KenMwaura1/Fast-Api-example - Change into the Fast-Api folder:
cd Fast-Api-example - Create a virtual environment:
python3 -m venv venv - 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
- For zsh users:
- Change into the src folder:
cd src - Install the required packages:
python -m pip install -r requirements.txt - 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.
- Check the app on notes by opening your browser and navigating to the swagger documentation for the API.
Optional: Vue Frontend
- Ensure you have Node.js installed (version 16 or above).
- Change into the vue-client folder:
cd vue-client - Install the required dependencies:
- For NPM:
npm install - For Yarn:
yarn
- For NPM:
- Start the Vue app:
- For NPM:
npm run dev - For Yarn:
yarn dev
- For NPM:
- Open your browser and navigate to notes.
Method 2: Run Locally using Docker
- Ensure Docker is installed.
- Ensure Docker Compose is installed.
- Clone the repository:
git clone https://github.com/KenMwaura1/Fast-Api-example - Change into the Fast-Api-example directory:
cd Fast-Api-example - Use Docker Compose to spin up containers:
docker-compose up -d --build - 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.