After over six months without writing, I'm back and starting a new series about my latest open-source side project.
In this series, I'll be showing how I'm building this project. The goal is to tackle each issue one by one in dedicated articles, documenting the development process and the challenges I face.
The project is already open source, so why not share the thoughts behind it as well?
But first things first: in this article, let me introduce PocketBase.Net, the project's goals, its current status, and what the next steps are.
Presenting PocketBase.Net
In one sentence, PocketBase.Net is a library that aims to make PocketBase easy to work with in dotnet projects.
What is PocketBase
PocketBase is a lightweight backend as a service (BaaS) that uses SQLite under the hood.
Unlike other popular BaaS such as Firebase, Supabase, and others, you can spin up a new instance of PocketBase simply by running a single executable.
This makes it incredibly easy to get started locally, dockerize, or even host it.
Out of the box, PocketBase allows you to manage your data in collections, handle authentication, rights, and protect some operations with rules. You can also get notified of real-time updates and much more.
If you have not already, I highly encourage you to check out the project on https://pocketbase.io, or watch this nice 3:30 Fireship video about it:
Working with PocketBase
Once spun up, you can interact with your PocketBase instance using the JS SDK, the Go SDK, or through its web API.
For instance, here is how you could retrieve products from your instance:
GET https://[Your Instance]/api/collections/products/records
You can also access the web view to see your data, update the collection rules, integrate new login method such as OAuth third parties such as GitHub, see logs and much more.
Introducing PocketBase.Net
Given that the web API has a pretty exhaustive documentation and that no official .NET SDK is available, PocketBase.Net is my attempt to provide one for .NET developers who would like to use PocketBase as their database.
The goal is to make working with PocketBase simple from a .NET project, using idiomatic C#.
Using this library, any developer should be able to perform basic CRUD operations and leverage PocketBase capabilities.
Current State
As of the time of writing, I have just open-sourced the project with its bare minimum features.
So far you can already:
- Authenticate your client to perform actions as a specific account
- Create, Read, Update and Delete records
- Query data with more complex requirements such as filters or pagination
- Use dynamically created repositories for each of your entities
Here is quick glance at some of the operations you can do with PocketBase.Net:
var article = new
{
IsPublic = true,
Name = "Getting Started With PocketBase.Net",
};
var articleRecord = await articleRepository.CreateRecordFrom(article);
var draftArticleRecord = await articleRepository.UpdateRecord(
articleRecord.Id,
article with { IsPublic = false });
var draftsArticleRecords = await articleRepository
.Query()
.WithFilter("isDraft=true")
.ExecuteAsync();
The project also features:
- A unit tests suite (that could use some more tests if you feel like helping!)
- An integration tests suite, using a dockerized PocketBase instance with TestContainers to ensure real world scenario are covered
- A CI step running on GitHub Actions
- A comprehensive XMLdoc and a detailed README about the library's usage
What's next
The library is far from finished an lacks some of the core features you would expect.
First of all, there is no NuGet package published yet. Some operations are also not supported at this time, such as sorting or relationships.
For each of those tasks, and the others to come, I will create an issue on GitHub.
Once started, I will document in a new article the development process for that task, from its scope, to the final implementation and documentation.
Building with You
If you would like to join this small open source journey, you are more than welcome to do so, and there are several ways for you to get involved!
You can, of course, write some code, document or test the project (be sure to have a look at the contribution guidelines before checking the opened issues), but you can also write suggestions on the GitHub discussions or in comments.
Depending on what happens during the lifetime of the library, I might also write about how review pull requests and incoming contributions.
That's all for today's post!
I hope you are as excited about this modest adventure as I am, and I can't wait to see where it will go.
Stay tuned for the next upcoming feature and article!
This post was proofread by Le Chat, that also generated the image
Top comments (0)