👨💻 Development Setup
Let's get started with SwiftWave Development Setup!
📦 Pre-requisites
- A Virtual Server with Debian, Ubuntu, Fedora OS or their derivatives installed.
- Virtual Server should have at least 1GB RAM and 1vCPU.
- 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 - 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.
- Install Golang by following this guide
- Install NodeJS by following this guide
- You are all set! 🎉
📥 Local Installation
- Fork and clone SwiftWave repository
git clone git@github.com:<your_username>/swiftwave.git --recursive
- Build SwiftWave dashboard
npm install
npm run build:dashboard - Initialize Docker Swarm
sudo docker swarm init
- Move to sudo user
sudo su
- 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
- 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.
- Prepare Environment for SwiftWave
go run . setup
- Run Local Postgres Database
go run . postgres start
- Migrate Database Tables
go run . db-migrate
- Disable TLS for SwiftWave Development Setup
go run . tls disable
- Start HaProxy Service
go run . haproxy start
- Start UDP Proxy Service
go run . udpproxy start
- Create a new admin user with username admin and password also admin
go run . create-user -u admin -p admin
- Start SwiftWave
go run . start --dev
- 🎉 Congratulations! You have successfully setup SwiftWave for local development
- You can now access SwiftWave at
http://localhost:3333
Access GraphQL Playground
- 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"' - Go to
http://localhost:3333/playground
- In headers section, add authorization details
{
"Authorization": "Bearer <token_retrieved_from_api>"
} - Now, click on
refresh
icon on playground to get schema details and avail the auto-complete feature - You can now start querying and mutating data
- 🎉 Congratulations! You have successfully setup SwiftWave for local development