Node JS based backend for the elmaonline site. The frontend is found in the elmaonline-web repo.
Install if needed nodejs (v18 or later, tested with up to v22)
npm install -g corepack
run corepack enable
to enable yarn v3
Clone this repo
Run yarn
in terminal to install depedencies
Run yarn start
in terminal to start development server
src/config.defaults.js
has default config, this should only be changed if you are adding new keys.src/config.local.js
has your local config changes, it's empty by default, so just add keys from the above that you wish to change.src/config.js
merges the two files above with priority to local.js, this is the file that should be including when using config values in the code for example import config from './config';
if you're in the src folder..
├── / # Various configuration files
├── /events # Examples of event api calls
├── /public # Static files served
├── /src # This is where your code will be
├── /api # Endpoints used by frontend
├── /constants # Constants used in code
├── /data # Database models and json files
├── /middlewares # Express middleware
├── /utils # Helper functions etc.
├── /config.default.js # Default config
├── /config.js # Combined config, use this in code
├── /config.local.js # Local config changes
├── /dl.js # Endpoints for downloads
├── /events.js # Endpoints for events, called by game server
├── /index.js # Entry point and express set up
├── /run.js # Cron jobs and one time imports
├── /start.mjs # Entry point for pm2
├── /upload.js # Endpoints for uploads
Be aware of newer nodejs versions requiring imports done with file extensions.
import { func } from '../utils/funcs.js'
import { func } from '../utils/index.js
import { func } from '#utils/funcs'
package.json
The project is configured to use eslint and prettier to ensure good coding practices. Make sure you install relevant plugins for your editor.
Visual Studio Code:
The config is set up to use a test database. Bear in mind the following:
Explanation of database structure can be found in this google sheet.
Feel free to create issues here on github in order to discuss things related to the project. You can also join the elma discord #developers channel to chat.