Skip to content
/ herve Public

Service Orchestration Platform in Netwide Assembly

License

Notifications You must be signed in to change notification settings

bla-ce/herve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

697 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Herve

Herve is a service orchestration platform written in x86-64 Assembly. It allows you to spin up, manage, and proxy services through a unified interface.

Warning

This project is intended for educational purposes only and is not yet ready for production use. It's Assembly, not sure what you were expecting to be honest.

Overview

Think of Herve as a minimalist alternative to cloud service platforms. It acts as the central hub that:

  • Registers and manages services - Spin up built-in or custom services
  • Proxies requests - Routes traffic to the appropriate service
  • Enforces contracts - Ensures all services comply with a defined interface

You can use the built-in services or create your own. As long as your service implements the Herve contract, it can be registered and managed like any other.

Background

To gain a deeper knowledge of computer architecture, networking and how the CPU works at the instruction level, I wanted to build projects in Assembly, so I decided to write a HTTP server library.

After one year and ~28,500 lines of Assembly code, I decided to move away from a library to an actual project. The goal: a cloud platform in x86 to compete (lol) against AWS, GCP, Azure and so on.

Building

Requires NASM and GNU LD.

make

The binary will be available at bin/herve.

Running

./bin/herve

By default, Herve listens on port 5000, but you can update the listening port with the PORT environment variable.

Service Management API

Register a service

curl -X POST http://localhost:5000/services/register \
  -d "name=my-service&type=echo"

List services

curl http://localhost:5000/services

Returns all registered services with their id, name, type, and status.

Unregister a service

curl -X POST http://localhost:5000/services/:id/unregister

Start a service

curl -X POST http://localhost:5000/services/:id/start

Stop a service

curl -X POST http://localhost:5000/services/:id/stop

Creating Custom Services

Custom services must implement the Herve service contract. A service is defined by:

Field Description Need to be defined
id Auto-generated service identifier no
name Name of the service no
status Current status of the service no
type Type of the service yes
register Function pointer to register the service yes
unregister Function pointer to unregister the service yes
start Function pointer to start the service yes
stop Function pointer to stop the service yes
group Pointer to the server group with all the routes no
next Pointer to the next service (linked list) no

Project Structure

herve/
β”œβ”€β”€ src/           # Main application source
β”‚   β”œβ”€β”€ herve.s    # Entry point and service manager
β”‚   └── services/  # Service registration logic
β”œβ”€β”€ svc_impl/      # Built-in service implementations
β”œβ”€β”€ include/       # Public API headers
β”‚   β”œβ”€β”€ server/    # Socket, routing, context
β”‚   β”œβ”€β”€ http/      # Request/response handling
β”‚   β”œβ”€β”€ http_models/   # CRUD endpoint generation
β”‚   β”œβ”€β”€ auth/      # Authentication
β”‚   └── middlewares/   # Logger, proxy, CSRF
β”œβ”€β”€ lib/           # Core libraries
β”‚   β”œβ”€β”€ malloc/    # Memory allocator
β”‚   β”œβ”€β”€ net/       # Sockets, epoll, select
β”‚   β”œβ”€β”€ encoding/  # JSON, Base64
β”‚   β”œβ”€β”€ hash_table/    # Key-value storage
β”‚   β”œβ”€β”€ model/     # Data model system
β”‚   β”œβ”€β”€ utils/     # Strings, linked lists, arrays
β”‚   β”œβ”€β”€ logan/     # Logging
β”‚   └── boeuf/     # Dynamic buffers
β”œβ”€β”€ examples/      # Working examples
└── tests/         # Unit tests

Examples

The examples/ directory contains demonstrations from when Herve was a library. They showcase the underlying HTTP server capabilities:

  • hello-world - Minimal server setup
  • models - Data model CRUD operations
  • groups - Route grouping and prefixes
  • echo - Echo server
  • proxy - Reverse proxy configuration
  • static-content - Static file serving

And because apparently, now, it has to be mentioned, absolutely no AI was used, but this project probably served to train AI :)

About

Service Orchestration Platform in Netwide Assembly

Topics

Resources

License

Stars

Watchers

Forks