Skip to content
Open

4.0.0 #235

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env.schema
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
JWT_SECRET=SuperSecretDoNotShareToAnyoneElse
DISCORD_BOT_TOKEN=Tokxxxxxxxen
# postgresql://[user[:password]@][host][:port][/dbname][?options]
DATABASE_URL=postgresql://growserver:ilovereimu@localhost:5432/growserver
# mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
DATABASE_URL=mongodb://growserver:ilovereimu@localhost:27017
BETTER_AUTH_SECRET=
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"source.fixAll.eslint": "always"
},
"eslint.workingDirectories": [
{
"mode": "auto"
}
]
"./packages/**/*",
"./apps/**/*"
],
}
12 changes: 12 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"formatter": [
// Use ESLint's --fix:
{ "code_action": "source.fixAll.eslint" },
// Organize imports on save:
{ "code_action": "source.organizeImports" },
],
}
44 changes: 44 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# HTTP configuration - proxies to the main app
http://:80 {
reverse_proxy localhost:3000 {
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
header_up Host {http.request.host}
}
}

# HTTPS for localhost and www.growtopia1.com (uses custom certificate for Growtopia login)
https://localhost:443, https://www.growtopia1.com:443 {
tls apps/logon/assets/ssl/server.crt apps/logon/assets/ssl/server.key

handle /growtopia/server_data.php {
reverse_proxy localhost:3001 {
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
header_up Host {http.request.host}
}
}

handle {
respond 404
}
}

# Domain-specific configuration for growserver.app using automatic local HTTPS
# Change this if you own a specific domain
growserver.app {

# Please comment this if you using actual domain
#tls internal

reverse_proxy localhost:4321 {
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
header_up Host {http.request.host}
}
}

# HTTP to HTTPS redirect for growserver.app
http://growserver.app {
redir https://growserver.app{uri} permanent
}
44 changes: 44 additions & 0 deletions Caddyfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# HTTP configuration - proxies to the main app
http://:80 {
reverse_proxy localhost:3000 {
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
header_up Host {http.request.host}
}
}

# HTTPS for localhost and www.growtopia1.com (uses custom certificate for Growtopia login)
https://localhost:443, https://www.growtopia1.com:443 {
tls apps/logon/assets/ssl/server.crt apps/logon/assets/ssl/server.key

handle /growtopia/server_data.php {
reverse_proxy localhost:3001 {
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
header_up Host {http.request.host}
}
}

handle {
respond 404
}
}

# Domain-specific configuration for growserver.app using automatic local HTTPS
# Change this if you own a specific domain
growserver.app {

# Please comment this if you using actual domain
tls internal

reverse_proxy localhost:4321 {
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
header_up Host {http.request.host}
}
}

# HTTP to HTTPS redirect for growserver.app
http://growserver.app {
redir https://growserver.app{uri} permanent
}
14 changes: 2 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
FROM alpine AS mkcert-build


RUN apk --no-cache add curl
RUN curl -JLO "https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64" && \
chmod +x mkcert-v1.4.4-linux-amd64

FROM node:22-alpine

WORKDIR /app
COPY . .
COPY --from=mkcert-build /mkcert-v1.4.4-linux-amd64 /app/.cache/bin/mkcert

VOLUME /app

RUN corepack enable && corepack prepare pnpm@latest

RUN pnpm install --frozen-lockfile

EXPOSE 80/tcp
EXPOSE 8080/tcp
EXPOSE 443/tcp
EXPOSE 17091/udp
EXPOSE 17091-17095/udp
EXPOSE 3000-3001/udp

# RUN chmod +x /app/.cache/bin/mkcert

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2025 JadlionHD
Copyright (c) 2022-2026 JadlionHD

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,49 @@ and access it on here https://local.drizzle.studio/
To run the development server by

```
$ pnpm run start
$ pnpm run dev
```

## Development

