Solution for the challenge at backend called point of interest. The requirements for the challenge can be found here
- Javascript/Typescript: Main programming language.
- BunJs: Platform to run Javascript
- SQlite: Relational database to store persistent data.
- Fastify: Web framework for building APIs in NodeJS.
- DrizzleORM: ORM (Object-Relational Mapping) for communication with the database.
The application follows the following design patterns:
-
Clean Architecture: The project structure is organized in layers (entities, use cases, interfaces) to separate concerns and facilitate maintenance.
-
Domain Driven Design (DDD): The software design is domain-oriented, focusing on business rules and main entities.
-
Dependency Injection: Inversion of control and dependency injection are used to ensure code flexibility and testability.
-
Automated Testing: Unit, integration and end-2-end tests are written to ensure code quality.
- Search registered points of interest
- Registration of points of interest
- Search for points of interest using filters such as coordinates and distance
To run this application, you need to have BunJs installed on your machine.
- Run the command
touch .env && cp .env.example .env
to create environment variable files. - Run the command
bun i
to download the dependencies. You can use the package manager you prefer - Run the command
bun db:migrate
to apply the migrations to the database. - Run the command
bun db:seed
to populate the database with some initial data - Run the command
bun dev
to start the application. - Open the
client.http
file at the root of the project to call the http route that performs the operation. It is important to have the Rest Client extension installed in VsCode
- Run the command
bun test
to run the unit tests
- How to Calculate Distances Between Points Using Mathematics
- Build adapters for http layer decoupling with Fastify and controllers
- Use another database to store the data like a Postgres
- Add pipes for request data validation
- Add dependency injection system to auto create the objects and inject them in the controllers
This project is under the MIT license. Access the link LICENSE for more details.
The source code of the application can be found on GitHub: Project Link
In case of doubts or suggestions, contact us through the email: nito.ba.dev@gmail.com.