Complete website for Tibia server management developed with Go (backend) and Next.js (frontend).
Before starting, make sure you have installed:
- Go 1.24+ - Download
- Node.js 18+ - Download
- pnpm - Node.js package manager
- MySQL 5.7+ or 8.0+ - Database
- Git - Version control
- Download the Go installer from: https://go.dev/dl/
- Run the installer and follow the instructions
- Verify the installation by opening PowerShell or CMD and running:
go versionShould display something like: go version go1.24.0 windows/amd64
- Download the LTS installer for Node.js from: https://nodejs.org/
- Run the installer and follow the instructions
- Verify the installation:
node --version
npm --versionWith Node.js installed, install pnpm globally:
npm install -g pnpmVerify the installation:
pnpm --versiongit clone <repository-url>
cd CodexAAC- Create a MySQL database:
CREATE DATABASE codexaac CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;- Import the database schema (if there's a SQL file):
mysql -u root -p codexaac < database.sqlCreate a .env file in the backend/ folder:
# Database
DATABASE_URL=mysql://user:password@localhost:3306/codexaac
# JWT (IMPORTANT: Use a secure key in production!)
JWT_SECRET=your-super-secure-secret-key-here
# CORS (allowed origins, comma-separated)
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001
# Path to Tibia server (optional)
# SERVER_PATH=C:/path/to/your/tibia/server
# Optional Settings
ACCOUNT_DELETION_GRACE_PERIOD_DAYS=30
MIN_GUILD_LEVEL=8You can configure the towns that will be available in the frontend for selection during character creation using the CHARACTER_TOWNS variable in the backend .env.
Format (example):
CHARACTER_TOWNS=1:Rookgaard,2:Thais,3:VenoreOr:
CHARACTER_TOWNS=Rookgaard=1,Thais=2If the variable is not defined, the server will automatically add Rookgaard (id 1) as default.
- Replace
userandpasswordwith your MySQL credentials - Generate a secure JWT key for production (you can use:
openssl rand -base64 32) SERVER_PATHis optional and should point to the root folder of your Tibia server (whereconfig.luais located)
Create a .env.local file in the frontend/ folder (if needed):
NEXT_PUBLIC_API_URL=http://localhost:8080cd backend
go mod downloadcd frontend
pnpm installcd backend
go run cmd/server/main.goThe backend server will be running at: http://localhost:8080
cd frontend
pnpm devThe frontend will be running at: http://localhost:3000
cd frontend
pnpm build
pnpm startcd backend
go build -o server.exe cmd/server/main.go
./server.exeCodexAAC/
βββ backend/ # API Backend (Go)
β βββ cmd/
β β βββ server/
β β βββ main.go # Server entry point
β βββ internal/
β β βββ database/ # Database connection
β β βββ handlers/ # HTTP handlers
β β βββ jobs/ # Background jobs
β βββ pkg/
β β βββ auth/ # JWT authentication
β β βββ config/ # Server configuration
β β βββ middleware/ # HTTP middlewares
β β βββ twofactor/ # Two-factor authentication
β β βββ utils/ # Utilities
β βββ go.mod # Go dependencies
β βββ .env # Environment variables
β
βββ frontend/ # Web Application (Next.js)
β βββ app/ # Next.js App Router
β β βββ components/ # React components
β β βββ services/ # API services
β β βββ ...
β βββ package.json # Node.js dependencies
β βββ .env.local # Environment variables
β
βββ README.md # This file
- Go 1.24+ - Programming language
- Gorilla Mux - HTTP router
- MySQL - Database
- JWT - Token authentication
- TOTP - Two-factor authentication
- Next.js 16 - React framework
- TypeScript - Static typing
- Tailwind CSS - CSS framework
- React 19 - UI library
POST /api/login- User loginPOST /api/register- User registrationPOST /api/logout- LogoutPOST /login.php- Tibia client loginPOST /login- Tibia client login (alternative)
GET /api/account- Account details (authenticated)DELETE /api/account- Request account deletionPOST /api/account/cancel-deletion- Cancel deletionGET /api/account/settings- Account settingsPOST /api/account/settings- Update settings
GET /api/characters- List charactersPOST /api/characters- Create characterGET /api/characters/{name}- Character detailsGET /api/towns- List configured towns (used in character creation)
GET /api/guilds- List guildsGET /api/guilds/{name}- Guild detailsPOST /api/guilds- Create guildPOST /api/guilds/{name}/invite- Invite playerPOST /api/guilds/{name}/accept-invite- Accept invitePOST /api/guilds/{name}/leave- Leave guildPOST /api/guilds/{name}/kick- Kick player
GET /api/admin/stats- Server statisticsGET /api/admin/accounts- List accountsGET /api/admin/maintenance- Maintenance statusPOST /api/admin/maintenance- Toggle maintenance
GET /api/health- Health checkGET /api- Welcome message
# Install dependencies
go mod download
# Run server
go run cmd/server/main.go
# Build for production
go build -o server.exe cmd/server/main.go
# Run tests (if any)
go test ./...# Install dependencies
pnpm install
# Development mode
pnpm dev
# Build for production
pnpm build
# Run production
pnpm start
# Linter
pnpm lint- JWT_SECRET: Use a strong and unique key in production
- DATABASE_URL: Do not share database credentials
- CORS: Configure only trusted origins in production
- HTTPS: Use HTTPS in production
- Check if MySQL is running
- Verify credentials in the
.envfile - Check if the database was created
- Add
JWT_SECRETto the backend.envfile - Restart the server after adding
- Make sure you have Node.js 18+ installed
- Try clearing the cache:
pnpm store prune - Delete
node_modulesandpnpm-lock.yamland reinstall
- Change the port in the
.envfile (backend) orpackage.json(frontend) - Or terminate the process using the port
This project is part of CodexAAC.
- Fork the project
- Create a branch for your feature (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Discord: Join our Discord server
- Issues: Open an issue in the project repository
Developed with β€οΈ for the Tibia community