The Internxt's Storage API.
We aim to have:
- An 'A' score on Maintainability Rating
- An 'A' score on Security Rating
- A 3% of duplicated lines
sudo apt install build-essential
The dependencies could be installed using:
yarn --ignore-engines
- Create a
.npmrc
file from the.npmrc.template
example provided in the repo. - Replace
TOKEN
with your own Github Personal Access Token withread:packages
permission ONLY - Use
yarn
to install project dependencies.
When this project is run for the first time, the default configuration can be found at ~/.inxt-bridge/config/develop.json
.
Note: Using a .env (see .env.template) file instead of the JSON config is preferred, but both methods are currently accepted. The .env will override any value created by the JSON config.
Run yarn run dev
to start the server with hot-reloading.
With docker-compose:
docker-compose up
You can run tests with:
yarn run test
This project currently divides the server into 3 layers:
- Use cases (
lib/core/${domain}/usecase.ts
or if not still migrated:lib/server/routes/${domain}.js
) - Persistence (
lib/core/${domain}/repository.ts
or if not still migrated:lib/server/routes/${domain}.js
) - Controllers (
lib/server/http/${domain}/controller.ts
or if not still migrated:lib/server/routes/${domain}.js
)
The project has these main folders
/lib
/core
: where a new structure with 2 of the 3 layers is being used (use case, persistence)/server
:/routes
: where old structure with one layer (controller+usecase+persistence) is being used./http/${domain}
: where controller layer for the HTTP protocol resides.
The project is a WIP in the sense that is being rethought in layers and the actual 3 layers are a matter of convenience that provides better maintainability that the old solution of using one layer with everything mixed.
As the word 'domain' is being used, we have agreed to use any entity as a domain (which is not correct) as a temporal convention, therefore, any explanation about how to define this layers is provided here. Each entity has maybe a controller, use case, and repo, that is the unique guideline for now.
We do not provide API documentation currently. We plan to do it in the future.
This project is based on GNU License. You can show it in the License file.