Skip to main content

👨‍💻 Development Setup

Let's get started with SwiftWave Development Setup!

📦 Pre-requisites

  1. A Virtual Server with Debian, Ubuntu, Fedora OS or their derivatives installed.

  2. Virtual Server should have at least 1GB RAM and 1vCPU.

  3. Install curl, git, unzip and tar utilities.

    # For Debian/Ubuntu based distros:
    sudo apt install curl git unzip tar

    # For Fedora based distros:
    sudo dnf install curl git unzip tar
  4. Install docker (Skip this step if you already have docker installed)

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh

    📌 Note: As RHEL doesn't support docker, SwiftWave doesn't support RHEL based distros.

  5. Install Golang by following this guide

  6. Install NodeJS by following this guide

  7. You are all set! 🎉

📥 Local Installation

  1. Fork and clone SwiftWave repository
    git clone git@github.com:<your_username>/swiftwave.git --recursive
  2. Build SwiftWave dashboard
    npm install
    npm run build:dashboard
  3. Initialize Docker Swarm
    sudo docker swarm init
  4. Move to sudo user
    sudo su
  5. Set the go module path, as sudo user you may not have access to your user's go module path.
    export PATH=$PATH:/usr/local/go/bin
  6. Initialize SwiftWave configuration. Run following command and provide required information.
    go run . init

    Note: If it ask for address for SwiftWave / Current Node, put 0.0.0.0 or 127.0.0.1 or Local IP of your system.

  7. Prepare Environment for SwiftWave
    go run . setup
  8. Run Local Postgres Database
    go run . postgres start
  9. Migrate Database Tables
    go run . db-migrate
  10. Disable TLS for SwiftWave Development Setup
    go run . tls disable
  11. Start HaProxy Service
    go run . haproxy start
  12. Start UDP Proxy Service
    go run . udpproxy start
  13. Create a new admin user with username admin and password also admin
    go run . create-user -u admin -p admin
  14. Start SwiftWave
    go run . start --dev
  15. 🎉 Congratulations! You have successfully setup SwiftWave for local development
  16. You can now access SwiftWave at http://localhost:3333

Access GraphQL Playground

  1. Use Login Endpoint for generating a JWT Token. You can also generate the token using curl command
    curl --location 'http://localhost:3333/auth/login' \
    --form 'username="admin"' \
    --form 'password="admin"'
  2. Go to http://localhost:3333/playground
  3. In headers section, add authorization details
    {
    "Authorization": "Bearer <token_retrieved_from_api>"
    }
  4. Now, click on refresh icon on playground to get schema details and avail the auto-complete feature
  5. You can now start querying and mutating data
  6. 🎉 Congratulations! You have successfully setup SwiftWave for local development