customers-api-proto-lite-crystal-kemal
Customers API Lite microservice prototype 🔹 
A daemon written in Crystal, designed and intended to be run as a microservice,
implementing a special Customers API prototype with a smart yet simplified data scheme
Rationale: This project is a direct Crystal port of the earlier developed Customers API Lite microservice prototype, written in V using veb web server library/framework, and tailored to be run as a microservice in a Docker container. The following description of the underlying architecture and logics has been taken from here almost as is, without any principal modifications or adjustment.
This repo is dedicated to develop a microservice that implements a prototype of REST API service for ordinary Customers operations like adding/retrieving a Customer to/from the database, also doing the same ops with Contacts (phone or email) which belong to a Customer account.
The data scheme chosen is very simplified and consisted of only three SQL database tables, but that's quite sufficient because the service operates on only two entities: a Customer and a Contact (phone or email). And a set of these operations is limited to the following ones:
- Create a new customer (put customer data to the database).
- Create a new contact for a given customer (put a contact regarding a given customer to the database).
- Retrieve from the database and list all customer profiles.
- Retrieve profile details for a given customer from the database.
- Retrieve from the database and list all contacts associated with a given customer.
- Retrieve from the database and list all contacts of a given type associated with a given customer.
As it is clearly seen, there are no mutating, usually expected operations like update or delete an entity and that's made intentionally.
The microservice incorporates the SQLite database as its persistent store. It is located in the data/db/
directory as an XZ-compressed database file with minimal initial data — actually having two Customers and by six Contacts for each Customer. The database file is automatically decompressed during build process of the microservice and ready to use as is even when containerized with Docker.
Generally speaking, this project might be explored as a PoC (proof of concept) on how to amalgamate Crystal REST API service backed by SQLite database, running standalone as a conventional daemon in host or VM environment, or in a containerized form as usually widely adopted nowadays.
Surely, one may consider this project to be suitable for a wide variety of applied areas and may use this prototype as: (1) a template for building similar microservices, (2) for evolving it to make something more universal, or (3) to simply explore it and take out some snippets and techniques from it for educational purposes, etc.
📀
customers-api-proto-lite-crystal-kemal
- 0
- 0
- 0
- 0
- 1
- 16 days ago
- May 29, 2025
MIT License
Fri, 20 Jun 2025 17:05:59 GMT