Welcome to the Skizzium API repository, housing all the inner workings of Skizzium.
If you're reading this, you're definitely a developer who is probably accessing this repository for their first time.
Let me teach you how stuff works around here.
Before anything, you have to install the following software to help you along on your journey:
- (Required) MongoDB Community Server
- A local database to use during development
- (Practically Required) MongoDB Compass
- For connecting to your local MongoDB instance and controlling the data on it
- (Optional) Redis
- Required for storing data in memory. Currently only used in the Gateway module. If not installed, the Gateway module will exit on startup.
- If you're on Windows, installation requires the Windows Subsystem for Linux installed.
- Installation instructions available here.
- (Optional) RabbitMQ
- Required for communication between the Gateway and the API modules.
- Installation instructions available here.
- (Recommended) Postman
- (Recommended) Visual Studio Code
- Prettier Extension (Recommended)
- ESLint Extension (Recommended)
- Alternatives: Notepad++, Sublime Text, Atom, JetBrains WebStorm, etc.
It's fairly easy to set up the server
- Clone the
developmentbranch - Rename the
.env-templateto.env - Fill out the needed variables in the
.envfile - Download the MongoDB community setup from the website and run it.
- Add the path to the
bin(egC:/Program Files/MongoDB/Server/5.0/bin) folder to your Path variable if it wasn't added automatically.
- Add the path to the
- (Optional) Download and setup WSL and Redis
- (Optional) Download and setup RabbitMQ
- Run
npm installto install all dependencies
- Run MongoDB with
npm run mongo - Run the Nginx reverse proxy with
npm run proxy - (Optional) Run
wsland thensudo service redis-server startto start up Redis - (Optional) Run RabbitMQ using the start menu shortcut
- Run individual microservices you'll need to develop or use for other work.
- Emails
- A local email service can be ran which will pretend to send out emails.
- Start with
npm run mail - You can access the dashboard at http://localhost::8025
- File Hosting
- A local file hosting service can be ran to allow file uploads to work.
- Start with
npm run files - If you need to access the files trough a frontend, please run the Media Proxy (
npm run media-proxy) as well. - You can access the dashboard at http://localhost:9000. The credentials are minioadmin:minioadmin.
The Skizzium API consists of many microservices (each microservice is a module).
The API consists of the following microservices:
- Authentication (
npm run auth)- (Shortened to Auth)
- Responsible for all authentication tasks, such as logging in, logging out, registering, etc.
- If you need the register endpoint working, the email service is required
- If you need logouts and session revokes to work, you need the Redis and RabbitMQ services.
- Builds (
npm run builds)- Accepts mod releases and game builds which are then pushed to the S3 bucket.
- Community (
npm run community)- Responsible for the community aspects of the API such as editing profile info, uploading avatars and banners, and etc.
- If you need file uploads and downloads to work (including images), you'll need the files service.
- Downloads (
npm run downloads)- Responsible for managing access to mod files and counting downloads.
- Requires the files service to be running.
- Gateway (
npm run gateway)- Gateway API which clients connect to via WebSockets and recieve events. It's also responsible to determine if a session is active or not.
- Moderation (
npm run downloads)- Responsible for content moderation
- Mods (
npm run mods)- Responsible for the mod distribution aspects of the API such as creating and managing mod pages, posting comments and etc.
- If you need file uploads and downloads to work (including images), you'll need the files service.
There's also some additional modules which aren't microservices:
- Common (Legacy)
- Used for shared code between all microservices. This is usually DB models, constants, utility functions and etc.
- Common TS (Modern)
- Used for shared code between all microservices. This is usually DB models, constants, utility functions and etc.
- Proxy (Not a module anymore)
- The proxy which accepts all requests and forwards them to the appropriate microservices
If you want to install or uninstall a package only to / from a specific module, use
the --workspace=@skizzium-api/<module> parameter.
This repo utilizes Prettier and ESLint to fix minor issues and keep the code style intact.
All PRs should pass the checks before they are merged. To format everything properly, run npm run fix.
If you don't want to do this every time you want to make a new PR, simply install the ESLint and Prettier plugins in
your editor.
To make sure everything works like a charm, we'll require you to write unit tests with the help
of Jest and Supertest. All PRs will be tested before they
are merged.
Don't worry yet though, we still haven't implemented the system properly.