Skip to content

beater-studios/pokemmo

Repository files navigation

PokéMMO

A browser-based 2D Pokémon-style MMO game built with TypeScript, Pixi.js, and Node.js. Features real-time multiplayer gameplay, map instances, chat system, and JWT authentication.

Requirements

  • Node.js 22 or higher (use nvm use to ensure the correct version)
  • Docker and Docker Compose (for PostgreSQL database)
  • npm or yarn

Installation

Step 1: Clone the Repository

git clone <repository-url>
cd pokemmo

Step 2: Start PostgreSQL Database

Start the PostgreSQL database using Docker Compose:

docker-compose up -d

This will create a PostgreSQL container on port 5432 with the following default credentials:

  • Database: pokemmo
  • User: postgres
  • Password: postgres

Step 3: Configure Environment Variables

Navigate to the server directory and copy the example environment file:

cd server
cp .env.example .env

The default .env configuration works with the Docker Compose setup. For production, update the security settings (see Environment Variables).

Step 4: Install Dependencies

Install all project dependencies:

npm install

This will install dependencies for all workspaces (client, server, and shared).

Development

Running Both Client and Server

To run both the client and server simultaneously in development mode:

npm run dev

Running Separately

You can also run the client and server in separate terminals:

Terminal 1 - Server:

npm run dev:server

Terminal 2 - Client:

npm run dev:client

Access Points

Controls

  • Arrow Keys or WASD: Move player
  • Enter: Send chat message

Docker Compose

The project includes a docker-compose.yml file to simplify database setup:

Start Database

docker-compose up -d

Stop Database

docker-compose down

View Database Logs

docker-compose logs -f postgres

Remove Database and Volumes

Warning: This will delete all database data.

docker-compose down -v

Environment Variables

The server/.env.example file contains all required environment variables. Copy it to .env:

cd server
cp .env.example .env

Server Environment Variables

Variable Description Default
DB_HOST PostgreSQL host localhost
DB_PORT PostgreSQL port 5432
DB_NAME Database name pokemmo
DB_USER Database user postgres
DB_PASSWORD Database password postgres
JWT_SECRET Secret key for JWT tokens your-secret-key-change-in-production
JWT_EXPIRES_IN JWT token expiration 7d
PORT Server port 3001
CLIENT_ORIGIN Allowed CORS origin http://localhost:3000

Client Environment Variables

Create a .env file in the client directory:

Variable Description Default
VITE_SERVER_URL WebSocket server URL http://localhost:3001
VITE_API_URL REST API URL http://localhost:3001/api

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

About

A browser-based Pokémon-style 2D MMO game built with TypeScript, Pixi.js, Node.js, and Socket.io. Features real-time multiplayer, map instances, chat system, and JWT authentication.

Resources

License

Stars

Watchers

Forks

Contributors