Build Linting Formatting Documentation Docker DockerHub

Minerva - Training Management System API

This repository contains the source code and documentation for a Training Management System API, designed to serve as the backend for the Minerva Web Application.

It provide the necessary endpoints to manage training programs and related entities.

This repository is part of the Minerva project.

Features

  • User Management: Easily manage user profiles, including creation, modification, and authentication, ensuring secure access to the system.
  • Training Management: Efficiently create, update, and retrieve training information, including descriptions, category, courses, trainer.
  • Course Management: Efficiently create, update, and retrieve course information, including descriptions, schedules, materials, trainer.
  • Enrollment: Enable users to enroll in specific courses, track their progress, and receive notifications for upcoming sessions.
  • Progress Tracking: Keep tabs on individual learner progress, track completion rates, and generate insightful reports on training performance.
  • Notifications: Automate communication with users by sending notifications about course updates, enrollment confirmations, and upcoming sessions.
  • Permissions and Roles: Assign different access levels and roles to users, enabling fine-grained control over the system's functionality.

For the full set of features refer to the API [documentation](See the Minerva project.).

Technologies

Requirements

Usage

See the Minerva project.

Development

This backend relies on a running MySQL database to function. You can either use your own instance of a MySQL database or use a Docker service that provide that.

To change the database see https://sequelize.org/docs/v6/getting-started/ for the sequelize drivers available. After installation change the dialect in src/models/index.js and config/config.js.

Standalone database

Create an .env file and add the following environment variables and fill accordingly with the database configuration. The rest of the configuration work as it is in development.

For the OpenAI key you will need an account, go to: OpenAI Sign-up

API_PORT=3000
DB_SERVER=localhost
DB_ROOT_PASSWORD=localhost
DB_DATABASE=minerva
DB_USERNAME=minerva
DB_PASSWORD=minerva
DB_PORT=3306
JWT_SECRET=d7a481461577ba4c3c4c6946cca7204b
JWT_EXPIRE=1d
JWT_ISSUER=minerva
JWT_AUDIENCE=web-minerva
OPENAI_API_KEY=d7a481461577ba4c3c4c6946cca7204b

Docker service

To use the provided Docker service refer to the main project Minerva.

Usages

Start the application in watch mode

npm run star:dev

Migrations

Run the migrations

npm run migrate:up

Roll back migrations

npm run migrate:undo

Seeds

Create seed

npx sequelize-cli seed:generate --name demo-user

Running the seeds

npm run seed:all

Roll back seeding

npm run seed:undo

Tests

// TODO: Implement section

Docker

Build the image.

docker build . -t alexandrelamberty/minerva-api:tag

Run the image with the default network and storage.

// FIXME: add storage reference from stack

docker run -p 3000:3000 --network=minerva_default --mount source=media_data,target=/usr/src/app/public --env-file .env.dev --name minerva-api -d alexandrelamberty/minerva-api:tag

Push image to DockerHub

docker push alexandrelamberty/minerva-api:tag

Documentation

npm run doc

Linting, Formatting and Spelling

npm run lint
npm run format
npm run spell

References