/PlantSwap

WebApp to swap plants with other people โ˜๏ธ๐Ÿชด

Primary LanguagePythonMIT LicenseMIT

PlantSwap

Logo created using Dall-E

tests coverage

PlantSwap is an application which enables you to trade your plant offsets for other plants of your liking.

You can either find a person which wants to trade their plant for your plant directly or sell your plants on the platform to receive coins which you can then use the buy plants from other people.

This repository documents the progress in the cloud computing course I took part in at the Universidad de Granada for my masters.

The above logo was generated using Dall-E.

This project is used the fullstack fastapi template as its starting point.

Starting up the application

Prerequisites

The project needs a Postgresql database to be running to be able to use all functionalities. Using a .env file one can pass the application the necessary details of the database. The specific parameters to be set are found in config.py.

The .env file in the project directory contains some default values for the database connection. Using these one can also use the dockerfile contained in the project directory to start a postgresql container. This can be done using the poethepoet script db by typing:

Attention: The following command deletes and removes all running docker containers and starts a new postgresql container

poe db

Using uv

To start up the application, one will have to install the dependencies first. uv is recommended to be installed. An installation guide can be found here. If pipx is already installed on the machine, it is as easy as

pipx install uv

After having installed uv, to create a venv and install the necessary dependencies, run:

uv python install
uv sync --all-extras --dev

The above will install all dependencies and the project could be started using

uv run fastapi dev

However, the project uses poethepoet as a task runner. To install poethepoet, run with pipx installed

pipx install poethepoet

Now the application can be started in development mode running

poe dev

and in production mode using

poe deploy

By default, the api will be served at http://0.0.0.0:8000 .

General development progress of the app

The following list keeps track of the development progress of the app and its backend/API.

Tech stack

  • โšก FastAPI for the Python backend API.
    • ๐Ÿงฐ SQLModel for the Python SQL database interactions (ORM).
    • ๐Ÿ” Pydantic, used by FastAPI, for the data validation and settings management.
    • ๐Ÿ’พ PostgreSQL as the SQL database.
    • ๐Ÿฆ„ Uvicorn used by FastAPI as ASGI webserver.
  • ๐Ÿ”’ Secure password hashing by default.
  • ๐Ÿ”‘ JWT (JSON Web Token) authentication.
  • ๐Ÿงช Tests with Pytest.
  • ๐Ÿช„ Poethepoet as task runner.
  • ๐Ÿ“ฆ Package management with uv.
  • โš™๏ธ CI (continuous integration) and CD (continuous deployment) based on GitHub Actions.

Basic functionality includes things such as:

  • Administrators have a (secure) way of logging in
  • Users have a (secure) way of logging in
  • Users can create accounts
  • Administrators can create accounts
  • Administrators can delete ads of users
  • Administrators can delete accounts of users

Advanced functionality includes things such as:

  • Users can send other users trade requests for their plants
  • Users can accept trade requests
  • Users can deny trade requests
  • Users can answer trade requests with a text message
  • Basic frontend

Milestones

The following are references to the tasks of the respective milestones as discussed in the Repository of the cloud computing class.

Milestone 4

  • ...