Table of Contents
To Do is a basic app for tracking tasks.
- Tasks have name, description and status.
- Status can be pending, completed or cancelled.
- CRUD operations use asynchronous client for MongoDB
- Unit tests cover valid and invalid inputs.
Back-end is built with FastAPI using Test Driven Development.
- Pytest is chosen for its mature resources and extensive ecosystem of plugins.
- MongoDB is database.
- Motor is asynchronous driver with Pymongo as Object Document Mapper.
- Dependencies are used to isolate logic from routes.
Use pipenv
package for a deterministic build instead of pip
and requirements.txt
,
which can be installed with
pip install pipenv
For MongoDB, either a free remote database can be set up using this link or a local instance can be run following these instructions.
- Clone the repo
git clone https://github.com/natuspati/to-do.git
- Edit
example.env
with MongoDB URL from pre-requisites and create a copy.env
cd to-do/backend cp example.env .env
- Install packages using
pipenv
or frompipenv install
requirements.txt
pip install -r requirements.txt
- Run
uvicorn
commanduvicorn app.api.server:app --reload --host 127.0.0.1 --port 8000
- Visit http://127.0.0.1:8000/
TDD principle dictates
Write test that fails and add just enough code to make the test pass.
The project uses this principle and extensibility of backend/tests/
shows that.
To run the tests, use the command:
pytest -v backend/tests
- Configure asynchronous MongoDB driver that is able to connect/disconnect with the app events
- Configure Pytest with asynchronous test client
- Add Task CRUD endpoints
- Isolate ODM operations to
repositories
- Add user authentication and resouce management
- Create Behavior Driven Tests from client and cleaner points of view
Distributed under the MIT License. See LICENSE.txt
for more information.
Nurlat Bekdullayev - @natuspati - [email protected]
Project Link: https://github.com/natuspati/to-do
Thanks to these resources that helped me to build the game.