elmadev / elmaonline-site

:apple: Backend for the Elma Online site
https://elma.online
Other
14 stars 2 forks source link
elma hacktoberfest

elmaonline-site

Node JS based backend for the elmaonline site. The frontend is found in the elmaonline-web repo.

Branches

Get started

  1. Install if needed nodejs (v18 or later, tested with up to v22)

    • If you install node using nvm you might need to install corepack manually npm install -g corepack
  2. run corepack enable to enable yarn v3

  3. Clone this repo

  4. Run yarn in terminal to install depedencies

  5. Run yarn start in terminal to start development server

Config

Tech stack

Folder structure

.
├── /                      # 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

Imports

Be aware of newer nodejs versions requiring imports done with file extensions.

Setup editor

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:

Test database

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.

Communication

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.