Package: minumtium
MinumtiumA minimal blogging library.What can I use it for?The purpose ofminumtiumis to be embedded inside simple projects like landing pages or personal portfolio pages where
it is not needed to have a lot of features. The objective is to:Provide a simple way to add and list posts inside a pageProvide a summary of the most recent postsProvide (very) basic user managementIt is not meant to provide a full-fledged blogging platform. Features like comments, profiles, view counters,
social-network integrations and even configuration files areout of scope.Why minimal?The idea behindminumtiumis that it should do the bare minimum: provide you the code to create posts, as well as
provide a way to control who can post. That's it:There are no user profiles, it accepts whatever value you pass as an authorThere is no UI, you have to create your own or use a library that provides itThere are no endpoints, but there are implementations for fastapiIt is just a library that creates and lists blog posts, you can add other features by using external libraries, like
building lego (a very minimal lego, though).Why embedable?Minumtiumhas been created so that it can be a library inside a bigger project. By default, it won't even provide you
a UI or even REST API endpoints. The user should encapsulateminumtiuminside its own code and integrate it inside its
project. It is expected that you implement your own authentication adapters to allow it to integrate to your auth system
and so on.Why extensible?Being so bare minimal would mean thatminumtiumis almost useless, as it is quite simple to implement its core
functionality.Minumtiumhas been built from ground up to be extensible with custom adapters and extension libraries.
Those can:Provide you alternative authentication methodsProvide integration with different databasesProvide you API endpoints using libraries like Flask or FastAPIProvide you Front-End endpoints using Jinja or Mako renderingUsageInstall it using pip, or you favoritevenvmanager:# Using pip
pip install minumtium# Using pipenv
pipenv install minumtium# Using poetry
poetry install minumtiumAlways interact with the service by providing its dependencies:frommodules.postsimportPostRepository,PostServicefromminumtium.infra.implementations.sqlalchemy_databaseimportSqlAlchemyAdapterdb_adapter=SqlAlchemyAdapter({'engine':'sqlite_memory'},'posts')post_repository=PostRepository(db_adapter)post_service=PostService(post_repository)summary=post_service.get_latest_posts_summary(count=10)Extensions and AdaptersYou may not want to write a bunch of code, and for that reason you will very likely want to use plugins. Here are some
of the standard plugins:FastAPI REST API- REST Endpoints using FaskAPI. Includes authenticated endpoints.Simple JWT Authentication Adapter- Allows to authenticateminumtiumusing simple JWT tokensSqlAlchemy Database Adapter- Stores data using relational databases andSqlAlchemyYou can refer to their repositories for more information on how to use them.Integrating with other thingsThere are two things you will want to integrate:Thepostsservice atminumtium.modules.posts.PostServiceTheidmservice atminumtium.modules.idm.IdmServiceIntegrating those services mean you will need to inject a few dependencies into them:Thepostsservice depends on thePostRepository.ThePostRepositorydepends on aDatabaseAdapterimplementation.Having a dependency injection system definitely helps out. You can take a look at theFastAPI Plugincode that is
very simple and shows how this integration can be done.Creating your own adaptersAdding support for other kinds of databases or authentication methods will consist on implementing the adapter
interfaces:minumtium.infra.database.adapter.DatabaseAdapterminumtium.infra.authentication.adapter.AuthenticationAdapterThose custom adapters are provided as dependencies when creating the services and the repositories.Creating your own applicationApplications are theactualimplementation of something usable. An example is theFast API REST APIapplication.
Applications are supposed to provide you a way toactuallyuseminumtiumwithout having to reinvent the wheel.Applications are provided as extension libraries, that will encapsulate minumtium something like FastAPI, for example.
It is up to the user to register the minumtium client inside your main client so that you have all of its routes
available.You can create your own application and distribute it as a library. Those extension libraries are supposed to wrap
minumtium into something else.RationaleI have created this while working on mypersonal portfolio page. It was supposed to bemuch more
minimal, like a single python file. As I started developing it I have decided to use it to practice both TDD and
layered architectures. It is mostly a crud, so it was a good exercise and it is easy to read the source code.Maybe it will not be so minimal as I wanted, but I learned some nice stuff along the way 😁.