DEV Community


Posted on

AtomicServer - A fast and modulable way to develop a client-server app

Hello everybody, I hope you're having a great day.

Presentation & Genesis

Let me introduce myself, Grégoire TAJA, 21 years old, passionate about tech for about ten years now. I've always been horrified to see the indecent amount of code being copied and pasted every day. Also, today's hyperconnectivity pushes us to implement expensive client-server architectures, or WebServices such as REST, which are less expensive, but quickly limited by the inability of WebService to notify a client without any request being sent by the client. This is the origin of AtomicServer.

What is AtomicServer ?

AtomicServer is several things at the same time, the whole allowing the implementation of a client-server architecture, in a simplified way and customizable as you wish. First of all, a software is used as a base for the server and will manage all communications with the client. Secondly, a Java library for the client allows to manage the communications with the server. Finally, a library for the server, also in Java, gives you the possibility to develop your specific functionalities within a plugin. Plugins can depend on each other allowing maximum modularity and thus avoid duplicating code.

How it's work ?

Various concepts have been implemented:

  • Commands: allows you to execute a custom command in the server console.
  • Requests: similar to routes in WebServices, allows the client to request something from the server.
  • Triggers: allows the server to notify a client of a particular event.
  • Listeners: allows the server to intercept different events such as the connection of a new client or the reception of a custom packet.


This is how to send & receive a json packet with AtomicServer :

/**** Send Packet from server side ****/
// 1. Create json to send with javax.json
JsonObject json = Json.createObjectBuilder()
                .add("message", "Hello World")
                .add("type", "INFO")
// 2. Send the packet to all client
server.broadcastPacket(new JsonPacket(json));

/**** Receive Packet from client side ****/
public class ChatListener implements Listener {
    public void onPacketReceive(PacketReceivedEvent event) {
        // Check the type of packet
        if (event.getPacket() instanceof JsonPacket) {
            // Cast into JsonPacket
            JsonPacket jsonPacket = ((JsonPacket)event.getPacket());

            // Get JsonObject
            JsonObject json = jsonPacket.getJsonValue().asJsonObject();

            // Get the data
            json.getString("message"); // "Hello World"
            json.getString("type"); // "INFO"

That's it !

Project progress

As you can see, this is quite a large project. The basic functional bricks are there and you can already experiment with it. However, there is a lot to do before it becomes a production project:

  • Encryption of communications (everything is clear for now).
  • Development of the client library for the main platforms (Node, PHP, Android & iOS).
  • Improve plugin security (containerized plugins in their respective folders).
  • Implementation of unit tests / properties tests.
  • Improvement of the Wiki and the doc.
  • Add features according to different user needs.

The project is of course open source (X11 License) and all contributions are welcome.

Thank you very much for taking the time to read this presentation, and I hope you enjoy the project.

I look forward to your feedback :)

Website & Forum :
Wiki :
Gitlab :
Documentation :

Top comments (0)