In order to make new login system work you need to install [mkcert](https://github.com/FiloSottile/mkcert) on this [download page](https://github.com/FiloSottile/mkcert/releases) (I'd recommend using [Lets encrypt](https://letsencrypt.org/getting-started/) for production only)
In order to make new login system work you need to setup caddy on this [local https](https://caddyserver.com/docs/automatic-https#local-https) (I'd recommend using [Lets encrypt](https://letsencrypt.org/getting-started/) for production only)

### HTTPS CA installation
For Production: If you want to deploy this into server, make sure to comment some `tls internal` inside `Caddyfile` since it require to request LetsEncrypt to request your domain to register and obtain the SSL cert.

For Local: As the caddy server already automated the process, you should navigate to [Caddy Server](#caddy-server)

### Local CA installation

Install the mkcert local CA by
### Caddy server
For developemnt only you can skip this part if you're trying to deploy to server.

Since the we're running the separated caddy instead of from the docker one, you have to download the caddy server from [here](https://caddyserver.com/download)

Or you could using this command (windows user)
```sh
$ winget install Caddy.Caddy
```
$ mkcert -install

And run the caddy server by
```sh
$ caddy run --config Caddyfile
```

Or if you on development you should use this instead
And run the caddy server by
```sh
$ caddy run --config Caddyfile.dev
```


### Hosts

For the hosts file you can see this example below

```
127.0.0.1 www.growtopia1.com
127.0.0.1 www.growtopia2.com
127.0.0.1 login.growserver.app # New login system for development purposes
127.0.0.1 growserver.app # New login system for development purposes
```

## Docker
Expand All @@ -83,7 +103,7 @@ To run the dockerized & running it automatically just run
docker compose up -d
```

or you want to run the database & redis only (this were for development only) then simply running
or you want to run the database & redis only (this for development only) then simply running

```sh
docker compose up -d db redis
Expand Down
Binary file added apps/enet-server/assets/player_tribute.dat
Binary file not shown.
16 changes: 16 additions & 0 deletions apps/enet-server/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { eslintConfig } from "@growserver/config/eslint";

export default [
...eslintConfig,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},
rules: {
"@typescript-eslint/no-require-imports": "off"
}
},
];
64 changes: 64 additions & 0 deletions apps/enet-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "enet-server",
"version": "4.0.0",
"description": "A Growtopia private server built with Node.js and Bun.js, powered by growtopia.js",
"main": "dist/src/app.js",
"scripts": {
"test": "nr build && (node dist/src/app.js || bun run dist/src/app.js)",
"lint": "eslint ./src --config ./eslint.config.ts",
"lint:fix": "eslint ./src --config ./eslint.config.ts --fix",
"bun": "cross-env RUNTIME_ENV=bun bun run --bun",
"node": "cross-env RUNTIME_ENV=node node",
"tsx": "cross-env RUNTIME_ENV=node tsx",
"dev": "cross-env RUNTIME_ENV=node tsx ./src/app.ts",
"seed": "nr tsx scripts/seeds.ts || nr bun scripts/seeds.ts",
"build": "rimraf dist && tsc",
"setup": "nr push && nr tsx scripts/setup.ts || nr bun scripts/setup.ts",
"clean": "rimraf .cache dist",
"iteminfo": "nr tsx scripts/item-info/build.ts || nr bun scripts/item-info/build.ts",
"install:server": "nr setup && nr build && nr push && nr seed && nr iteminfo",
"start": "nr start:bun || nr start:node",
"start:bun": "nr bun dist/src/app.js",
"start:node": "nr node dist/src/app.js"
},
"keywords": [],
"author": "JadlionHD <jadlion.dev@gmail.com>",
"license": "MIT",
"dependencies": {
"@antfu/ni": "^25.0.0",
"@growserver/config": "workspace:*",
"@growserver/const": "workspace:*",
"@growserver/db": "workspace:*",
"@growserver/logger": "workspace:*",
"@growserver/types": "workspace:*",
"@growserver/utils": "workspace:*",
"bcryptjs": "^3.0.2",
"chokidar": "^4.0.3",
"cross-env": "^10.0.0",
"dayjs": "^1.11.19",
"dotenv": "^17.2.2",
"drizzle-orm": "^0.44.5",
"fast-xml-parser": "^5.2.5",
"grow-items": "^1.3.1",
"growtopia.js": "^2.2.0",
"jsonwebtoken": "^9.0.2",
"ky": "^1.10.0",
"mwparser": "^1.3.3",
"nanoid": "5.1.5",
"rimraf": "^6.1.0",
"tsx": "^4.20.5"
},
"devDependencies": {
"@types/bun": "^1.2.21",
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^24.3.1",
"drizzle-kit": "^0.31.4",
"jiti": "^2.5.1",
"type-fest": "^4.41.0",
"typescript": "^5.9.2"
},
"engines": {
"node": ">=18.0.0",
"npm": ">=7.0.0"
}
}
18 changes: 18 additions & 0 deletions apps/enet-server/src/abstracts/ICommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { CommandOptions } from "@growserver/types";

export abstract class ICommand {
public opt: CommandOptions = {
name: "",
description: "",
cooldown: 1,
ratelimit: 1,
category: "",
usage: "",
example: [],
permission: [],
};

constructor() {}

abstract execute(text: string, args: string[]): Promise<void>;
}
6 changes: 6 additions & 0 deletions apps/enet-server/src/abstracts/IEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export abstract class IEvent {
public name: string = "";
constructor() {}

abstract execute(...args: unknown[]): Promise<void>;
}
Loading
Loading