forked from noxious/server
54 lines
1.3 KiB
Markdown
54 lines
1.3 KiB
Markdown
# Noxious game server
|
|
|
|
This is the server for the Noxious game.
|
|
|
|
## Projects requirements
|
|
|
|
- NodeJS 20.x or higher
|
|
- MariaDB 11.x or higher
|
|
- Redis 7.x or higher
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies with `npm install`
|
|
3. Copy the `.env.example` file to `.env` and fill in the required variables
|
|
4. Extract assets.zip to the `public` folder
|
|
5. After MySQL and Redis are running, run `npm run mikro-orm migration:up` to create the database schema
|
|
6. Run the server with `npm run dev`
|
|
7. Write `init` in the console to import default data and restart the server
|
|
8. Write `tiles` in the console to fix tile sizes
|
|
|
|
## Commands
|
|
|
|
### `npm run dev`
|
|
|
|
Starts the server in development mode.
|
|
|
|
### `npm run build`
|
|
|
|
Builds the server for production.
|
|
|
|
### `npm run format`
|
|
|
|
Formats the code using Prettier.
|
|
|
|
## MikroORM
|
|
|
|
MikroORM is used as the ORM for the server.
|
|
|
|
### Create init. migrations
|
|
|
|
Run `npm run mikro-orm migration:create --initial` to create a new initial migration.
|
|
|
|
### Create migrations
|
|
|
|
Run `npm run mikro-orm migration:create` to create a new migration. You do this when you want to add a new table or change an existing one.
|
|
|
|
### Apply migrations
|
|
|
|
Run `npm run mikro-orm migration:up` to apply all pending migrations.
|
|
|
|
### Import default data
|
|
|
|
After running the server, write `init` in the console to import default data. |