Skip to content

WebApp to swap plants with other people ☁️πŸͺ΄

License

Notifications You must be signed in to change notification settings

RaoulLuque/PlantSwap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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 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 .

Using docker compose

Using docker compose and poethepoet, one can start a cluster of containers. One for the application, another one for the postgresql database, and a third one for backup of the database and logging. Starting the cluster is as easy as

poe compose

with poethepoet. Or

docker compose -f docker-compose.yml up

without poe.

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.

General development progress of the app

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

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 1

About

WebApp to swap plants with other people ☁️πŸͺ΄

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages