Registry is an HTTP API whose main purpose is to manage SlimIO Addons. The API let you create your own account and manage an organisation to publish and edit your personal and/or company addon(s).
This project has been inspired by npm Registry.
$ git clone https://github.com/SlimIO/Registry.git
$ cd Registry
$ npm ci
$ npm start
The server can be configured by setting up environment variables. This project is capable to load these variables from local .env file too.
$ touch .env
Add these environment variables and save them, you can change the values ββof these keys according to your needs
SECRET_KEY=your_secret_key
PORT=1337
DB_DIALECT=sqlite
DB_NAME=registry
DB_USER=root
DB_PASSWORD=ROOT
Supported DB dialect are: mysql
, sqlite
, postgres
, mssql
.
For all request with a body data, you need to set your headers with:
- Content-Type:
application/json
icon | description |
---|---|
π |
GET Β·/
Return service metadata.
Name | Value | Kind | Required? | Notes |
---|
{
uptime: 3403
}
POST Β·/login
Authenticate a user and get an AccessToken. The account must be activated before to success.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
username | String | Body | β | User name |
password | String | Body | β | User password |
Return an AccessToken which will be required for some endpoints.
{
access_token: string;
}
POST Β·/users
Create a new inactive user. The account will be deleted after 24 hours if no activation occur.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
username | String | Body | β | User name |
password | String | Body | β | User password |
Return an empty JSON on success with a code 201.
{}
POST Β·/users/activeAccount
Activate an account with the activation token received by email.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
token | String | Body | β | Activation token |
Return an empty JSON on success with code 200.
{}
GET Β·/addon
Get all available addons.
Name | Value | Kind | Required? | Notes |
---|
[
"cpu",
"memory"
]
GET Β·/addon/{addonName}
Get a given addon by his name.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
addonName | String | Path | β | Addon name |
Return a data structure described by the following interface:
{
name: string,
description: string,
git: string,
createdAt: Date,
updatedAt: Date,
author: {
username: string,
description: string
},
organisation: {
name: string,
createdAt: Date,
updatedAt: Date
},
versions: [
{
version: string,
createdAt: string
}
]
}
π POST Β·/addon/publish
Create or update an Addon release. This endpoint require an AccessToken.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
name | String | Body | β | Addon name |
description | String | Body | β | Addon description |
version | String | Body | β | Semver |
git | String | Body | β | GIT Url |
organisation | String | Body | β | Organisation (if any) |
Return the addon id.
{
addonId: 1
}
GET Β·/organisation
Get all organisations.
Name | Value | Kind | Required? | Notes |
---|
Return an JavaScript Object described by the following interface:
{
[name: string]: {
description: string,
owner: string,
users: string[]
addons: string[]
}
}
GET Β·/organisation/{name}
Get an organisation by his name.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
name | String | Path | β | Organisation name |
Return a data structure like:
{
name: string,
description: string,
createdAt: Date,
updatedAt: Date,
owner: {
username: string,
createdAt: Date,
updatedAt: Date
},
users: [
{
username: string,
createdAt: Date,
updatedAt: Date
}
]
addons: [
{
name: string,
description: string,
git: string,
createdAt: Date,
updatedAt: Date
}
]
}
π POST : /organisation/:orgaName/:userName
Add a user to an organisation. This endpoint require an AccessToken.
Name | Value | Kind | Required? | Notes |
---|---|---|---|---|
orgaName | String | Path | β | Organisation name |
userName | String | Path | β | User name |
β οΈ Only Organisation owner can use this endpoint.
Return the following interface:
{
createdAt: date,
updatedAt: date,
organisationId: number,
userId: number
}
Name | Refactoring | Security Risk | Usage |
---|---|---|---|
@polka/send-type | Minor | Low | TBC |
@slimio/is | Minor | Low | Type Checker |
argon2 | High | Crypto package | |
body-parser | Minor | High | Body Parser |
dotenv | Minor | Low | Load local .env in process.env |
indicative | Minor | Low | Validator |
jsonwebtoken | High | JWT Token | |
kleur | Minor | Low | Colors for TTY |
make-promises-safe | Medium | Force Node.js DEP00018 | |
polka | Low | HTTP Server | |
semver | Minor | Low | SemVer validation |
semver-sort | Minor | Low | Sort SemVer versions |
sequelize | High | ORM | |
sqlite3 | High | SQLite |
MIT