Skip to content

thatguyinabeanie/battle-stadium-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Battle Stadium

Build

Battle Stadium is the definitive Pokemon VGC Tournament Hosting website. This project is a Ruby on Rails API with a modern React frontend, utilizing the Devise gem for authentication.

Table of Contents

Overview

Battle Stadium is designed to facilitate the hosting and management of Pokemon VGC tournaments. It features a robust backend built with Ruby on Rails and a dynamic frontend using NextJS. Authentication is handled via the Devise gem.

Development

Local Development

Local Requirements

Local Setup Steps

  1. Install docker

  2. Install bun

    curl -fsSL https://bun.sh/install | bash
  3. Install openssl. Windows users you're on your own

    brew install openssl@3
  4. Set up the correct ruby version with OpenSSL. Installing and setting up a ruby version manager is entirely up to you.

    Use your favorite ruby version manager to set up the correct ruby version. Below are examples of some of the most popular ruby version managers

    frum install  --with-openssl-dir=$(brew --prefix openssl)
    RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install
    RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" asdf install ruby
    rvm install 3.3.5 --with-openssl-dir=$(brew --prefix openssl@3) && rvm use
  5. Initialize .env files

    # from the root of the repo.
    ./init.sh     # Uses default values for postgres username, password, db name, and port
    
    # optional custom values
    ./init.sh p_username p_password p_db p_port

Visual Studio Devcontainers Development

Devcontainer Requirements

Devcontainer Setup Steps

  1. Install docker

  2. Install devcontainers cli using your favorite package manager

    bun add -g @devcontainers/cli
  3. Clone the repository:

    git clone https://github.com/thatguyinabeanie/battle-stadium.git
    cd battle-stadium
  4. Initialize .env files

    # from the root of the repo.
    ./init.sh     # Uses default values for postgres username, password, db name, and port
    
    # optional custom values
    ./init.sh p_username p_password p_db p_port
  5. Build the docker container images

    docker compose build
  6. Initialize containers

    docker compose up -d
  7. Open devcontainer instances in Visual Studio Code

    devcontainer open .

Testing

Running Tests Locally

  • Rails API RSpec Tests

    rspec
  • Front End Tests

    cd frontend
    bun test

Running Tests in devcontainers

From a VS Code devcontainer shell session

  • Rails API RSpec Tests

    rspec
  • Front End Tests

    bun test

From a local shell session

  • Rails API RSpec Tests

    # from the root of the repo
    docker compose run -rm backend bash -c "rspec"
  • Front End Tests

    # from the root of the repo
    docker compose run -rm frontend bash -c "bun test"

Running Services

Running Services Locally

  1. Rails API Server

    docker compose up -d db
    bundle exec rails server -b 0.0.0.0 -p 10000
  2. NextJS Server

    cd frontend
    bun dev

Running Services Through Docker

  1. Start the database container

    docker compose up -d
  2. Start the Rails API Server

    docker compose exec backend bash -c "bundle exec rails server -b 0.0.0.0 -p 10000"
  3. Start the NextJS Server

    docker compose exec frontend bash -c "bun dev"

Contributing

We welcome contributions! Please see our CODE_OF_CONDUCT.md and CONTRIBUTING.md for guidelines.

License

This project is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International Public License. Please see LICENSE file for details.

About

Battle Stadium - The Home of Competitive Pokemon

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages