Skip to content

Latest commit

 

History

History
197 lines (118 loc) · 4.55 KB

CONTRIBUTING.md

File metadata and controls

197 lines (118 loc) · 4.55 KB

Contributing to Meltcd ✨

We really thank you for your interest in contributing to Meltcd!

This is a guide for you to get started with contributing to Meltcd. Please read it carefully before you start.

Table of Contents

Before we start, here are the important links you should know:

Getting Started

Things you need on your local machine:

You should have docker swarm up and running To start docker swarm just do

docker swarm init

After this we are all done

Project Structure

Meltcd is a monorepo, which have three things in it:

  • Meltcd API Server in server directory, build with GoLang using Fiber framework.

  • A CLI Client in cmd directory, build with GoLang using Cobra framework.

  • A Web Client in ui directory, build with ReactJS.

The application is build as a CLI, where Server can be started using meltcd server command.

The server will server the API on http://localhost:1771/api and the web client on http://localhost:1771.

Using GNU Make

We highly recommend to use GNU Make to run the commands from the Makefile.

Setting up locally

  1. Fork the repository
  2. Clone the repository
git clone https://github.com/your_username/meltcd
  1. Change the directory
cd meltcd
  1. Download frontend dependencies
pnpm --prefix ./ui install
pnpm --prefix ./ui build
# see the commands under `frontend` in `Makefile`, to use it without GNU Make
  1. Download server / cli dependencies
go mod download

pnpm install # some npm packages are used like husky for pre-commit
  1. Start the server
go run main.go server --verbose
  1. Using CLI
go run main.go app ls
  1. Using WEB Client

Open https://localhost:1771 in your browser.

Contributing to different parts of the project

Server

To contribute to the server, work in the server directory. Save the changes and run the server using go run main.go server --verbose.

Server also embeds swagger spec and swagger ui which can be accessed at http://localhost:1771/swagger/index.html.

To update the swagger spec, run

swag init --output ./docs/swagger

So every-time you need to update swagger spec and run the swerver you need to do

swag init --output ./docs/swagger
go run main.go server --verbose

The server will be running at post 1771 unless changed using environment variable, see the docs for more information.

The api will be served at http://localhost:1771/api.

Web Client

To contribute to the web client, work in the ui directory. The vite app in the ui directory will be build to the server/static directory so that the API Server can serve it.

Go to ui directory and run:

pnpm run dev

To start the development server. This will only start the frontend, so it will not be able to communicate with the server.

To start frontend with server, run:

make run

# or

pnpm --prefix build # you need to build the frontend first
go run main.go server --verbose

So to work on frontend, after changing the code, you need to build the frontend and start the server.

Deploying application: Head over to docs to see how to deploy the application.

CLI

To contribute to the CLI, work in the cmd directory. CLI is just cobra app which just do http request to the server.

You can run the CLI using

go run main.go app ls

For other CLI command see docs.

While the server is running, you can update the CLI code and test it.

Testing

To run tests, run:

make test

How to contribute?

Make sure you create a new branch before working on new feature or fixing a bug.

After you are done with the changes, create a pull request

Contributions are always welcome, no matter how large or small. If stuck, feel free to ask for help in the chat.

🚀