/todo-app

Primary LanguagePython

BASIC TODO APP

Backend Static Code Analysis Frontend Static Code Analysis

FastAPI Svelte Docker Grafana Prometheus Postgres

This is a Todo app. A basic one. But it has been used for learning ways of abstraction in python, such as Generics and Protocols. Also, I have tried to use best practices of format and such.

Usage

The best way to get the running is by using Docker. To do this, you must have Docker installed in your machine. Once you have it, you can run the following command:

docker compose -f docker-compose.development.yml up -d

This will get you:

To stop the app, you can run: docker compose -f docker-compose.development.yml down

Frontend development:

To start development of the frontend app, do the following:

cd src\frontend && npm install

For linting and formatting, do:

npm run prettier
npm run eslint

Backend development:

To start development of the frontend app, do the following:

cd src\backend && poetry install

For linting and formatting, do:

poetry run pyright .
poetry run ruff check .
poetry run black --check .

Tests require Docker to be running. To run them, just do:

poetry run pytest

On Python

Generics and Protocols.

These are two concepts that I have been using in my code. Though they help the type checker tell if something is wrong in code (static analysis), they really have no influence in runtime.

Dependency Injection

Dependency injection is used to decouple the different parts of the program. To use this, objects must not create new instances of classes in their constructors, but receive them as parameters.

Asyncio

Asyncio is used together with aiofiles to read and write files in an asyncronous way Also, SQLAlchemy uses an async backend asyncpg