Apache synapse

Clone this repo:
  1. 4afe3d7 Merge pull request #6 from ThisaraWeerakoon/add-api by Isuru Udana Loku Narangoda · 5 weeks ago main
  2. 31fb99b refactor: Add router initialization, graceful http server shutting down, API deployment and regitration of http handlers by ThisaraWeerakoon · 5 weeks ago
  3. e8667b1 feat: Add router service to handle routing by ThisaraWeerakoon · 5 weeks ago
  4. 5cd13a9 refactor: Modify api artifact, unmarshaling logic and its tests by ThisaraWeerakoon · 5 weeks ago
  5. 1bace76 feat: Add http server configuration management. by ThisaraWeerakoon · 5 weeks ago

Synapse

This is an attempt to re-write the synapse code is Golang.


Prerequisites

  • Go 1.20+ (or a similar, recent version)
  • Make (commonly available on Linux/macOS; on Windows, you can install via Chocolatey or use a compatible environment like Git Bash or WSL)

Getting Started

  1. Clone the repository:

    git clone https://github.com/apache/synapse-go.git
    
  2. Check your Go version (optional):

    go version
    

Ensure it meets the minimum requirement.

Building & Packaging

  1. Install Dependencies

The Makefile automatically fetches Go module dependencies (via go mod tidy) when you run make for the first time.

  1. Build

To compile the Synapse binary for your local machine

make build

This fetches dependencies (if not already done).

Compiles the Go application and places the binary in the bin/ directory.

  1. Package

To create a zip file (synapse.zip) containing the compiled binary and the required folder structure run:

make package

This will:

  • Create a temporary synapse/ directory (in the project root) with: bin/ containing the compiled synapse binary artifacts/APIs artifacts/Endpoints
  • Zip everything into synapse.zip at the root of the project.
  • Clean up the temporary folders and the bin/ directory.
  1. All-in-One (Default)

Simply running make (or make all) will execute the following steps in order:

  • deps — Installs and tidies Go dependencies.
  • build — Builds the synapse binary in bin/.
  • package — Creates the synapse.zip with the required folder structure.
make
  1. Clean

If you want to remove all build artifacts and start fresh, run:

make clean

This deletes the bin/ folder and any synapse/ directories created during the packaging step.

Customizing the Build

If you need to cross-compile for multiple OS/architectures, you can add additional targets to the Makefile. For example:

build-linux:
    GOOS=linux GOARCH=amd64 go build -ldflags=$(LDFLAGS) -o bin/$(PROJECT_NAME) $(MAIN_PACKAGE)

Then run:

make build-linux

…and package as usual with:

make package

(Adjust paths and names as needed.)

Running the server

After you unzip synapse.zip, you will see:

synapse/
├── bin/
│   └── synapse       # Compiled binary
└── artifacts/
    ├── APIs/
    └── Endpoints/

Unzip the archive:

unzip synapse.zip

Run the binary:

cd synapse/bin
./synapse

(On Windows, it would be .\synapse.exe if compiled for Windows.)

Contributing

  • Fork the repository

  • Create your feature branch (git checkout -b feature/my-feature)

  • Commit your changes (git commit -am ‘Add some feature’)

  • Push to the branch (git push origin feature/my-feature)

  • Create a new Pull Request

License

Apache 2